Search in sources :

Example 1 with ButtonLayout

use of com.storedobject.vaadin.ButtonLayout in project SODevelopment by syampillai.

the class AbstractObjectField method initComponent.

/**
 * This is where the display parts of the field is initialized.
 * If overridden, you need to make sure to always return the same component between calls.
 *
 * @return The layout component containing other display components.
 */
protected ButtonLayout initComponent() {
    if (layout != null) {
        return layout;
    }
    prefixComponent = createPrefixComponent();
    layout = new ButtonLayout(prefixComponent, detailComponent);
    layout.setWidthFull();
    layout.setFlexGrow(1, detailComponent);
    prefixComponent.setVisible(isEnabled() && !isReadOnly());
    return layout;
}
Also used : ButtonLayout(com.storedobject.vaadin.ButtonLayout)

Example 2 with ButtonLayout

use of com.storedobject.vaadin.ButtonLayout in project SODevelopment by syampillai.

the class ObjectGetField method createPrefixComponent.

@Override
protected Component createPrefixComponent() {
    if (searchField != null) {
        return searchField;
    }
    searchField = new TextField();
    searchField.setWidth(w() + "px");
    ButtonLayout buttonLayout = new ButtonLayout();
    ImageButton search = new ImageButton("Search", e -> doSearch()).withBox();
    if (addButton != null) {
        buttonLayout.add(addButton);
    }
    ImageButton b = new ImageButton("Cancel", e -> {
        setValue((Id) null);
        searchField.focus();
    }).withBox();
    buttonLayout.add(b);
    buttonLayout.add(search);
    searchField.setPrefixComponent(buttonLayout);
    return searchField;
}
Also used : com.storedobject.core(com.storedobject.core) Consumer(java.util.function.Consumer) Component(com.vaadin.flow.component.Component) SORuntimeException(com.storedobject.common.SORuntimeException) TextField(com.storedobject.vaadin.TextField) Modifier(java.lang.reflect.Modifier) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) ImageButton(com.storedobject.vaadin.ImageButton) Method(java.lang.reflect.Method) ButtonLayout(com.storedobject.vaadin.ButtonLayout) ImageButton(com.storedobject.vaadin.ImageButton) ButtonLayout(com.storedobject.vaadin.ButtonLayout) TextField(com.storedobject.vaadin.TextField)

Example 3 with ButtonLayout

use of com.storedobject.vaadin.ButtonLayout in project SODevelopment by syampillai.

the class ObjectSearchField method createPrefixComponent.

@Override
protected Component createPrefixComponent() {
    ImageButton search = new ImageButton("Search", e -> doSearch()).withBox();
    delete = new ImageButton("Delete", e -> {
        setModelValue(null, true);
        setPresentationValue(null);
    }).withBox();
    delete.setVisible(false);
    return new ButtonLayout(addButton, search, delete);
}
Also used : Component(com.vaadin.flow.component.Component) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) StoredObject(com.storedobject.core.StoredObject) ImageButton(com.storedobject.vaadin.ImageButton) ButtonLayout(com.storedobject.vaadin.ButtonLayout) ImageButton(com.storedobject.vaadin.ImageButton) ButtonLayout(com.storedobject.vaadin.ButtonLayout)

Example 4 with ButtonLayout

use of com.storedobject.vaadin.ButtonLayout in project SODevelopment by syampillai.

the class JournalVoucherView method createHeader.

@Override
public Component createHeader() {
    ButtonLayout b = new ButtonLayout(new ELabel("Transaction:"), transaction);
    b.addFiller();
    b.add(new ELabel("Entries: "), count);
    return b;
}
Also used : ELabel(com.storedobject.ui.ELabel) ButtonLayout(com.storedobject.vaadin.ButtonLayout)

Aggregations

ButtonLayout (com.storedobject.vaadin.ButtonLayout)4 ImageButton (com.storedobject.vaadin.ImageButton)2 Component (com.vaadin.flow.component.Component)2 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)2 SORuntimeException (com.storedobject.common.SORuntimeException)1 com.storedobject.core (com.storedobject.core)1 StoredObject (com.storedobject.core.StoredObject)1 ELabel (com.storedobject.ui.ELabel)1 TextField (com.storedobject.vaadin.TextField)1 Method (java.lang.reflect.Method)1 Modifier (java.lang.reflect.Modifier)1 Consumer (java.util.function.Consumer)1