Example usage for com.vaadin.ui Button setEnabled

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

Introduction

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

Prototype

@Override
    public void setEnabled(boolean enabled) 

Source Link

Usage

From source file:org.eclipse.emf.ecp.controls.vaadin.AbstractVaadinSimpleControlRenderer.java

License:Open Source License

protected void createSetOrUnsetComponent(final Component component, final HorizontalLayout horizontalLayout,
        final Setting setting) {
    final Label unsetLabel = getUnsetComponent();
    final Button setButton = getUnsetButton(component, horizontalLayout, setting);
    setButton.setEnabled(getVElement().isEnabled());
    setButton.setVisible(getVElement().isVisible());
    setButton.setReadOnly(getVElement().isReadonly());
    horizontalLayout.addStyleName("textheight");
    horizontalLayout.removeAllComponents();
    Component addComponent = component;
    if (setting.isSet()) {
        setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Set);
        unsetLabel.setCaption(getUnsetLabel());
        addComponent = unsetLabel;/*from   w  ww .ja va  2  s.  com*/

    } else {
        setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Unset);

    }
    horizontalLayout.setData(addComponent);
    horizontalLayout.addComponent(addComponent);
    horizontalLayout.setExpandRatio(addComponent, 1f);
    horizontalLayout.addComponent(setButton);
    horizontalLayout.setComponentAlignment(setButton, Alignment.BOTTOM_RIGHT);

}

From source file:org.eclipse.emf.ecp.view.table.vaadin.TableDetailDialogVaadinRenderer.java

License:Open Source License

private void createEditButton(HorizontalLayout horizontalLayout) {
    final EMFUpdateValueStrategy emfUpdateValueStrategy = new EMFUpdateValueStrategy();
    emfUpdateValueStrategy.setConverter(new SelectionConverter());
    final VView detailView = getVElement().getDetailView();
    final Button edit = new Button();
    edit.addStyleName("table-edit"); //$NON-NLS-1$
    edit.addClickListener(new ClickListener() {

        @Override/*w w w .ja  va 2s  . c o m*/
        public void buttonClick(ClickEvent event) {
            final EditDialog editDialog = new EditDialog((EObject) table.getValue(), getView());
            UI.getCurrent().addWindow(editDialog);
        }
    });
    edit.setEnabled(detailView != null);
    horizontalLayout.addComponent(edit);
    bindButtonEnable(edit);
}

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusInfoWindow.java

License:Open Source License

private Button getMinimizeButton() {
    final Button minimizeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.UPLOAD_STATUS_POPUP_MINIMIZE_BUTTON_ID, "", "", "", true, FontAwesome.MINUS,
            SPUIButtonStyleSmallNoBorder.class);
    minimizeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    minimizeBtn.addClickListener(event -> minimizeWindow());
    minimizeBtn.setEnabled(true);
    return minimizeBtn;
}

From source file:org.eclipse.hawkbit.ui.management.actionhistory.ActionHistoryTable.java

License:Open Source License

