Search in sources :

Example 1 with ImageButton

use of com.storedobject.vaadin.ImageButton 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 2 with ImageButton

use of com.storedobject.vaadin.ImageButton 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)

Aggregations

ButtonLayout (com.storedobject.vaadin.ButtonLayout)2 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 TextField (com.storedobject.vaadin.TextField)1 Method (java.lang.reflect.Method)1 Modifier (java.lang.reflect.Modifier)1 Consumer (java.util.function.Consumer)1