Example usage for com.vaadin.ui Component setEnabled

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

Introduction

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

Prototype

public void setEnabled(boolean enabled);

Source Link

Document

Enables or disables the component.

Usage

From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java

License:Open Source License

public void updateActions() {
    if (theCanvas.hasSelectedResidues()) {
        for (Component component : componentsWithResidueSelectionDependency) {
            component.setEnabled(true);
        }/* w  w w.j  av  a  2s .  c om*/

        for (CustomMenuBar.MenuItem menuItem : menuItemsWithResidueSelectionDependency) {
            menuItem.setEnabled(true);
        }

    } else {
        for (CustomMenuBar.MenuItem menuItem : menuItemsWithResidueSelectionDependency) {
            menuItem.setEnabled(false);
        }

        for (Component component : componentsWithResidueSelectionDependency) {
            component.setEnabled(false);
        }
    }
}

From source file:com.google.code.vaadin.internal.preconfigured.VaadinComponentsInjector.java

License:Apache License

private void configureComponentApi(Component component, Preconfigured preconfigured) {
    component.setEnabled(preconfigured.enabled());
    component.setVisible(preconfigured.visible());
    component.setReadOnly(preconfigured.readOnly());

    String[] styleName = preconfigured.styleName();
    if (styleName.length > 0) {
        for (String style : styleName) {
            component.addStyleName(style);
        }/*from w  w w.j  a  va  2s  . co  m*/
    }

    configureLocalization(component, preconfigured);

    String id = preconfigured.id();
    if (!id.isEmpty()) {
        component.setId(id);
    }

    if (preconfigured.sizeFull()) {
        component.setSizeFull();
    } else if (preconfigured.sizeUndefined()) {
        component.setSizeUndefined();
    } else {
        float width = preconfigured.width();
        if (width > -1.0f) {
            Sizeable.Unit widthUnits = preconfigured.widthUnits();
            component.setWidth(width, widthUnits);
        }
        float height = preconfigured.height();
        if (height > -1.0f) {
            Sizeable.Unit heightUnits = preconfigured.heightUnits();
            component.setHeight(height, heightUnits);
        }
    }
}

From source file:com.hybridbpm.ui.component.bpm.TaskLayout.java

License:Apache License

private void configureVisibilityAndAccess() {
    if (hCase == null) {
        btnAccept.setVisible(false);/*from w  w  w. j av a2 s  . c om*/
        btnSave.setVisible(false);
        btnEscalate.setVisible(false);
        btnSchedule.setVisible(false);
        btnDelegate.setVisible(false);
        priorityMenubar.setVisible(false);
    } else {
        priorityItem.setText(task.getTaskPriority() != null ? task.getTaskPriority().name()
                : TaskModel.TASK_PRIORITY.NORMAL.name());
        priorityItem.setIcon(task.getTaskPriority() != null && task.getTaskPriority().getIcon() != null
                ? FontAwesome.valueOf(task.getTaskPriority().getIcon())
                : null);
        if (task.getExecutor() == null) {
            priorityMenubar.setEnabled(false);
            btnAccept.setIcon(FontAwesome.CHECK);
            btnAccept.setCaption("Accept");
            btnAccept.setEnabled(true);
            btnEscalate.setEnabled(false);
            btnDelegate.setEnabled(false);
            btnSchedule.setEnabled(false);
            btnSave.setEnabled(false);
            btnSend.setEnabled(false);
            tabSheet.setReadOnly(true);
            tabSheet.setEnabled(false);
        } else if (task.getExecutor().equals(HybridbpmUI.getUser().getUsername())) {
            priorityMenubar.setEnabled(true);
            btnAccept.setIcon(FontAwesome.TIMES);
            btnAccept.setCaption("Deny");
            btnAccept.setEnabled(true);
            btnEscalate.setEnabled(true);
            btnSchedule.setEnabled(true);
            btnDelegate.setEnabled(true);
            btnSave.setEnabled(true);
            btnSend.setEnabled(true);
            tabSheet.setReadOnly(false);
            tabSheet.setEnabled(true);
        }
    }
    // for other statuses than TODO
    if (!Objects.equals(task.getStatus(), TaskModel.STATUS.TODO)) {
        btnAccept.setVisible(false);
        btnSave.setVisible(false);
        btnSend.setVisible(false);
        btnEscalate.setVisible(false);
        btnSchedule.setVisible(false);
        btnDelegate.setVisible(false);
        priorityMenubar.setVisible(false);
        for (Component comp : tabSheet) {
            comp.setReadOnly(true);
            comp.setEnabled(false);
        }
    }
}

From source file:com.mymita.vaadlets.VaadletsBuilder.java

License:Apache License

private static void setComponentAttributes(final com.vaadin.ui.Component vaadinComponent,
        final com.mymita.vaadlets.core.Component c) {
    vaadinComponent.setCaption(c.getCaption());
    vaadinComponent.setEnabled(c.isEnabled());
    vaadinComponent.setReadOnly(c.isReadonly());
    vaadinComponent.setVisible(c.isVisible());
    if (c.getHeight() != null) {
        vaadinComponent.setHeight(c.getHeight());
    }//  w  ww . j  a va 2  s  .  co  m
    if (c.getWidth() != null) {
        vaadinComponent.setWidth(c.getWidth());
    }
    if (c.isSizeUndefined() != null && c.isSizeUndefined().booleanValue()) {
        vaadinComponent.setSizeUndefined();
    }
    if (c.isSizeFull() != null && c.isSizeFull().booleanValue()) {
        vaadinComponent.setSizeFull();
    }
}

