Example usage for com.vaadin.ui Button equals

List of usage examples for com.vaadin.ui Button equals

Introduction

In this page you can find the example usage for com.vaadin.ui Button equals.

Prototype

@Override
    public boolean equals(Object obj) 

Source Link

Usage

From source file:com.cms.utils.ShortcutUtils.java

public static ShortcutAction setQuit(final Button btnClose) {
    new Button.ClickListener() {

        @Override//from  w w w  .  j  a  v  a 2 s .c  om
        public void buttonClick(Button.ClickEvent event) {
            Button button = (Button) event.getSource();
            if (button.equals(btnClose)) {
                button.setClickShortcut(KeyCode.ESCAPE);
            }
        }
    };
    return null;
}

From source file:com.esofthead.mycollab.vaadin.ui.ToggleButtonGroup.java

License:Open Source License

public void setDefaultButton(Button button) {
    Iterator<Component> iterator = ToggleButtonGroup.this.iterator();
    while (iterator.hasNext()) {
        Button currentBtn = (Button) iterator.next();
        if (currentBtn.equals(button)) {
            selectedBtn = button;//  w w w .  j  a v a 2 s .  c o m
            selectedBtn.addStyleName(UIConstants.BTN_ACTIVE);
        } else {
            currentBtn.removeStyleName(UIConstants.BTN_ACTIVE);
        }
    }
}

From source file:com.esofthead.mycollab.vaadin.web.ui.ToggleButtonGroup.java

License:Open Source License

public ButtonGroup withDefaultButton(Button button) {
    Iterator<Component> iterator = ToggleButtonGroup.this.iterator();
    while (iterator.hasNext()) {
        Button currentBtn = (Button) iterator.next();
        if (currentBtn.equals(button)) {
            selectedBtn = button;//from   w w w .jav  a2s.c  o  m
            selectedBtn.addStyleName(UIConstants.BTN_ACTIVE);
        } else {
            currentBtn.removeStyleName(UIConstants.BTN_ACTIVE);
        }
    }
    return this;
}

From source file:com.mycollab.vaadin.web.ui.ToggleButtonGroup.java

License:Open Source License

public ButtonGroup withDefaultButton(Button button) {
    Iterator<Component> iterator = ToggleButtonGroup.this.iterator();
    while (iterator.hasNext()) {
        Button currentBtn = (Button) iterator.next();
        if (currentBtn.equals(button)) {
            selectedBtn = button;/*from w ww. jav a2s . c om*/
            selectedBtn.addStyleName(WebThemes.BTN_ACTIVE);
        } else {
            currentBtn.removeStyleName(WebThemes.BTN_ACTIVE);
        }
    }
    return this;
}

From source file:de.escidoc.admintool.view.context.ContextAddView.java

License:Open Source License

private void onButtonClick(final ClickEvent event) {
    final Button source = event.getButton();
    if (source.equals(cancel)) {
        onCancelButtonClick();//ww  w.jav a2  s.  c o  m
    } else if (source.equals(save)) {
        onSaveButtonClick();
    }
}

From source file:de.escidoc.admintool.view.context.ContextEditForm.java

License:Open Source License

@Override
public void buttonClick(final ClickEvent event) {
    final Button clickedButton = event.getButton();
    if (clickedButton.equals(saveButton)) {
        save();//from  w w w .j av  a2  s.  com
    } else if (clickedButton.equals(cancelButton)) {
        discard();
    } else {
        throw new IllegalArgumentException("Unknown Button " + clickedButton);
    }
}

From source file:de.escidoc.admintool.view.user.UserAddView.java

License:Open Source License

@Override
public void buttonClick(final ClickEvent event) {
    final Button source = event.getButton();
    if (source.equals(cancelButton)) {
        resetFields();//from  w w w  . ja va2s .  com
    } else if (source.equals(saveButton)) {
        validateAndSave();
    }
}

From source file:de.escidoc.admintool.view.user.UserEditForm.java

License:Open Source License

@Override
public void buttonClick(final ClickEvent event) {
    final Button source = event.getButton();
    if (source.equals(cancelButton)) {
        discardFields();/*from  w ww. j  a v a2 s .  co  m*/
        removeAllError();
    } else if (source.equals(saveButton) && isValid()) {
        updateUserAccount();
        commitFields();
        removeAllError();
        showMessage();
    }
}

From source file:edu.kit.dama.ui.admin.schedule.trigger.AddTriggerComponent.java

License:Apache License

/**
 * Build the main layout including the type selection combobox, the buttons
 * and the placeholder for the property configuration component.
 *//*from   ww  w  .j  a v  a  2  s . c o m*/
