List of usage examples for com.vaadin.ui Panel addActionHandler
@Override public void addActionHandler(Handler actionHandler)
From source file:com.klwork.explorer.ui.task.ProcessInstanceEventsPanel.java
License:Apache License
public void initAddEventInput(HorizontalLayout hLayout) { Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be // attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout textFieldPanelLayout = new VerticalLayout(); textFieldPanel.setContent(textFieldPanelLayout); textFieldPanel.setWidth(100, Unit.PERCENTAGE); hLayout.addComponent(textFieldPanel); hLayout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, Unit.PERCENTAGE); textFieldPanelLayout.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); }// w w w. j a v a 2s .c o m public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); }
From source file:com.klwork.explorer.ui.task.TaskEventsPanel.java
License:Apache License
public void initAddEventInput(HorizontalLayout hLayout) { Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); VerticalLayout textFieldPanelLayout = new VerticalLayout(); textFieldPanel.setContent(textFieldPanelLayout); textFieldPanel.setWidth(100, Unit.PERCENTAGE); hLayout.addComponent(textFieldPanel); hLayout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, Unit.PERCENTAGE); textFieldPanelLayout.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); }//from w w w .ja va 2s.c o m public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); }
From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java
License:Apache License
private void addInputField() { VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/*from ww w. j a va2 s .c om*/ layout.setWidth(100, UNITS_PERCENTAGE); loginPanel.addComponent(layout); Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be // attached to panels or windows textFieldPanel.addStyleName(PANEL_LIGHT); textFieldPanel.setContent(new VerticalLayout()); textFieldPanel.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(textFieldPanel); layout.setExpandRatio(textFieldPanel, 1.0f); Label labelUserName = new Label(i18nManager.getMessage(USER_NAME_TITLE)); labelUserName.addStyleName(LABEL_SMALL); userNameInputField = new TextField(); userNameInputField.setWidth(100, UNITS_PERCENTAGE); Label labelPassword = new Label(i18nManager.getMessage(PASSWORD_TITLE)); labelPassword.addStyleName(LABEL_SMALL); passwordInputField = new PasswordField(); passwordInputField.setWidth(100, UNITS_PERCENTAGE); textFieldPanel.addComponent(labelUserName); textFieldPanel.addComponent(userNameInputField); textFieldPanel.addComponent(labelPassword); textFieldPanel.addComponent(passwordInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { private static final long serialVersionUID = 6928598745792215505L; public void handleAction(Action action, Object sender, Object target) { login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString()); } public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ENTER, null) }; } }); Button loginButton = new Button(i18nManager.getMessage(LOGIN)); layout.addComponent(loginButton); layout.setComponentAlignment(loginButton, MIDDLE_LEFT); loginButton.addListener(new ClickListener() { private static final long serialVersionUID = 7781253151592188006L; public void buttonClick(ClickEvent event) { login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString()); } }); }
From source file:org.activiti.explorer.ui.task.TaskEventsPanel.java
License:Apache License
protected void addInputField() { HorizontalLayout layout = new HorizontalLayout(); layout.setSpacing(true);/*from w w w.jav a2 s . c om*/ layout.setWidth(100, UNITS_PERCENTAGE); addComponent(layout); Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be attached to panels or windows textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT); textFieldPanel.setContent(new VerticalLayout()); textFieldPanel.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(textFieldPanel); layout.setExpandRatio(textFieldPanel, 1.0f); commentInputField = new TextField(); commentInputField.setWidth(100, UNITS_PERCENTAGE); textFieldPanel.addComponent(commentInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { public void handleAction(Action action, Object sender, Object target) { addNewComment(commentInputField.getValue().toString()); } public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) }; } }); Button addCommentButton = new Button(i18nManager.getMessage(Messages.TASK_ADD_COMMENT)); layout.addComponent(addCommentButton); layout.setComponentAlignment(addCommentButton, Alignment.MIDDLE_LEFT); addCommentButton.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { addNewComment(commentInputField.getValue().toString()); } }); }
From source file:org.eclipse.hawkbit.ui.common.table.AbstractTableLayout.java
License:Open Source License
private void buildLayout() { setSizeFull();// w ww. j a v a2 s.co m setSpacing(true); setMargin(false); setStyleName("group"); final VerticalLayout tableHeaderLayout = new VerticalLayout(); tableHeaderLayout.setSizeFull(); tableHeaderLayout.setSpacing(false); tableHeaderLayout.setMargin(false); tableHeaderLayout.setStyleName("table-layout"); tableHeaderLayout.addComponent(tableHeader); tableHeaderLayout.setComponentAlignment(tableHeader, Alignment.TOP_CENTER); if (isShortCutKeysRequired()) { final Panel tablePanel = new Panel(); tablePanel.setStyleName("table-panel"); tablePanel.setHeight(100.0F, Unit.PERCENTAGE); tablePanel.setContent(table); tablePanel.addActionHandler(getShortCutKeysHandler(i18n)); tablePanel.addStyleName(ValoTheme.PANEL_BORDERLESS); tableHeaderLayout.addComponent(tablePanel); tableHeaderLayout.setComponentAlignment(tablePanel, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(tablePanel, 1.0F); } else { tableHeaderLayout.addComponent(table); tableHeaderLayout.setComponentAlignment(table, Alignment.TOP_CENTER); tableHeaderLayout.setExpandRatio(table, 1.0F); } addComponent(tableHeaderLayout); addComponent(detailsLayout); setComponentAlignment(tableHeaderLayout, Alignment.TOP_CENTER); setComponentAlignment(detailsLayout, Alignment.TOP_CENTER); setExpandRatio(tableHeaderLayout, 1.0F); }
From source file:org.escidoc.browser.elabsmodul.views.AddNewEndpointURIWindow.java
License:Open Source License
@SuppressWarnings("serial") private Component buildGUI() { final VerticalLayout rootLayout = new VerticalLayout(); final HorizontalLayout inputLayout = new HorizontalLayout(); inputLayout.setSpacing(true);//ww w . j av a2s . co m endpointURITextField = new TextField(); endpointURITextField.setEnabled(true); endpointURITextField.setVisible(true); endpointURITextField.setNullRepresentation(""); endpointURITextField.setValue("http://"); endpointURITextField.setImmediate(true); endpointURITextField.setRequired(true); endpointURITextField.setRequiredError("URI cannot be empty!"); endpointURITextField.setWidth("350px"); endpointURITextField.focus(); if (isEsyncURI) { inputLayout.addComponent(new Label("New eSync-endpoint URI:"), 0); } else { inputLayout.addComponent(new Label("New deposit-endpoint URI:"), 0); } inputLayout.addComponent(endpointURITextField, 1); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); okButton = new Button(OK_BUTTON_TEXT, this); okButton.setIcon(ELabsViewContants.ICON_16_OK); okButton.setEnabled(true); cancelButton = new Button(CANCEL_BUTTON_TEXT, this); cancelButton.setIcon(ELabsViewContants.ICON_16_CANCEL); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(okButton); rootLayout.addComponent(inputLayout); rootLayout.addComponent(buttonLayout); Panel panel = new Panel(); panel.setContent(rootLayout); panel.addActionHandler(new Action.Handler() { private final Action action_ok = new ShortcutAction("Enter key", ShortcutAction.KeyCode.ENTER, null); private final Action action_esc = new ShortcutAction("Escape key", ShortcutAction.KeyCode.ESCAPE, null); @Override public void handleAction(Action action, Object sender, Object target) { if (action.equals(action_ok)) { AddNewEndpointURIWindow.this.closeMe(true); } else if (action.equals(action_esc)) { AddNewEndpointURIWindow.this.closeMe(false); } } @Override public Action[] getActions(Object target, Object sender) { return new Action[] { action_ok, action_esc }; } }); return panel; }
From source file:org.escidoc.browser.elabsmodul.views.AddNewStudyPublicationWindow.java
License:Open Source License
@SuppressWarnings("serial") private Component buildGUI() { final VerticalLayout rootLayout = new VerticalLayout(); final HorizontalLayout inputLayout = new HorizontalLayout(); inputLayout.setSpacing(true);//from w w w .j a va 2 s . c o m publicationTextField = new TextField(); publicationTextField.setEnabled(true); publicationTextField.setVisible(true); publicationTextField.setNullRepresentation(""); publicationTextField.setValue("http://"); publicationTextField.setImmediate(true); publicationTextField.setRequired(true); publicationTextField.setRequiredError("Document URL cannot be empty!"); publicationTextField.setWidth("350px"); publicationTextField.focus(); if (isMotPub) { inputLayout.addComponent(new Label("New motivating publication's URL:"), 0); } else { inputLayout.addComponent(new Label("New resulting publication's URL:"), 0); } inputLayout.addComponent(publicationTextField, 1); final HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true); okButton = new Button(OK_BUTTON_TEXT, this); okButton.setIcon(ELabsViewContants.ICON_16_OK); okButton.setEnabled(true); cancelButton = new Button(CANCEL_BUTTON_TEXT, this); cancelButton.setIcon(ELabsViewContants.ICON_16_CANCEL); buttonLayout.addComponent(cancelButton); buttonLayout.addComponent(okButton); rootLayout.addComponent(inputLayout); rootLayout.addComponent(buttonLayout); Panel panel = new Panel(); panel.setContent(rootLayout); panel.addActionHandler(new Action.Handler() { private final Action action_ok = new ShortcutAction("Enter key", ShortcutAction.KeyCode.ENTER, null); private final Action action_esc = new ShortcutAction("Escape key", ShortcutAction.KeyCode.ESCAPE, null); @Override public void handleAction(Action action, Object sender, Object target) { if (action.equals(action_ok)) { AddNewStudyPublicationWindow.this.closeMe(true); } else if (action.equals(action_esc)) { AddNewStudyPublicationWindow.this.closeMe(false); } } @Override public Action[] getActions(Object target, Object sender) { return new Action[] { action_ok, action_esc }; } }); return panel; }
From source file:org.opencms.ui.editors.messagebundle.CmsMessageBundleEditor.java
License:Open Source License
/** * Creates the main component of the editor with all sub-components. * @return the completely filled main component of the editor. * @throws IOException thrown if setting the table's content data source fails. * @throws CmsException thrown if setting the table's content data source fails. *///from ww w . j a va2 s . c o m private Component createMainComponent() throws IOException, CmsException { VerticalLayout mainComponent = new VerticalLayout(); mainComponent.setSizeFull(); mainComponent.addStyleName("o-message-bundle-editor"); m_table = createTable(); Panel navigator = new Panel(); navigator.setSizeFull(); navigator.setContent(m_table); navigator.addActionHandler(new CmsMessageBundleEditorTypes.TableKeyboardHandler(m_table)); navigator.addStyleName("v-panel-borderless"); mainComponent.addComponent(m_options.getOptionsComponent()); mainComponent.addComponent(navigator); mainComponent.setExpandRatio(navigator, 1f); m_options.updateShownOptions(m_model.hasMasterMode(), m_model.canAddKeys()); return mainComponent; }