Search in sources :

Example 96 with Component

use of com.vaadin.ui.Component in project linkki by linkki-framework.

the class DynamicFieldBindingTest method testDynamicField_shouldBindToTextField.

@Test
public void testDynamicField_shouldBindToTextField() {
    String value = "value";
    Pmo pmo = new Pmo(new Model(value, false));
    Component component = TestUiUtil.createFirstComponentOf(pmo);
    assertNotNull(component);
    assertTrue(component instanceof TextField);
    TextField txt = (TextField) component;
    assertThat(txt.getValue(), is(value));
    String newValue = "new value";
    txt.setValue(newValue);
    assertThat(pmo.model.paymentMethod, is(newValue));
    pmo.model.paymentMethod = null;
    assertThat(txt.getValue(), is(nullValue()));
}
Also used : TextField(com.vaadin.ui.TextField) UITextField(org.linkki.core.ui.section.annotations.UITextField) Component(com.vaadin.ui.Component) Test(org.junit.Test)

Example 97 with Component

use of com.vaadin.ui.Component in project linkki by linkki-framework.

the class SectionCreationContextTest method testSetComponentId.

@Test
public void testSetComponentId() {
    BaseSection section = createContext(new SCCPmoWithID()).createSection();
    assertThat(section.getComponentCount(), is(2));
    Component textField = ((GridLayout) ((Panel) section.getComponent(1)).getContent()).getComponent(1, 0);
    assertThat(textField.getId(), is("testProperty"));
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Component(com.vaadin.ui.Component) Test(org.junit.Test)

Example 98 with Component

use of com.vaadin.ui.Component in project linkki by linkki-framework.

the class SectionCreationContext method createLabelAndComponent.

private ComponentWrapper createLabelAndComponent(BaseSection section, ElementDescriptor uiElement) {
    Component component = uiElement.newComponent();
    String labelText = uiElement.getLabelText();
    String pmoPropertyName = uiElement.getPmoPropertyName();
    Label label = new Label(labelText);
    section.add(pmoPropertyName, label, component);
    return new LabelComponentWrapper(label, component);
}
Also used : Label(com.vaadin.ui.Label) Component(com.vaadin.ui.Component) LabelComponentWrapper(org.linkki.core.ui.components.LabelComponentWrapper)

Example 99 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class ScreenDependencyUtils method findWindowVerticalLayout.

protected static Optional<CubaWindowVerticalLayout> findWindowVerticalLayout(FrameOwner frameOwner) {
    Window window = UiControllerUtils.getScreen(frameOwner).getWindow();
    Component vComponent = window.unwrap(Component.class);
    if (vComponent instanceof CubaWindowVerticalLayout) {
        return Optional.of(((CubaWindowVerticalLayout) vComponent));
    }
    return Optional.empty();
}
Also used : Window(com.haulmont.cuba.gui.components.Window) Component(com.vaadin.ui.Component) CubaWindowVerticalLayout(com.haulmont.cuba.web.widgets.CubaWindowVerticalLayout)

Example 100 with Component

use of com.vaadin.ui.Component in project cuba by cuba-platform.

the class WebTableFieldFactory method getComponentImplementation.

protected Component getComponentImplementation(com.haulmont.cuba.gui.components.Component columnComponent) {
    com.vaadin.ui.Component composition = columnComponent.unwrapComposition(com.vaadin.ui.Component.class);
    Component componentImpl = composition;
    if (composition instanceof com.vaadin.v7.ui.Field && ((com.vaadin.v7.ui.Field) composition).isRequired()) {
        // vaadin8 replace with CssLayout
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(false);
        layout.setSpacing(false);
        layout.addComponent(composition);
        if (composition.getWidth() < 0) {
            layout.setWidthUndefined();
        }
        componentImpl = layout;
    }
    return componentImpl;
}
Also used : VerticalLayout(com.vaadin.ui.VerticalLayout) Component(com.vaadin.ui.Component) Component(com.vaadin.ui.Component)

Aggregations

Component (com.vaadin.ui.Component)146 LayoutBoundTransferable (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.events.LayoutBoundTransferable)23 VerticalDropLocation (com.vaadin.shared.ui.dd.VerticalDropLocation)13 ComponentContainer (com.vaadin.ui.ComponentContainer)12 SingleComponentContainer (com.vaadin.ui.SingleComponentContainer)12 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)11 HorizontalLayout (com.vaadin.ui.HorizontalLayout)11 VerticalLayout (com.vaadin.ui.VerticalLayout)11 Button (com.vaadin.ui.Button)9 Window (com.haulmont.cuba.gui.components.Window)8 Label (com.vaadin.ui.Label)8 Test (org.junit.Test)8 WebWindow (com.haulmont.cuba.web.gui.WebWindow)7 AbstractOrderedLayout (com.vaadin.ui.AbstractOrderedLayout)6 CssLayout (com.vaadin.ui.CssLayout)6 List (java.util.List)6 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)5 CubaUI (com.haulmont.cuba.web.widgets.CubaUI)5 DDAbsoluteLayout (com.haulmont.cuba.web.widgets.addons.dragdroplayouts.DDAbsoluteLayout)5 Item (com.vaadin.data.Item)5