From source file:com.oodrive.nuage.webui.VvrManagerUi.java

License:Apache License

/**
 * Remove the progress bar./*w  w  w  . ja  va  2s.co  m*/
 * 
 * @param layout
 */
public final void removeProgressBar(final VerticalLayout layout) {
    rootLayout.removeComponent(layout);
    vvrManagerLayout.setEnabled(true);

    // Set enabled all the component contained in the VVR manager layout
    final Iterator<Component> iterate = vvrManagerLayout.iterator();
    while (iterate.hasNext()) {
        final Component c = iterate.next();
        c.setEnabled(true);
    }
}

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.ConfigComponent.java

License:Apache License

private Layout createLangconfLayout() throws FieldGroup.BindException {
    VerticalLayout langLayout = new VerticalLayout();
    langField = new TextField("lang");
    langLayout.addComponent(new FormLayout(langField));
    final FormLayout translationsLayout = new FormLayout();
    translationsLayout.setSpacing(false);
    useTranslations = new CheckBox("use translations below");
    langLayout.addComponent(useTranslations);
    useTranslations.addValueChangeListener(new Property.ValueChangeListener() {

        @Override//  ww  w . j a va 2 s  .c o m
        public void valueChange(Property.ValueChangeEvent event) {
            Boolean checked = useTranslations.getValue();
            for (Component c : translationsLayout) {
                c.setEnabled(checked);
            }
        }
    });
    translations = new CustomTranslationsBean();
    BeanFieldGroup<CustomTranslationsBean> translationsFieldGroup = new BeanFieldGroup<CustomTranslationsBean>(
            CustomTranslationsBean.class);
    translationsFieldGroup.setItemDataSource((CustomTranslationsBean) translations);
    Collection<Object> propertyIds = translationsFieldGroup.getUnboundPropertyIds();
    translationsFieldGroup.setBuffered(false);
    for (Object property : propertyIds) {
        Field<?> field = translationsFieldGroup.buildAndBind(property);
        ((TextField) field).setNullRepresentation("");
        field.setCaption(field.getCaption().toLowerCase());
        field.setEnabled(false);
        translationsLayout.addComponent(field);
    }
    langLayout.addComponent(translationsLayout);
    return langLayout;
}

From source file:edu.kit.dama.ui.commons.util.UIUtils7.java

License:Apache License

/**
 * Enable/disable all components within pContainer. If pRecursive is set true,
 * containers withing the provided container are processed recursively.
 *
 * @param pContainer The container to process
 * @param pRecursive Recurse into sub-containers
 * @param pValue TRUE = Enabled//from   w  w  w. j  a  v  a 2 s .co m
 */
public static void setEnabled(ComponentContainer pContainer, boolean pRecursive, boolean pValue) {
    pContainer.setReadOnly(pValue);

    if (pRecursive) {
        Iterator<Component> com = pContainer.iterator();
        while (com.hasNext()) {
            Component next = com.next();
            if (next instanceof ComponentContainer) {
                setEnabled((ComponentContainer) next, pRecursive, pValue);
            } else {
                next.setEnabled(pValue);
            }
        }
    }
}

From source file:info.magnolia.ui.contentapp.movedialog.view.MoveDialogActionAreaViewImpl.java

License:Open Source License

@Override
public void setActionEnabled(String actionName, boolean isEnabled) {
    Component actionComponent = getViewForAction(actionName).asVaadinComponent();
    actionComponent.setEnabled(isEnabled);
}

From source file:info.magnolia.ui.contentapp.renderer.SelectionSensitiveActionRenderer.java

License:Open Source License

@Override
public View start(final ActionDefinition definition, ActionListener listener) {
    View view = super.start(definition, listener);
    final Component button = view.asVaadinComponent();
    chooseDialogEventBus.addHandler(SelectionChangedEvent.class, new SelectionChangedEvent.Handler() {

        @Override//from   w  ww  . j a  v a2 s .c  o m
        public void onSelectionChanged(SelectionChangedEvent event) {
            Set<Object> itemIds = event.getItemIds();
            if (itemIds == null || itemIds.isEmpty()) {
                itemIds = Collections.emptySet();
            }

            AvailabilityDefinition availability = definition.getAvailability();
            button.setEnabled(availabilityChecker.isAvailable(availability, Lists.newLinkedList(itemIds)));
        }
    });
    return new ViewAdapter(button);
}

From source file:org.hip.vif.admin.groupadmin.ui.ContributionsListView.java

License:Open Source License

private void disableOtherButtons(final Button inButton, final HorizontalLayout inButtons) {
    final Iterator<Component> lIterator = inButtons.iterator();
    while (lIterator.hasNext()) {
        final Component lComponent = lIterator.next();
        if (lComponent instanceof Button) {
            if (!inButton.equals(lComponent)) {
                lComponent.setEnabled(false);
            }/* w  w w .  jav  a  2  s. com*/
        }
    }
}