Search in sources :

Example 1 with CubaVerticalActionsLayout

use of com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout in project cuba by cuba-platform.

the class WebGroupBox method add.

@Override
public void add(Component childComponent, int index) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }
    AbstractOrderedLayout newContent = null;
    if (orientation == Orientation.VERTICAL && !(component.getContent() instanceof CubaVerticalActionsLayout)) {
        newContent = new CubaVerticalActionsLayout();
    } else if (orientation == Orientation.HORIZONTAL && !(component.getContent() instanceof CubaHorizontalActionsLayout)) {
        newContent = new CubaHorizontalActionsLayout();
    }
    if (newContent != null) {
        newContent.setStyleName("c-groupbox-inner");
        component.setContent(newContent);
        CubaOrderedActionsLayout currentContent = (CubaOrderedActionsLayout) component.getContent();
        newContent.setMargin(currentContent.getMargin());
        newContent.setSpacing(currentContent.isSpacing());
    }
    if (ownComponents.contains(childComponent)) {
        int existingIndex = getComponentContent().getComponentIndex(WebComponentsHelper.getComposition(childComponent));
        if (index > existingIndex) {
            index--;
        }
        remove(childComponent);
    }
    com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);
    getComponentContent().addComponent(vComponent, index);
    getComponentContent().setComponentAlignment(vComponent, WebWrapperUtils.toVaadinAlignment(childComponent.getAlignment()));
    if (frame != null) {
        if (childComponent instanceof BelongToFrame && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            ((FrameImplementation) frame).registerComponent(childComponent);
        }
    }
    if (index == ownComponents.size()) {
        ownComponents.add(childComponent);
    } else {
        ownComponents.add(index, childComponent);
    }
    childComponent.setParent(this);
}
Also used : CubaVerticalActionsLayout(com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout) FrameImplementation(com.haulmont.cuba.gui.components.sys.FrameImplementation) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) CubaHorizontalActionsLayout(com.haulmont.cuba.web.widgets.CubaHorizontalActionsLayout) CubaOrderedActionsLayout(com.haulmont.cuba.web.widgets.CubaOrderedActionsLayout)

Example 2 with CubaVerticalActionsLayout

use of com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout in project cuba by cuba-platform.

the class CubaFoldersPane method createFoldersPaneLayout.

protected void createFoldersPaneLayout(Component appFoldersPane, Component searchFoldersPane) {
    if (appFoldersPane != null && searchFoldersPane != null) {
        vertSplit = new VerticalSplitPanel();
        vertSplit.setSplitPosition(verticalSplitPos);
        CubaVerticalActionsLayout afLayout = createFoldersPaneLayout(appFoldersPane, appFoldersLabel);
        vertSplit.setFirstComponent(afLayout);
        CubaVerticalActionsLayout sfLayout = createFoldersPaneLayout(searchFoldersPane, searchFoldersLabel);
        vertSplit.setSecondComponent(sfLayout);
        addComponent(vertSplit);
    } else {
        if (appFoldersPane != null) {
            // we need to wrap the folders tree with a layout in order to provide margins
            CubaVerticalActionsLayout afLayout = createFoldersPaneLayout(appFoldersPane, appFoldersLabel);
            addComponent(afLayout);
        }
        if (searchFoldersPane != null) {
            // we need to wrap the folders tree with a layout in order to provide margins
            CubaVerticalActionsLayout sfLayout = createFoldersPaneLayout(searchFoldersPane, searchFoldersLabel);
            addComponent(sfLayout);
        }
    }
}
Also used : CubaVerticalActionsLayout(com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout)

Example 3 with CubaVerticalActionsLayout

use of com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout in project cuba by cuba-platform.

the class CubaFoldersPane method createFoldersPaneLayout.