private HorizontalLayout createActionBarColumn(final Object itemId) {
    final HorizontalLayout actionBar = new HorizontalLayout();
    final Item item = hierarchicalContainer.getItem(itemId);
    final Long actionId = (Long) item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
            .getValue();//from ww w  .  j av a2 s  .c o  m
    final String activeValue = (String) item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN)
            .getValue();
    final Action actionWithActiveStatus = (Action) item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED)
            .getValue();

    if (actionWithActiveStatus == null) {
        return null;
    }
    final boolean isActionActive = target != null && SPUIDefinitions.ACTIVE.equals(activeValue);

    final Button actionCancel = SPUIComponentProvider.getButton(
            UIComponentIdProvider.ACTION_HISTORY_TABLE_CANCEL_ID, "", i18n.get("message.cancel.action"),
            ValoTheme.BUTTON_TINY, true, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
    actionCancel.setEnabled(isActionActive && !actionWithActiveStatus.isCancelingOrCanceled());
    actionCancel.addClickListener(event -> confirmAndCancelAction(actionId));

    final Button actionForce = SPUIComponentProvider.getButton(
            UIComponentIdProvider.ACTION_HISTORY_TABLE_FORCE_ID, "", i18n.get("message.force.action"),
            ValoTheme.BUTTON_TINY, true, FontAwesome.BOLT, SPUIButtonStyleSmallNoBorder.class);
    actionForce.setEnabled(isActionActive && !actionWithActiveStatus.isForce()
            && !actionWithActiveStatus.isCancelingOrCanceled());
    actionForce.addClickListener(event -> confirmAndForceAction(actionId));

    final Button actionForceQuit = SPUIComponentProvider.getButton(
            UIComponentIdProvider.ACTION_HISTORY_TABLE_FORCE_QUIT_ID, "", i18n.get("message.forcequit.action"),
            ValoTheme.BUTTON_TINY + " redicon", true, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
    actionForceQuit.setEnabled(isActionActive && actionWithActiveStatus.isCancelingOrCanceled());
    actionForceQuit.addClickListener(event -> confirmAndForceQuitAction(actionId));

    actionBar.addComponents(actionCancel, actionForce, actionForceQuit);

    return actionBar;
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetBulkUpdateWindowLayout.java

License:Open Source License

private Button getMinimizeButton() {
    final Button minimizeBtn = SPUIComponentProvider.getButton(
            UIComponentIdProvider.BULK_UPLOAD_MINIMIZE_BUTTON_ID, "", "", "", true, FontAwesome.MINUS,
            SPUIButtonStyleNoBorder.class);
    minimizeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    minimizeBtn.addClickListener(event -> minimizeWindow());
    minimizeBtn.setEnabled(false);
    return minimizeBtn;
}

From source file:org.eclipse.hawkbit.ui.management.targettable.TargetDetails.java

License:Open Source License

private Button buildRequestAttributesUpdateButton(final String controllerId,
        final boolean isRequestAttributes) {
    final Button requestAttributesUpdateButton = SPUIComponentProvider.getButton(
            UIComponentIdProvider.TARGET_ATTRIBUTES_UPDATE, "", "", "", false, FontAwesome.REFRESH,
            SPUIButtonStyleNoBorder.class);

    requestAttributesUpdateButton/*  w w w . j a  va  2 s. co  m*/
            .addClickListener(e -> targetManagement.requestControllerAttributes(controllerId));

    if (isRequestAttributes) {
        requestAttributesUpdateButton
                .setDescription(getI18n().getMessage("tooltip.target.attributes.update.requested"));
        requestAttributesUpdateButton.setEnabled(false);
    } else {
        requestAttributesUpdateButton
                .setDescription(getI18n().getMessage("tooltip.target.attributes.update.request"));
        requestAttributesUpdateButton.setEnabled(true);
    }

    return requestAttributesUpdateButton;
}

From source file:org.eclipse.hawkbit.ui.rollout.rollout.DefineGroupsLayout.java

License:Open Source License

private Button createAddButton() {
    final Button button = SPUIComponentProvider.getButton(UIComponentIdProvider.ROLLOUT_GROUP_ADD_ID,
            i18n.getMessage("button.rollout.add.group"), "", "", true, FontAwesome.PLUS,
            SPUIButtonStyleNoBorderWithIcon.class);
    button.setSizeUndefined();/*from  w  w  w  .ja v  a2s  . c o m*/
    button.addStyleName("default-color");
    button.setEnabled(true);
    button.setVisible(true);
    button.addClickListener(event -> addGroupRowAndValidate());
    return button;

}

From source file:org.eclipse.skalli.view.component.MultiComboBox.java

License:Open Source License

private Button createAddButton() {
    Button b = new Button("Add");
    b.setStyleName(Button.STYLE_LINK);
    b.addStyleName(STYLE_BUTTON);//from ww w  .ja  v a 2s .  c om
    b.setDescription("Add another entry");
    b.setEnabled(!readOnly);
    b.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            ComboBox cb = createComboBox(null);
            cb.setWidth(columns, Select.UNITS_EM);
            comboBoxEntries.add(new ComboBoxElement(cb));
            layout.removeAllComponents();
            renderComboBoxes();
        }
    });
    return b;
}

From source file:org.eclipse.skalli.view.component.MultiComboBox.java

License:Open Source License

private Button createRemoveButton() {
    Button b = new Button("Remove");
    b.setStyleName(Button.STYLE_LINK);
    b.addStyleName(STYLE_BUTTON);/*from w w  w .  ja  v  a 2  s . c om*/
    b.setDescription("Remove this entry");
    b.setEnabled(!readOnly);
    b.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            Button b = event.getButton();
            Iterator<ComboBoxElement> it = comboBoxEntries.iterator();
            while (it.hasNext()) {
                ComboBoxElement element = it.next();
                if (element.removeButton == b) {
                    it.remove();
                    break;
                }
            }
            layout.removeAllComponents();
            renderComboBoxes();
        }
    });
    return b;
}

From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.ReviewComponent.java

License:Open Source License

@SuppressWarnings({ "serial", "deprecation" })
private void paintReviewButton(HorizontalLayout hl, final ProjectRating rating) {
    Button btn = new Button();
    if (util.getLoggedInUser() != null) {
        btn.addListener(new Button.ClickListener() {
            @Override/*  ww  w .  ja v  a  2 s.  c  om*/
            public void buttonClick(ClickEvent event) {
                reviewPopup = createReviewWindow(rating);
                getWindow().addWindow(reviewPopup);
            }
        });
        btn.setDescription(getDescription(rating));
    } else {
        btn.setEnabled(false);
        btn.setDescription("Login to rate this project.");
    }
    btn.setStyleName(Button.STYLE_LINK);
    btn.setIcon(getIcon(rating));
    hl.addComponent(btn);
}