public DeletePopup(final CommandWithCommitMessage command) { super(CommonImages.INSTANCE.edit(), "Delete this item"); checkInCommentTextBox.setTitle("Check in comment"); checkInCommentTextBox.setWidth("200px"); addAttribute("Check in comment:", checkInCommentTextBox); final HorizontalPanel hp = new HorizontalPanel(); final Button create = new Button("Delete item"); create.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { if (!Window.confirm("Are you sure you want to delete this asset?")) { return; } hide(); command.execute(checkInCommentTextBox.getText()); } }); hp.add(create); Button cancel = new Button("Cancel"); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent arg0) { hide(); } }); hp.add(new HTML(" ")); hp.add(cancel); addAttribute("", hp); }
private void initLayout() { FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined(); loginForm.addComponent(userName = new TextField("Username")); loginForm.addComponent(passwordField = new PasswordField("Password")); loginForm.addComponent(login = new Button("Login")); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSizeUndefined(); loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setCompositionRoot(rootLayout); setSizeFull(); }
public Form getAboutUs() { final Form f = new Form("Event counting"); if (frmAboutUs == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); final Button pushButton = new Button("Tap me!"); final Label countLabel = new Label(" "); pushButton.addActionListener( new ActionListener() { private int c = 0; public void actionPerformed(ActionEvent ae) { c++; countLabel.setText(Integer.toString(c)); f.layoutContainer(); pushButton.setText("Tapped " + Integer.toString(c) + " times"); // System.out.println(Integer.toString(c)); } }); f.addComponent(pushButton); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return f; }
@Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub go.pressed = false; info.pressed = false; back.pressed = false; }
public void tick() { zordz.screen.setOff(0, 0); volume.setValue(Options.SOUND_LEVEL * 4); if (cancel.clicked()) { saveOptions(); if (backToState == 0) { zordz.switchState(zordz.titlestate); } else if (backToState == 1) { zordz.switchState(zordz.gamestate); } SoundPlayer.play(Sound.button_clicked); } else if (volume.clicked()) { volume.setValue(Mouse.getX() - 100); Options.SOUND_LEVEL = Math.round(volume.value / 4); } else if (done.clicked()) { saveOptions(); if (backToState == 0) { zordz.switchState(zordz.titlestate); } else if (backToState == 1) { zordz.switchState(zordz.gamestate); } SoundPlayer.play(Sound.button_clicked); } if (console.wasClicked) { zordz.console.setVisible(console.checked); } }
private com.vaadin.ui.Component buildFields() { HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.setIcon(FontAwesome.USER); username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final PasswordField password = new PasswordField("Password"); password.setIcon(FontAwesome.LOCK); password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button signin = new Button("Sign In"); signin.addStyleName(ValoTheme.BUTTON_PRIMARY); signin.setClickShortcut(ShortcutAction.KeyCode.ENTER); signin.focus(); fields.addComponents(username, password, signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); signin.addClickListener( new Button.ClickListener() { @Override public void buttonClick(final Button.ClickEvent event) { DashboardEventBus.post( new UserLoginRequestedEvent(username.getValue(), password.getValue())); } }); return fields; }
private Button genBut(String name) { Button b = new Button(name); b.addStyleName("user-select"); b.setIcon(userIcon); b.addClickListener( e -> { if (loginBox.isVisible()) { hidePass(); return; } loginField.setValue(""); String t = e.getButton().getCaption(); if (Globals.control.hasPassword(t)) { selected = Globals.control.getUser(t); showPassField(); } else { User s = Globals.control.getUser(t); if (s == null) { return; } Globals.user = s; Globals.root.changeScreen(Globals.user); } }); return b; }
/** * Sets up the add button, which is used to add filters to the graph and to the table view. * * @return The fully configured add button. */ private Button setAddButton() { final Button addButton = new ImageButton("add.png"); addButton.setOnAction(actionEvent -> filterEditingMenu.showMenu()); addButton.setScaleX(0.5); addButton.setScaleY(0.5); return addButton; }
/** Create the tag frame. */ TextFrame(int x, int y, String title, String text) { setTitle(title); TextArea txt = new TextArea(20, 60); txt.setText(text); txt.setEditable(false); add("Center", txt); Panel p = new Panel(); add("South", p); Button b = new Button(amh.getMessage("button.dismiss", "Dismiss")); p.add(b); class ActionEventListener implements ActionListener { public void actionPerformed(ActionEvent evt) { dispose(); } } b.addActionListener(new ActionEventListener()); pack(); move(x, y); setVisible(true); WindowListener windowEventListener = new WindowAdapter() { public void windowClosing(WindowEvent evt) { dispose(); } }; addWindowListener(windowEventListener); }
public AppointmentFormPage() { popupPanel = new PopupPanel(true); popupPanel.add(uiBinder.createAndBindUi(this)); close.addClickHandler(closeHandler()); cancel.addClickHandler(closeHandler()); submit.addClickHandler(createSaveHandler()); }
/** * Sets up the remove button, which is used to remove filters from the table view and the graph. * * @param tableView The table view needed to get the currently selected filter. * @return The fully configured remove button. */ private Button setRemoveButton(TableView tableView) { final Button removeButton = new ImageButton("remove.png"); removeButton.setOnAction( actionEvent -> { final FilterInput filterInput = (FilterInput) tableView.getSelectionModel().getSelectedItem(); if (!data.isEmpty() && filterInput != null) { // Update model final IUserCommand updateGraphFilterCommand = interactionMap.get(FilterInteraction.REMOVE); if (updateGraphFilterCommand != null) { filterInput.setDeleted(); updateGraphFilterCommand.setSelection(filterInput); notifyListeners(updateGraphFilterCommand); logger.debug( "Removed FilterInput: " + filterInput.getName() + " from table view and database."); } else { logger.warn("no remove command mapped"); } } }); removeButton.setScaleX(0.5); removeButton.setScaleY(0.5); return removeButton; }
private void recursiveAddFolder(final Object folder, final Object subFolder) { if (folder != null) { recursiveAddFolder(fsm.getParent(folder), folder); } if (curFolderGroup.getNumChildren() > 0) { Label l = new Label(fsm.getSeparator()); l.setTheme("pathseparator"); curFolderGroup.add(l); } String name = getFolderName(folder); if (name.endsWith(fsm.getSeparator())) { name = name.substring(0, name.length() - 1); } Button btn = new Button(name); btn.addCallback( new Runnable() { public void run() { if (setCurrentFolder(folder)) { selectFolder(subFolder); } listbox.requestKeyboardFocus(); } }); btn.setTheme("pathbutton"); curFolderGroup.add(btn); }
private Component createProfileEditorInvite() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); if (!SettingsManager.get().isSettingsEditorEnabled()) { layout.addComponent( new Label("No connection profiles defined and you are not allowed to create one.")); } else { Button createProfileLink = new Button( "Create profile", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { addProfile(); } }); createProfileLink.setStyleName(ValoTheme.BUTTON_LINK); Label line1 = new Label("No connection profiles defined."); line1.setSizeUndefined(); VerticalLayout inner = new VerticalLayout(); inner.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); inner.addComponents(line1, createProfileLink); layout.addComponents(inner); } return layout; }
@Override public void initialize(URL location, ResourceBundle resources) { ImageView backImgBtnLayout = createImageBtnLayout( Constants.BACK_IMAGE_PATH, Constants.BACK_IMAGE_WIDTH, Constants.BACK_IMAGE_HEIGHT); backBtn.setGraphic(backImgBtnLayout); ImageView addImgBtnLayout = createImageBtnLayout( Constants.ADD_BUTTON_IMAGE_PATH, Constants.ADD_IMAGE_WIDTH, Constants.ADD_IMAGE_HEIGHT); addButton.setGraphic(addImgBtnLayout); cancelBtn.setOnAction( event -> { showWindow(true, false); setTitle(Constants.CHARACTER_SCENE_HEADER.toUpperCase()); }); levelField.setEditable(false); classBox.setItems( FXCollections.observableArrayList( "Guardin", "Assassin", "Archmage", "Necromancer", "Prophet", "Shaman", "Druid", "Ranger")); characterRaceBox.setItems( FXCollections.observableArrayList( "Human", "Gnome", "Dwarf", "Elf", "Eladin", "Tiefling", "Deva", "Goliath")); }
private void initComponents() { setSpacing(true); HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true); layout.setWidth("100%"); cardNuberField = new TextField(); cardNuberField.setWidth("100%"); cardNuberField.setInputPrompt("Ноомер социальной карты, либо e-mail"); layout.addComponent(cardNuberField); layout.setComponentAlignment(cardNuberField, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(cardNuberField, 1.0f); addComponent(layout); layout = new HorizontalLayout(); layout.setSpacing(true); layout.setWidth("100%"); checkwordField = new TextField(); checkwordField.setWidth("100%"); checkwordField.setInputPrompt("Проверочное слово"); layout.addComponent(checkwordField); layout.setComponentAlignment(checkwordField, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(checkwordField, 1.0f); addComponent(layout); Button btnSearch = new Button("Найти"); btnSearch.addClickListener(getSearchClickListener()); addComponent(btnSearch); }
public void run(final RootPanel rp, final String nick) { if (Cookies.getCookie(nick) == null) Cookies.setCookie(nick, "" + 0); cl.setPageSize(500); final Button sendMessage = new Button( "sendMessage", new ClickHandler() { public void onClick(ClickEvent event) { if (!message.getText().equals("")) { new Post().postJson(SERVERURL, nick.toString(), message.getText()); message.setText(""); } } }); rp.get("mainDiv2").setVisible(true); message.getElement().setAttribute("placeholder", "Introduce your message"); message.getElement().setAttribute("id", "message"); cl.getElement().setAttribute("id", "chatBox"); sendMessage.getElement().setAttribute("id", "sendMessage"); sendMessage.setText("Send"); vp.getElement().setAttribute("id", "verticalPanel"); hp.getElement().setAttribute("id", "horizontalPanel"); panel.getElement().setAttribute("id", "scroller"); hp.add(message); hp.add(sendMessage); panel.add(cl); vp.add(panel); vp.add(hp); rp.get("mainDiv2").add(vp); Timer t = new Timer() { @Override public void run() { getMessages(); if (chatList != null && Integer.parseInt(Cookies.getCookie(nick)) < chatList.size()) { cl.setRowCount(chatList.size() + 1, true); cl.setRowData( Integer.parseInt(Cookies.getCookie(nick)), chatList.subList(Integer.parseInt(Cookies.getCookie(nick)), chatList.size())); panel.setVerticalScrollPosition(panel.getMaximumVerticalScrollPosition() - 1); Cookies.setCookie(nick, "" + chatList.size()); } } }; t.scheduleRepeating(1000); }
private static byte bitfieldFromButtons(Button... buttons) { byte bitfield = (byte) 0; for (Button button : buttons) { bitfield |= button.value(); } return bitfield; }
private Component buildFooter() { HorizontalLayout footer = new HorizontalLayout(); footer.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR); footer.setWidth(100.0f, Unit.PERCENTAGE); Button ok = new Button("OK"); ok.addStyleName(ValoTheme.BUTTON_PRIMARY); ok.addClickListener( event -> { try { fieldGroup.commit(); // Updated user should also be persisted to database. But // not in this demo. Notification success = new Notification("Profile updated successfully"); success.setDelayMsec(2000); success.setStyleName("bar success small"); success.setPosition(Position.BOTTOM_CENTER); success.show(Page.getCurrent()); // DashboardEventBus.post(new ProfileUpdatedEvent()); close(); } catch (CommitException e) { Notification.show("Error while updating profile", Type.ERROR_MESSAGE); } }); ok.focus(); footer.addComponent(ok); footer.setComponentAlignment(ok, Alignment.TOP_RIGHT); return footer; }
public void resetAllData() { didPressStart = false; didPressInfo = false; b1.col = c.white; b2.col = c.white; b3.col = c.white; }
public Button addButton(String buttonName) { // buttons.push(); // add pButton to buttons array Button button = new Button(buttonName,width-rightOffset-margin,margin,headerHeight-8); rightOffset += button.width+margin; button.x -= button.width; return button; }
private AbstractComponent createButton(final Animation animation) { PlainContainer container = new PlainContainer(); container.setLayout(new VerticalLayout()); container.setXAlignment(0.5); PlainContainer center = new PlainContainer(); center.setXAlignment(0.5); center.setYAlignment(0.5); center.setMinimumWidth(64); center.setMaximumWidth(64); center.setMinimumHeight(64); center.setMaximumHeight(64); ImagePose icon = Editor.instance.getStylesheet().resources.getPose("animation-" + animation.getTagName()); ImageComponent img = new ImageComponent((icon == null) ? null : icon.getSurface()); center.addChild(img); Button button = new Button(center); container.addChild(button); container.addChild(new Label(animation.getName())); button.addActionListener( new ActionListener() { @Override public void action() { AnimationTypePicker.this.hide(); AnimationTypePicker.this.pick(animation); } }); return container; }
private void butonLinkBccClick(ClickEvent event) { removeAllInputField(); if (!isAddBcc) { btnLinkBcc.setCaption("Remove Bcc"); if (!isAddCc) { inputLayout.addComponent(bccField, 0, 1); inputLayout.addComponent(btnLinkCc, 1, 1); inputLayout.addComponent(btnLinkBcc, 2, 1); inputLayout.addComponent(subjectField, 0, 2); } else { addFullInputFieldByOrder(); } } else { btnLinkBcc.setCaption("Add Bcc"); if (isAddCc) { inputLayout.addComponent(ccField, 0, 1); inputLayout.addComponent(btnLinkCc, 1, 1); inputLayout.addComponent(btnLinkBcc, 2, 1); inputLayout.addComponent(subjectField, 0, 2); } else { inputLayout.addComponent(btnLinkBcc, 1, 0); inputLayout.addComponent(btnLinkCc, 2, 0); inputLayout.addComponent(subjectField, 0, 1); } } inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER); inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER); isAddBcc = !isAddBcc; checkToReInitCcBcc(); }
@Test public void click_ClickkListener_NestedWidget() { // Given clicked = false; FlexTable t = new FlexTable(); Button b = new Button("Wide Button"); b.addClickListener( new ClickListener() { public void onClick(Widget sender) { clicked = !clicked; } }); // add the button t.setWidget(0, 0, b); // Preconditions assertThat(clicked).isEqualTo(false); // When Browser.click(t.getWidget(0, 0)); // Then assertThat(clicked).isEqualTo(true); }
@SuppressWarnings("serial") private void initButtonLinkCcBcc() { btnLinkCc = new Button("Add Cc"); btnLinkCc.setStyleName(UIConstants.BUTTON_LINK); inputLayout.addComponent(btnLinkCc, 1, 0); inputLayout.setComponentAlignment(btnLinkCc, Alignment.MIDDLE_CENTER); btnLinkBcc = new Button("Add Bcc"); btnLinkBcc.setStyleName(UIConstants.BUTTON_LINK); inputLayout.addComponent(btnLinkBcc, 2, 0); inputLayout.setComponentAlignment(btnLinkBcc, Alignment.MIDDLE_CENTER); btnLinkCc.addClickListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { buttonLinkCcClick(event); } }); btnLinkBcc.addClickListener( new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { butonLinkBccClick(event); } }); }
/** The act method is called by the GameScreen to perform the action in the ScreenState. */ public void act() { if (backToMenuButton.wasClicked()) { // go to start state gameScreen.setState(gameScreen.getStartState()); } String key = gameScreen.getKey(); if (arrowLeftButton.wasClicked() || (key != null && key.equals("left"))) { currentHighscoreLevel--; if (currentHighscoreLevel < 1) { currentHighscoreLevel = gameScreen.getNumberOfLevels(); } // reload this state gameScreen.setState(gameScreen.getHighscoreState()); } if (arrowRightButton.wasClicked() || (key != null && key.equals("right"))) { currentHighscoreLevel++; if (currentHighscoreLevel > gameScreen.getNumberOfLevels()) { currentHighscoreLevel = 1; } // reload this state gameScreen.setState(gameScreen.getHighscoreState()); } }
public void mousePressed() { if (game.screen == 1) { // see above velocity = PVector.fromAngle( radians( (float) angledegrees)); // uses PVector to make a vector from the angle of the shooter if (canfire == true) { // checks if user is able to fire (if ball is active) game.shooterlist[0] = game.shooterlist[1]; // sets active ball to the next ball game.shooterlist[0].setVelocity( velocity.x, velocity.y); // adjusts velocity for ball depending on type game.shooterlist[1] = new Ball( game .createNewBall()); // creates new ball with random type as generated by the // createNewBall function canfire = false; // disables firing while ball is active } } if (game.screen == 0) { // see above if (button.pressed()) { // checks if button is pressed game.gotoGame(); // loads game } } if (game.screen == 2) { if (button.pressed()) { game.reset(); // resets game } } }
@bpi public void onEditCaptionEvent(bch parambch) { E.a(8); akr.N(); i.setVisibility(0); p.a(4); F.a(8); SnapCaptionView localSnapCaptionView = b.getCaptionView(); m.setBackgroundResource(2130838147); Button localButton = m; if (k) {} for (int i1 = 8;; i1 = 0) { localButton.setVisibility(i1); s.setBackgroundResource(2130837604); if (!mIsEditing) { break; } if ((localSnapCaptionView instanceof FatCaptionView)) { s.setBackgroundResource(2130837537); g.setDrawingEnabled(false); o.a(4); i.setVisibility(4); q.a(8); C.a(8); p.a(0); m.setBackgroundResource(2130837660); } return; } u(); }
private void showAddNewComment() { newCommentLayout.clear(); final TextArea comment = new TextArea(); comment.setWidth("100%"); newCommentLayout.add(comment); Button ok = new Button(constants.OK()); Button cancel = new Button(constants.Cancel()); ok.addClickHandler( new ClickHandler() { public void onClick(ClickEvent sender) { sendNewComment(comment.getText()); } }); cancel.addClickHandler( new ClickHandler() { public void onClick(ClickEvent sender) { showNewCommentButton(); } }); HorizontalPanel hp = new HorizontalPanel(); hp.add(ok); hp.add(cancel); newCommentLayout.add(hp); comment.setFocus(true); }
private AbstractComponent createNinePatchButton(final NinePatch ninePatch) { PlainContainer container = new PlainContainer(); container.setLayout(new VerticalLayout()); container.setXAlignment(0.5f); ImageComponent img = new ImageComponent(); if (ninePatch != null) { img.setImage(ninePatch.getThumbnail()); } Button button = new Button(img); button.addActionListener( new ActionListener() { @Override public void action() { NinePatchPicker.this.hide(); NinePatchPicker.this.pick(ninePatch); } }); Label label = new Label(ninePatch == null ? "<none>" : ninePatch.getName()); container.addChild(button); container.addChild(label); return container; }
/** * This method creates the Day Button Component for the Month View * * @return a Button that corresponds to the Days Components */ protected Button createDay() { Button day = new Button(); day.setAlignment(CENTER); day.setUIID("CalendarDay"); day.setEndsWith3Points(false); day.setTickerEnabled(false); return day; }