Example usage for com.vaadin.ui Component isEnabled

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

Introduction

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

Prototype

public boolean isEnabled();

Source Link

Document

Tests whether the component is enabled or not.

Usage

From source file:com.foc.web.unitTesting.FocUnitTestingCommand.java

License:Apache License

private void component_AssertEnabled(FocXMLGuiComponent component, String fieldNameForMessage,
        boolean assertEnabled) throws Exception {
    //Editable/* w  ww  .j a v a  2  s  .  c o  m*/
    if (component != null && component instanceof Component) {
        Component componentToCheck = (Component) component;
        if (componentToCheck instanceof FVWrapperLayout) {
            componentToCheck = ((FVWrapperLayout) component).getFormField();
        }
        //If we are not in assertOnly this means the component has to be enabled
        if (componentToCheck.isEnabled() != assertEnabled) {
            getLogger().addFailure("Component " + fieldNameForMessage + " enable status: "
                    + componentToCheck.isEnabled() + " different then expected: " + assertEnabled);
        } else {
            getLogger().addInfo("Component " + fieldNameForMessage + " enable status: "
                    + componentToCheck.isEnabled() + " as expected");
        }
    } else {
        getLogger().addFailure("Faild to check component " + fieldNameForMessage
                + " enabled because either null or not instanceof Component");
    }
}

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  w  w  .  j  a  va  2s  . c o  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();
    }
}