protected CubaVerticalActionsLayout createFoldersPaneLayout(Component foldersPane, Label foldersLabel) {
    CubaVerticalActionsLayout layout = new CubaVerticalActionsLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    if (foldersLabel != null)
        addFoldersLabel(layout, foldersLabel);
    layout.addComponent(foldersPane);
    layout.setExpandRatio(foldersPane, 1);
    layout.addShortcutListener(new ShortcutListenerDelegate("apply" + foldersPane.getCubaId(), ShortcutAction.KeyCode.ENTER, null).withHandler((sender, target) -> {
        if (sender == layout) {
            handleFoldersPaneShortcutAction(foldersPane);
        }
    }));
    return layout;
}
Also used : EnhancedTreeDataProvider(com.haulmont.cuba.web.widgets.tree.EnhancedTreeDataProvider) MenuItem(com.vaadin.ui.MenuBar.MenuItem) UserSettingsTools(com.haulmont.cuba.web.app.UserSettingsTools) StringUtils(org.apache.commons.lang3.StringUtils) AppUI(com.haulmont.cuba.web.AppUI) FileUploadDialog(com.haulmont.cuba.gui.app.core.file.FileUploadDialog) TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) ContextClickEvent(com.vaadin.event.ContextClickEvent) ShortcutAction(com.vaadin.event.ShortcutAction) Method(java.lang.reflect.Method) OpenType(com.haulmont.cuba.gui.WindowManager.OpenType) CubaTree(com.haulmont.cuba.web.widgets.CubaTree) MouseEventDetails(com.vaadin.shared.MouseEventDetails) TaskLifeCycle(com.haulmont.cuba.gui.executors.TaskLifeCycle) COMMIT_ACTION_ID(com.haulmont.cuba.gui.components.Window.COMMIT_ACTION_ID) Frame(com.haulmont.cuba.gui.components.Frame) Action(com.vaadin.event.Action) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo) Status(com.haulmont.cuba.gui.components.Action.Status) App(com.haulmont.cuba.web.App) Collectors(java.util.stream.Collectors) CubaSingleSelectionModel(com.haulmont.cuba.web.widgets.grid.CubaSingleSelectionModel) MarginInfo(com.vaadin.shared.ui.MarginInfo) BackgroundTask(com.haulmont.cuba.gui.executors.BackgroundTask) BackgroundTaskWrapper(com.haulmont.cuba.gui.executors.BackgroundTaskWrapper) Stream(java.util.stream.Stream) Folder(com.haulmont.cuba.core.entity.Folder) WebConfig(com.haulmont.cuba.web.WebConfig) CubaGridContextMenu(com.haulmont.cuba.web.widgets.grid.CubaGridContextMenu) ComponentsHelper(com.haulmont.cuba.gui.ComponentsHelper) SerializableFunction(com.vaadin.server.SerializableFunction) java.util(java.util) WindowManager(com.haulmont.cuba.gui.WindowManager) FoldersService(com.haulmont.cuba.core.app.FoldersService) CubaVerticalActionsLayout(com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout) Supplier(java.util.function.Supplier) AppFolder(com.haulmont.cuba.core.entity.AppFolder) com.haulmont.cuba.core.global(com.haulmont.cuba.core.global) ReflectTools(com.vaadin.util.ReflectTools) ExportFormat(com.haulmont.cuba.gui.export.ExportFormat) CubaTimer(com.haulmont.cuba.web.widgets.CubaTimer) DataService(com.haulmont.cuba.core.app.DataService) Nullable(javax.annotation.Nullable) AbstractSearchFolder(com.haulmont.cuba.core.entity.AbstractSearchFolder) TreeData(com.vaadin.data.TreeData) UserSettingService(com.haulmont.cuba.security.app.UserSettingService) Command(com.vaadin.ui.MenuBar.Command) Type(com.haulmont.cuba.gui.components.DialogAction.Type) FileUtils(org.apache.commons.io.FileUtils) IOException(java.io.IOException) SearchFolder(com.haulmont.cuba.security.entity.SearchFolder) Consumer(java.util.function.Consumer) WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) ByteArrayDataProvider(com.haulmont.cuba.gui.export.ByteArrayDataProvider) WebExportDisplay(com.haulmont.cuba.web.filestorage.WebExportDisplay) FileUploadingAPI(com.haulmont.cuba.gui.upload.FileUploadingAPI) ShortcutListenerDelegate(com.haulmont.cuba.web.gui.components.util.ShortcutListenerDelegate) HierarchicalQuery(com.vaadin.data.provider.HierarchicalQuery) DialogAction(com.haulmont.cuba.gui.components.DialogAction) SerializableEventListener(com.vaadin.event.SerializableEventListener) Entity(com.haulmont.cuba.core.entity.Entity) com.vaadin.ui(com.vaadin.ui) CubaVerticalActionsLayout(com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout) ShortcutListenerDelegate(com.haulmont.cuba.web.gui.components.util.ShortcutListenerDelegate)