private void buildMainLayout() {
    triggerEditorLayout = new VerticalLayout();
    triggerEditorLayout.setSizeFull();
    triggerEditorLayout.setMargin(false);
    triggerEditorLayout.setSpacing(true);
    triggerEditorLayout.setWidth("400px");

    triggerTypeSelectionBox = new ComboBox("TRIGGER TYPE");
    triggerTypeSelectionBox.setWidth("100%");
    triggerTypeSelectionBox.setNullSelectionAllowed(false);
    triggerTypeSelectionBox.addStyleName(CSSTokenContainer.BOLD_CAPTION);

    for (TRIGGER_TYPE type : TRIGGER_TYPE.values()) {
        triggerTypeSelectionBox.addItem(type.toString());
        triggerTypeSelectionBox.setItemCaption(type.toString(), type.getName());
    }

    triggerTypeSelectionBox.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            updateTriggerSelection(TRIGGER_TYPE.valueOf((String) triggerTypeSelectionBox.getValue()));
        }
    });
    final Button createButton = new Button("Create");
    final Button cancelButton = new Button("Cancel");

    Button.ClickListener listener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (cancelButton.equals(event.getButton())
                    || (createButton.equals(event.getButton()) && createTrigger())) {
                //hide window if cration was canceled or if createTrigger succeeded (and 'create' was pressed) 
                parent.hideAddTriggerWindow();
            } //otherwise, createTrigger failed 
        }
    };

    createButton.addClickListener(listener);
    cancelButton.addClickListener(listener);

    HorizontalLayout buttonLayout = new HorizontalLayout(cancelButton, createButton);
    buttonLayout.setSpacing(true);
    mainLayout = new VerticalLayout(triggerTypeSelectionBox, triggerEditorLayout, buttonLayout);
    mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);
    mainLayout.setExpandRatio(triggerTypeSelectionBox, .1f);
    mainLayout.setExpandRatio(triggerEditorLayout, .9f);
    mainLayout.setExpandRatio(buttonLayout, .1f);
    mainLayout.setSpacing(true);
    triggerTypeSelectionBox.setValue(TRIGGER_TYPE.NOW_TRIGGER.toString());
}

From source file:edu.kit.dama.ui.admin.workflow.property.AddEnvironmentPropertyComponent.java

License:Apache License

/**
 * Build the main layout including the type selection combobox, the buttons
 * and the placeholder for the property configuration component.
 *///from  w  w w  .ja  v a2  s .c  o m
private void buildMainLayout() {
    propertyEditorLayout = new VerticalLayout();
    propertyEditorLayout.setSizeFull();
    propertyEditorLayout.setMargin(false);
    propertyEditorLayout.setSpacing(true);
    propertyEditorLayout.setWidth("400px");

    propertyTypeSelectionBox = new ComboBox("PROPERTY TYPE");
    propertyTypeSelectionBox.setWidth("100%");
    propertyTypeSelectionBox.setImmediate(true);
    propertyTypeSelectionBox.setNullSelectionAllowed(false);
    propertyTypeSelectionBox.addStyleName(CSSTokenContainer.BOLD_CAPTION);

    for (ENVIRONMENT_PROPERTY_TYPE type : ENVIRONMENT_PROPERTY_TYPE.values()) {
        propertyTypeSelectionBox.addItem(type.toString());
        propertyTypeSelectionBox.setItemCaption(type, type.getName());
    }

    propertyTypeSelectionBox.addValueChangeListener(new Property.ValueChangeListener() {

        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            updatePropertySelection(
                    ENVIRONMENT_PROPERTY_TYPE.valueOf((String) propertyTypeSelectionBox.getValue()));
        }
    });

    final Button createButton = new Button("Create");
    final Button cancelButton = new Button("Cancel");

    Button.ClickListener listener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (createButton.equals(event.getButton())) {
                createProperty();
            }
            UI.getCurrent().removeWindow(propertyWindow);
            propertyWindow = null;
        }
    };

    createButton.addClickListener(listener);
    cancelButton.addClickListener(listener);

    HorizontalLayout buttonLayout = new HorizontalLayout(cancelButton, createButton);
    mainLayout = new VerticalLayout(propertyTypeSelectionBox, propertyEditorLayout, buttonLayout);
    mainLayout.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);
    mainLayout.setExpandRatio(propertyTypeSelectionBox, .1f);
    mainLayout.setExpandRatio(propertyEditorLayout, .9f);
    mainLayout.setExpandRatio(buttonLayout, .1f);

    propertyTypeSelectionBox.setValue(ENVIRONMENT_PROPERTY_TYPE.STRING_VALUE_PROPERTY.toString());
}