com.vaadin.event.ShortcutAction.KeyCode Java Examples

The following examples show how to use com.vaadin.event.ShortcutAction.KeyCode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubDomainEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param subdomain 
 */
public SubDomainEditorWindow(String subdomain) {
	buildMainLayout();
	setContent(mainLayout);
	//
	// Save
	//
	this.subdomain = subdomain;
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize
	//
	this.initializeTextField();
	this.initializeButtons();
	//
	// Focus
	//
	this.textFieldSubdomain.focus();
}
 
Example #2
Source File: MessageListViewImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected SearchLayout<MessageSearchCriteria> createBasicSearchLayout() {
    return new BasicSearchLayout<MessageSearchCriteria>(MessageSearchPanel.this) {
        @Override
        public ComponentContainer constructBody() {
            nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT))
                    .withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);

            MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction())
                    .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.SEARCH)
                    .withClickShortcut(KeyCode.ENTER);
            return new MHorizontalLayout(nameField, searchBtn).withMargin(true).withAlign(nameField, Alignment.MIDDLE_LEFT);
        }

        @Override
        protected MessageSearchCriteria fillUpSearchCriteria() {
            MessageSearchCriteria criteria = new MessageSearchCriteria();
            criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
            criteria.setMessage(StringSearchField.and(nameField.getValue()));
            return criteria;
        }
    };
}
 
Example #3
Source File: WebFtsField.java    From cuba with Apache License 2.0 6 votes vote down vote up
public WebFtsField() {
    component = new CssLayout();
    component.setPrimaryStyleName(FTS_FIELD_STYLENAME);

    searchField = new CubaTextField();
    searchField.setStyleName("c-ftsfield-text");
    searchField.addShortcutListener(
            new ShortcutListenerDelegate("fts", KeyCode.ENTER, null)
                    .withHandler((sender, target) ->
                            openSearchWindow()
                    ));

    searchBtn = new CubaButton();
    searchBtn.setStyleName("c-ftsfield-button");
    searchBtn.addClickListener(event ->
            openSearchWindow()
    );

    component.addComponent(searchField);
    component.addComponent(searchBtn);

    adjustHeight();
    adjustWidth();
}
 
Example #4
Source File: WebAbstractDataGrid.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected ShortcutListenerDelegate createEnterShortcutListener() {
    return new ShortcutListenerDelegate("dataGridEnter", KeyCode.ENTER, null)
            .withHandler((sender, target) -> {
                if (sender == componentComposition) {
                    if (isEditorEnabled()) {
                        // Prevent custom actions on Enter if DataGrid editor is enabled
                        // since it's the default shortcut to open editor
                        return;
                    }

                    CubaUI ui = (CubaUI) componentComposition.getUI();
                    if (!ui.isAccessibleForUser(componentComposition)) {
                        LoggerFactory.getLogger(WebDataGrid.class)
                                .debug("Ignore click attempt because DataGrid is inaccessible for user");
                        return;
                    }

                    if (enterPressAction != null) {
                        enterPressAction.actionPerform(this);
                    } else {
                        handleDoubleClickAction();
                    }
                }
            });
}
 
Example #5
Source File: GroupPageAddWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public AbstractComponent getLayout() {
    final MVerticalLayout layout = new MVerticalLayout().withMargin(false);
    informationLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    layout.addComponent(informationLayout.getLayout());

    final MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        if (EditForm.this.validateForm()) {
            PageService pageService = AppContextUtil.getSpringBean(PageService.class);
            pageService.createFolder(folder, UserUIContext.getUsername());
            folder.setCreatedTime(new GregorianCalendar());
            folder.setCreatedUser(UserUIContext.getUsername());
            GroupPageAddWindow.this.close();
            EventBusFactory.getInstance().post(new PageEvent.GotoList(GroupPageAddWindow.this, folder.getPath()));
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION)
            .withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout controlsBtn = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(true, false, true, false));
    layout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
    return layout;
}
 
Example #6
Source File: AdvancedInfoChangeWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withMargin(true).withFullWidth();

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);

    passInfo.addComponent(txtWebsite, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0);
    passInfo.addComponent(txtCompany, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1);
    passInfo.addComponent(cboCountry, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2);

    txtWebsite.setValue(MoreObjects.firstNonNull(user.getWebsite(), ""));
    txtCompany.setValue(MoreObjects.firstNonNull(user.getCompany(), ""));
    cboCountry.setValue(MoreObjects.firstNonNull(user.getCountry(), ""));

    mainLayout.with(passInfo.getLayout()).withAlign(passInfo.getLayout(), Alignment.TOP_LEFT);

    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close())
            .withStyleName(WebThemes.BUTTON_OPTION);

    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeInfo())
            .withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.CLIPBOARD).withClickShortcut(KeyCode.ENTER);

    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn);
    mainLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
    this.setModal(true);
    this.setContent(mainLayout);
}
 
Example #7
Source File: GitPushWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param git 
 * @param target 
 * @param status 
 */
public GitPushWindow(Git git, File target, Status status) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save data
	//
	this.git = git;
	this.target = target;
	this.container = new GitStatusContainer(status);
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initializeText();
	this.initializeTable(status);
	this.initializeButtons();
	//
	//  Focus
	//
	this.textAreaComments.focus();
}
 
