Search in sources :

Example 36 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebSideMenu method setSidePanelToggleButton.

@Override
public void setSidePanelToggleButton(Button toggleButton) {
    if (this.toggleButton != null) {
        toggleButton.setAction(null);
    }
    if (toggleButton != null) {
        AbstractAction toggleAction = new AbstractAction("toggleSideMenu") {

            @Override
            public void actionPerform(Component component) {
                toggleSidePanel();
            }
        };
        toggleAction.setCaption(toggleButton.getCaption());
        toggleAction.setIcon(toggleButton.getIcon());
        toggleAction.setDescription(toggleButton.getDescription());
        toggleAction.setEnabled(toggleButton.isEnabled());
        toggleAction.setVisible(toggleButton.isVisible());
        toggleButton.setAction(toggleAction);
    }
    this.toggleButton = toggleButton;
}
Also used : WebAbstractComponent(com.haulmont.cuba.web.gui.components.WebAbstractComponent) Component(com.haulmont.cuba.gui.components.Component) AbstractAction(com.haulmont.cuba.gui.components.AbstractAction)

Example 37 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebGridLayout method removeAll.

@Override
public void removeAll() {
    component.removeAllComponents();
    Component[] components = ownComponents.toArray(new Component[ownComponents.size()]);
    ownComponents.clear();
    for (Component childComponent : components) {
        childComponent.setParent(null);
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component)

Example 38 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class WebHtmlBoxLayout method removeAll.

@Override
public void removeAll() {
    component.removeAllComponents();
    Component[] components = ownComponents.toArray(new Component[ownComponents.size()]);
    ownComponents.clear();
    for (Component childComponent : components) {
        childComponent.setParent(null);
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component)

Example 39 with Component

use of com.haulmont.cuba.gui.components.Component in project documentation by cuba-platform.

the class Users method init.

@Override
public void init(Map<String, Object> params) {
    Map<String, Locale> locales = configuration.getConfig(GlobalConfig.class).getAvailableLocales();
    Map<String, Object> options = new TreeMap<>();
    for (Map.Entry<String, Locale> entry : locales.entrySet()) {
        options.put(entry.getKey(), messages.getTools().localeToString(entry.getValue()));
    }
    DataGrid.Column column = usersGrid.addGeneratedColumn("language", new DataGrid.ColumnGenerator<User, Component>() {

        @Override
        public Component getValue(DataGrid.ColumnGeneratorEvent<User> event) {
            LookupField component = componentsFactory.createComponent(LookupField.class);
            component.setOptionsMap(options);
            component.setWidth("100%");
            User user = event.getItem();
            component.setValue(user.getLanguage());
            component.addValueChangeListener(e -> user.setLanguage((String) e.getValue()));
            return component;
        }

        @Override
        public Class<Component> getType() {
            return Component.class;
        }
    });
    column.setRenderer(new WebComponentRenderer());
}
Also used : Locale(java.util.Locale) GlobalConfig(com.haulmont.cuba.core.global.GlobalConfig) WebComponentRenderer(com.haulmont.cuba.web.gui.components.renderers.WebComponentRenderer) User(com.haulmont.cuba.security.entity.User) Inject(javax.inject.Inject) AbstractWindow(com.haulmont.cuba.gui.components.AbstractWindow) ComponentsFactory(com.haulmont.cuba.gui.xml.layout.ComponentsFactory) TreeMap(java.util.TreeMap) Configuration(com.haulmont.cuba.core.global.Configuration) Locale(java.util.Locale) Map(java.util.Map) LookupField(com.haulmont.cuba.gui.components.LookupField) DataGrid(com.haulmont.cuba.gui.components.DataGrid) Component(com.haulmont.cuba.gui.components.Component) User(com.haulmont.cuba.security.entity.User) GlobalConfig(com.haulmont.cuba.core.global.GlobalConfig) DataGrid(com.haulmont.cuba.gui.components.DataGrid) WebComponentRenderer(com.haulmont.cuba.web.gui.components.renderers.WebComponentRenderer) LookupField(com.haulmont.cuba.gui.components.LookupField) TreeMap(java.util.TreeMap) Component(com.haulmont.cuba.gui.components.Component) TreeMap(java.util.TreeMap) Map(java.util.Map)

Example 40 with Component

use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.

the class DesktopButtonsPanel method setFocusableForAllButtons.

public void setFocusableForAllButtons(boolean focusable) {
    for (Component button : getComponents()) {
        JComponent jButton = DesktopComponentsHelper.unwrap(button);
        if (button instanceof DesktopButton) {
            ((DesktopButton) button).setShouldBeFocused(focusable);
        }
        jButton.setFocusable(focusable);
    }
}
Also used : Component(com.haulmont.cuba.gui.components.Component)

Aggregations

Component (com.haulmont.cuba.gui.components.Component)78 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)10 Datasource (com.haulmont.cuba.gui.data.Datasource)10 User (com.haulmont.cuba.security.entity.User)9 List (java.util.List)9 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)8 ArrayList (java.util.ArrayList)8 UUID (java.util.UUID)8 LookupPickerField (com.haulmont.cuba.gui.components.LookupPickerField)7 Group (com.haulmont.cuba.security.entity.Group)7 Assert.assertEquals (org.junit.Assert.assertEquals)7 Assert.assertNotNull (org.junit.Assert.assertNotNull)7 Assert.assertTrue (org.junit.Assert.assertTrue)7 Ignore (org.junit.Ignore)7 Test (org.junit.Test)7 Element (org.dom4j.Element)6 ButtonTabComponent (com.haulmont.cuba.desktop.sys.ButtonTabComponent)5 AbstractAction (com.haulmont.cuba.gui.components.AbstractAction)5 Frame (com.haulmont.cuba.gui.components.Frame)4 AbstractComponent (com.vaadin.ui.AbstractComponent)4