Example 4 with CubaVerticalActionsLayout

use of com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout in project cuba by cuba-platform.

the class WebScrollBoxLayout method add.

@Override
public void add(Component childComponent, int index) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }
    AbstractOrderedLayout newContent = null;
    if (orientation == Orientation.VERTICAL && !(getContent() instanceof CubaVerticalActionsLayout)) {
        newContent = new CubaVerticalActionsLayout();
        newContent.setWidth(100, Sizeable.Unit.PERCENTAGE);
    } else if (orientation == Orientation.HORIZONTAL && !(getContent() instanceof CubaHorizontalActionsLayout)) {
        newContent = new CubaHorizontalActionsLayout();
    }
    if (newContent != null) {
        newContent.setMargin((getContent()).getMargin());
        newContent.setSpacing((getContent()).isSpacing());
        newContent.setStyleName(SCROLLBOX_CONTENT_STYLENAME);
        com.vaadin.ui.Component oldContent = component.getComponent(0);
        newContent.setWidth(oldContent.getWidth(), oldContent.getWidthUnits());
        newContent.setHeight(oldContent.getHeight(), oldContent.getHeightUnits());
        component.removeAllComponents();
        component.addComponent(newContent);
        applyScrollBarsPolicy(scrollBarPolicy);
    }
    if (ownComponents.contains(childComponent)) {
        int existingIndex = getContent().getComponentIndex(WebComponentsHelper.getComposition(childComponent));
        if (index > existingIndex) {
            index--;
        }
        remove(childComponent);
    }
    com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);
    getContent().addComponent(vComponent, index);
    getContent().setComponentAlignment(vComponent, WebWrapperUtils.toVaadinAlignment(childComponent.getAlignment()));
    if (frame != null) {
        if (childComponent instanceof BelongToFrame && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            ((FrameImplementation) frame).registerComponent(childComponent);
        }
    }
    if (index == ownComponents.size()) {
        ownComponents.add(childComponent);
    } else {
        ownComponents.add(index, childComponent);
    }
    childComponent.setParent(this);
}
Also used : CubaVerticalActionsLayout(com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout) FrameImplementation(com.haulmont.cuba.gui.components.sys.FrameImplementation) AbstractOrderedLayout(com.vaadin.ui.AbstractOrderedLayout) CubaHorizontalActionsLayout(com.haulmont.cuba.web.widgets.CubaHorizontalActionsLayout)

Aggregations

CubaVerticalActionsLayout (com.haulmont.cuba.web.widgets.CubaVerticalActionsLayout)4 FrameImplementation (com.haulmont.cuba.gui.components.sys.FrameImplementation)2 CubaHorizontalActionsLayout (com.haulmont.cuba.web.widgets.CubaHorizontalActionsLayout)2 DataService (com.haulmont.cuba.core.app.DataService)1 FoldersService (com.haulmont.cuba.core.app.FoldersService)1 AbstractSearchFolder (com.haulmont.cuba.core.entity.AbstractSearchFolder)1 AppFolder (com.haulmont.cuba.core.entity.AppFolder)1 Entity (com.haulmont.cuba.core.entity.Entity)1 Folder (com.haulmont.cuba.core.entity.Folder)1 com.haulmont.cuba.core.global (com.haulmont.cuba.core.global)1 ComponentsHelper (com.haulmont.cuba.gui.ComponentsHelper)1 WindowManager (com.haulmont.cuba.gui.WindowManager)1 OpenType (com.haulmont.cuba.gui.WindowManager.OpenType)1 FileUploadDialog (com.haulmont.cuba.gui.app.core.file.FileUploadDialog)1 Status (com.haulmont.cuba.gui.components.Action.Status)1 DialogAction (com.haulmont.cuba.gui.components.DialogAction)1 Type (com.haulmont.cuba.gui.components.DialogAction.Type)1 Frame (com.haulmont.cuba.gui.components.Frame)1 COMMIT_ACTION_ID (com.haulmont.cuba.gui.components.Window.COMMIT_ACTION_ID)1 WindowConfig (com.haulmont.cuba.gui.config.WindowConfig)1