Example #8
Source File: AttributeAssignmentExpressionEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param assignment 
 */
public AttributeAssignmentExpressionEditorWindow(AttributeAssignmentExpressionType assignment) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.assignment = assignment;
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initializeText();
	this.initializeTable();
	this.initializeButton();
	//
	// Focus
	//
	this.textFieldAttributeID.focus();
}
 
Example #9
Source File: ObligationEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param obligation 
 */
public ObligationEditorWindow(ObligationExpressionType obligation) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.obligation = obligation;
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initialize();
	this.initializeButton();
	//
	// Focus
	//
	this.textFieldObligationID.focus();
}
 
Example #10
Source File: SelectPDPGroupWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param groups 
 * @param caption 
 */
public SelectPDPGroupWindow(Set<PDPGroup> groups, String caption) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Setup the shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	//
	// initialize
	//
	this.initialize(groups);
	//
	// Focus
	//
	this.listSelectPDPGroup.focus();
	//
	// setup the button
	//
	this.setupButtons();
}
 
Example #11
Source File: MatchEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param match 
 * @param datatype 
 */
public MatchEditorWindow(MatchType match, Datatype datatype) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save our data
	//
	this.match = match;
	this.datatype = datatype;
	//
	// Close shortcut
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initializeFunctions();
	this.initializeButtons();
	//
	// Set our focus
	//
	this.tableFunctions.focus();
}
 
Example #12
Source File: PIPParamEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param config 
 */
public PIPParamEditorWindow(Object config) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save parameters
	//
	this.config = config;
	//
	// Initialize
	//
	this.initialize();
	//
	// close shortcut
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// focus
	//
	this.textFieldName.focus();
}
 
Example #13
Source File: AdviceEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param advice 
 */
public AdviceEditorWindow(AdviceExpressionType advice) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.advice = advice;
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initialize();
	this.initializeButton();
	//
	// Focus
	//
	this.textFieldAdviceID.focus();
}
 
Example #14
Source File: VariableDefinitionEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param variable 
 */
public VariableDefinitionEditorWindow(VariableDefinitionType variable) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.variable = variable;
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize
	//
	this.initializeText();
	this.initializeButton();
	//
	// Initial focus
	//
	this.textFieldID.focus();
}
 
Example #15
Source File: VariableDefinitionEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeButton() {
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit it
				//
				self.textFieldID.commit();
				//
				// Save it
				//
				self.variable.setVariableId(self.textFieldID.getValue());
				self.isSaved = true;
				//
				// Close window
				//
				self.close();
			} catch (SourceException | InvalidValueException e) {
			}
		}			
	});
}
 
Example #16
Source File: VariableReferenceEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param variable 
 * @param variables 
 */
public VariableReferenceEditorWindow(VariableReferenceType variable, Map<VariableDefinitionType, PolicyType> variables) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save parameters
	//
	this.variable = variable;
	//
	// Set our shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize
	//
	this.initializeTextField();
	this.initializeSelect(variables);
	this.initializeButtons();
	//
	// Focus
	//
	this.textFieldVariable.focus();
}
 
Example #17
Source File: RuleEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param rule 
 */
public RuleEditorWindow(RuleType rule) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.rule = rule;
	//
	// Close shortcut
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize
	//
	this.initializeLabel();
	this.initializeOption();
	this.initializeText();
	this.initializeButton();
}
 
Example #18
Source File: PolicyEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param policy 
 */
public PolicyEditorWindow(PolicyType policy) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.policy = policy;
	//
	// Close shortcut
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initializeLabel();
	this.initializeText();
	this.initializeSelect();
	this.initializeButton();
	//
	// Focus
	//
	this.textAreaDescription.focus();
}
 
Example #19
Source File: SelectWorkspacePoliciesWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 */
public SelectWorkspacePoliciesWindow() {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	//
	//
	//
	this.initializeTree();
	this.initializeButton();
	//
	//
	//
	this.treeWorkspace.focus();
}
 
Example #20
Source File: EditPDPGroupWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param group 
 * @param list 
 * @param engine 
 */
public EditPDPGroupWindow(StdPDPGroup group, List<PDPGroup> list, PAPEngine engine) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save pointers
	//
	this.group = group;
	this.groups = list;
	this.papEngine = engine;
	//
	// Initialize
	//
	this.initialize();
	//
	// Shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	//
	// Focus
	//
	this.textName.focus();
}
 
Example #21
Source File: FunctionSelectionWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param defaultFunction 
 */
public FunctionSelectionWindow(String defaultFunction) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.defaultFunctionID = defaultFunction;
	//
	// Close shortcut
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initializeTextField();
	this.initializeFunctions();
	this.initializeButtons();
	//
	// Set our focus
	//
	this.tableFunctions.focus();
}
 
Example #22
Source File: PolicySetEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param policySet 
 */
