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()));
}
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"));
}
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);
}
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();
}
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;
}
Aggregations