public PolicySetEditorWindow(PolicySetType policySet) {
	buildMainLayout();
	//setCompositionRoot(mainLayout);
	setContent(mainLayout);
	//
	// Save
	//
	this.policySet = policySet;
	//
	// Close shortcut
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	//
	// Initialize GUI
	//
	this.initializeLabel();
	this.initializeText();
	this.initializeSelect();
	this.initializeButton();
	//
	// Focus
	//
	this.textAreaDescription.focus();
}
 
Example #23
Source File: WebTree.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected ShortcutListenerDelegate createEnterShortcutListener() {
    return new ShortcutListenerDelegate("treeEnter", KeyCode.ENTER, null)
            .withHandler((sender, target) -> {
                if (sender == componentComposition) {
                    CubaUI ui = (CubaUI) componentComposition.getUI();
                    if (!ui.isAccessibleForUser(componentComposition)) {
                        LoggerFactory.getLogger(WebTree.class)
                                .debug("Ignore click attempt because Tree is inaccessible for user");
                        return;
                    }

                    if (enterPressAction != null) {
                        enterPressAction.actionPerform(this);
                    } else {
                        handleClickAction();
                    }
                }
            });
}
 
Example #24
Source File: ConfirmationDialog.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private Button createOkButton(final String okLabel) {
    final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.OK_BUTTON, okLabel, "",
            ValoTheme.BUTTON_PRIMARY, false, null, SPUIButtonStyleTiny.class);
    button.addClickListener(this);
    button.setClickShortcut(KeyCode.ENTER);
    return button;
}
 
Example #25
Source File: PDPStatusWindow.java    From XACML with MIT License 5 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param status 
 */
public PDPStatusWindow(PDPStatus status) {
	buildMainLayout();
	setContent(mainLayout);
	//setCompositionRoot(mainLayout);
	//
	// Save
	//
	this.status = status;
	//
	// Setup shortcuts
	//
	this.setCloseShortcut(KeyCode.ESCAPE);
	this.buttonOK.setClickShortcut(KeyCode.ENTER);
	//
	// Initialize
	//
	try {
		this.initialize();
		this.initializeButton();
	} catch (Exception e) {
		logger.error("Initialize exception: " + e);
	}
	//
	//  Focus
	//
	this.buttonOK.focus();
}
 
Example #26
Source File: AdviceEditorWindow.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeButton() {
	this.buttonSave.setImmediate(true);
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit
				//
				self.textFieldAdviceID.commit();
				self.optionGroupEffect.commit();
				//
				// all good, save everything
				//
				self.advice.setAdviceId(self.textFieldAdviceID.getValue());
				self.advice.setAppliesTo((EffectType) self.optionGroupEffect.getValue());
				//
				// Set ourselves as saved
				//
				self.isSaved = true;
				//
				// Close the window
				//
				self.close();
			} catch (SourceException | InvalidValueException e) {
				//
				// Vaadin displays the error
				//
			}
		}			
	});
}
 
Example #27
Source File: CommonDialogWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void createSaveButton() {
    saveButton = SPUIComponentProvider.getButton(UIComponentIdProvider.SAVE_BUTTON,
            i18n.getMessage(UIMessageIdProvider.BUTTON_SAVE), "", "", true, FontAwesome.SAVE,
            SPUIButtonStyleNoBorderWithIcon.class);
    saveButton.setSizeUndefined();
    saveButton.addStyleName("default-color");
    addCloseListenerForSaveButton();
    saveButton.setEnabled(false);
    saveButton.setClickShortcut(KeyCode.ENTER);
    buttonsLayout.addComponent(saveButton);
    buttonsLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
    buttonsLayout.setExpandRatio(saveButton, 1.0F);
}
 
Example #28
Source File: AbstractHawkbitLoginUI.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void buildSignInButton() {
    final String caption = isDemo ? i18n.getMessage("button.login.agreeandsignin")
            : i18n.getMessage("button.login.signin");

    signIn = new Button(caption);
    signIn.addStyleName(ValoTheme.BUTTON_PRIMARY + " " + ValoTheme.BUTTON_SMALL + " " + "login-button");
    signIn.setClickShortcut(KeyCode.ENTER);
    signIn.focus();
    signIn.setId("login-signin");
}
 
Example #29
Source File: AttributeValueEditorWindow.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeButtons() {
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Make sure it validates (i.e. call the Validators)
				//
				self.comboBoxDatatype.validate();
				self.textFieldValue.validate();
				//
				// Yes
				//
				self.isSaved = true;
				//
				// Close
				//
				self.close();
			} catch (InvalidValueException e) {
				//
				// Vaadin with update GUI displaying the error
				//
			}
		}
	});
}
 
Example #30
Source File: VariableReferenceEditorWindow.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeButtons() {
	this.buttonSave.setClickShortcut(KeyCode.ENTER);
	this.buttonSave.addClickListener(new ClickListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void buttonClick(ClickEvent event) {
			try {
				//
				// Commit
				//
				self.textFieldVariable.commit();
				//
				// Now we can save
				//
				self.isSaved = true;
				self.variable.setVariableId(self.textFieldVariable.getValue());
				//
				// And close the window
				//
				self.close();
			} catch (SourceException | InvalidValueException e) {
				logger.error("Commit variable id: " + e);
			}
		}			
	});
}