Search in sources :

Example 1 with EJItemGroupPropertiesContainer

use of org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer in project rap by entirej.

the class EJRWTLineChartRecordBlockRenderer method initialiseRenderer.

@Override
public void initialiseRenderer(EJEditableBlockController block) {
    _block = block;
    EJCoreBlockProperties blockProperties = _block.getProperties();
    options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
    options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
    options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
    options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
    options.getGridLines().setDisplay(blockProperties.getBlockRendererProperties().getBooleanProperty("gridLines", options.getGridLines().isDisplay()));
    xAxisColumn = blockProperties.getBlockRendererProperties().getStringProperty(X_AXIS_COLUMN);
    EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
    Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
    options.getYAxes().clear();
    for (EJItemGroupProperties g : itemGroupProperties) {
        Axis axis = new Axis();
        options.getYAxes().add(axis);
        if (g.getRendererProperties() == null) {
            continue;
        }
        Ticks ticks = axis.getTicks();
        if (!g.getRendererProperties().isPropertyValueNull(BEGIN_AT_ZERO))
            ticks.setBeginAtZero(g.getRendererProperties().getBooleanProperty(BEGIN_AT_ZERO, false));
        if (!g.getRendererProperties().isPropertyValueNull(MIN))
            ticks.setMin(Double.valueOf(g.getRendererProperties().getFloatProperty(MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(MAX))
            ticks.setMax(Double.valueOf(g.getRendererProperties().getFloatProperty(MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MAX))
            ticks.setSuggestedMax(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MIN))
            ticks.setSuggestedMin(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(STEP_SIZE))
            ticks.setStepSize(Double.valueOf(g.getRendererProperties().getFloatProperty(STEP_SIZE, 0f)));
        ticks.setMaxTicksLimit((g.getRendererProperties().getIntProperty(MAX_TICKS_LIMIT, ticks.getMaxTicksLimit())));
    }
}
Also used : EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) Ticks(org.eclipse.rap.chartjs.Ticks) EJCoreBlockProperties(org.entirej.framework.core.properties.EJCoreBlockProperties) Axis(org.eclipse.rap.chartjs.Axis) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)

Example 2 with EJItemGroupPropertiesContainer

use of org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer in project rap by entirej.

the class EJRWTBarChartRecordBlockRenderer method initialiseRenderer.

@Override
public void initialiseRenderer(EJEditableBlockController block) {
    _block = block;
    EJCoreBlockProperties blockProperties = _block.getProperties();
    options.setAnimation(blockProperties.getBlockRendererProperties().getBooleanProperty(ANIMATION, options.getAnimation()));
    options.setShowToolTips(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_TOOLTIPS, options.getShowToolTips()));
    options.getLegend().setEnabled(blockProperties.getBlockRendererProperties().getBooleanProperty(SHOW_LEGEND, options.getLegend().isEnabled()));
    options.getLegend().setPosition(blockProperties.getBlockRendererProperties().getStringProperty(LEGEND_POSITION));
    options.getGridLines().setDisplay(blockProperties.getBlockRendererProperties().getBooleanProperty("gridLines", options.getGridLines().isDisplay()));
    options.setBarPercentage(blockProperties.getBlockRendererProperties().getFloatProperty("barPercentage", options.getBarPercentage()));
    options.setCategoryPercentage(blockProperties.getBlockRendererProperties().getFloatProperty("categoryPercentage", options.getCategoryPercentage()));
    int barThickness = blockProperties.getBlockRendererProperties().getIntProperty("barThickness", 0);
    if (barThickness > 0)
        options.setBarThickness(barThickness);
    int maxBarThickness = blockProperties.getBlockRendererProperties().getIntProperty("maxBarThickness", 0);
    if (maxBarThickness > 0)
        options.setMaxBarThickness(maxBarThickness);
    horizontalBar = blockProperties.getBlockRendererProperties().getBooleanProperty("horizontalBar", false);
    xAxisColumn = blockProperties.getBlockRendererProperties().getStringProperty(X_AXIS_COLUMN);
    EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
    Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
    options.getYAxes().clear();
    options.getxAxes().clear();
    for (EJItemGroupProperties g : itemGroupProperties) {
        Axis axis = new Axis();
        if (horizontalBar)
            options.getxAxes().add(axis);
        else
            options.getYAxes().add(axis);
        if (g.getRendererProperties() == null) {
            continue;
        }
        Ticks ticks = axis.getTicks();
        if (!g.getRendererProperties().isPropertyValueNull(BEGIN_AT_ZERO))
            ticks.setBeginAtZero(g.getRendererProperties().getBooleanProperty(BEGIN_AT_ZERO, false));
        if (!g.getRendererProperties().isPropertyValueNull(MIN))
            ticks.setMin(Double.valueOf(g.getRendererProperties().getFloatProperty(MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(MAX))
            ticks.setMax(Double.valueOf(g.getRendererProperties().getFloatProperty(MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MAX))
            ticks.setSuggestedMax(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MAX, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(SUGGESTED_MIN))
            ticks.setSuggestedMin(Double.valueOf(g.getRendererProperties().getFloatProperty(SUGGESTED_MIN, 0f)));
        if (!g.getRendererProperties().isPropertyValueNull(STEP_SIZE))
            ticks.setStepSize(Double.valueOf(g.getRendererProperties().getFloatProperty(STEP_SIZE, 0f)));
        ticks.setMaxTicksLimit((g.getRendererProperties().getIntProperty(MAX_TICKS_LIMIT, ticks.getMaxTicksLimit())));
    }
}
Also used : EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) Ticks(org.eclipse.rap.chartjs.Ticks) EJCoreBlockProperties(org.entirej.framework.core.properties.EJCoreBlockProperties) Axis(org.eclipse.rap.chartjs.Axis) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)

Example 3 with EJItemGroupPropertiesContainer

use of org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer in project rap by entirej.

the class EJRWTSingleRecordBlockRenderer method createItemGroup.

private void createItemGroup(Composite parent, EJItemGroupProperties groupProperties) {
    EJRWTEntireJGridPane groupPane;
    if (groupProperties.isSeparator()) {
        int style = SWT.SEPARATOR;
        if (groupProperties.getSeparatorOrientation() == EJSeparatorOrientation.HORIZONTAL) {
            style = style | SWT.HORIZONTAL;
        } else {
            style = style | SWT.VERTICAL;
        }
        Label layoutBody = new Label(parent, style);
        layoutBody.setLayoutData(createItemGroupGridData(groupProperties));
        switch(groupProperties.getSeparatorLineStyle()) {
            case DASHED:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator_dashed");
                break;
            case DOTTED:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator_dotted");
                break;
            case DOUBLE:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator_double");
                break;
            default:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator");
                break;
        }
        return;
    }
    String frameTitle = groupProperties.getFrameTitle();
    EJFrameworkExtensionProperties rendererProperties = groupProperties.getRendererProperties();
    boolean hasGroup = groupProperties.dispayGroupFrame() && frameTitle != null && frameTitle.length() > 0;
    if (hasGroup) {
        if (rendererProperties != null && rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
            int style = ExpandableComposite.TITLE_BAR;
            String mode = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE);
            if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TWISTIE.equals(mode)) {
                style = style | ExpandableComposite.TWISTIE;
            } else if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TREE_NODE.equals(mode)) {
                style = style | ExpandableComposite.TREE_NODE;
            }
            if (rendererProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
                style = style | ExpandableComposite.EXPANDED;
            }
            Section section = toolkit.createSection(parent, style);
            section.setText(frameTitle);
            EJRWTImageRetriever.getGraphicsProvider().rendererSection(section);
            section.setLayoutData(createItemGroupGridData(groupProperties));
            parent = section;
            hookKeyListener(section);
            section.addMouseListener(new MouseAdapter() {

                @Override
                public void mouseDown(MouseEvent arg0) {
                    setHasFocus(true);
                }
            });
            groupPane = new EJRWTEntireJGridPane(parent, groupProperties.getNumCols());
            groupPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            String customCSSKey = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_CSS_KEY);
            if (customCSSKey != null && customCSSKey.trim().length() > 0) {
                groupPane.setData(EJ_RWT.CUSTOM_VARIANT, customCSSKey);
            }
            // groupPane.getLayout().marginRight = 5;
            // groupPane.getLayout().marginLeft = 5;
            section.setClient(groupPane);
            final EJFrameworkExtensionPropertyList propertyList = rendererProperties.getPropertyList(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTIONS);
            if (propertyList != null && propertyList.getAllListEntries().size() > 0) {
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
                final ToolBar toolbar = toolBarManager.createControl(section);
                final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
                toolbar.setCursor(handCursor);
                // Cursor needs to be explicitly disposed
                toolbar.addDisposeListener(new DisposeListener() {

                    @Override
                    public void widgetDisposed(DisposeEvent e) {
                        if (handCursor != null && handCursor.isDisposed() == false) {
                            handCursor.dispose();
                        }
                    }
                });
                List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
                for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
                    final String actionID = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_ID);
                    String actionImage = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_IMAGE);
                    String actionName = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_NAME);
                    String actionTooltip = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_TOOLTIP);
                    if (actionID != null) {
                        Action action = new Action(actionID, IAction.AS_PUSH_BUTTON) {

                            @Override
                            public void runWithEvent(Event event) {
                                _block.executeActionCommand(actionID, EJScreenType.MAIN);
                            }
                        };
                        if (actionName != null) {
                            action.setText(actionName);
                        }
                        if (actionTooltip != null) {
                            action.setDescription(actionTooltip);
                        }
                        if (actionImage != null && actionImage.length() > 0) {
                            action.setImageDescriptor((EJRWTImageRetriever.createDescriptor(actionImage)));
                        }
                        toolBarManager.add(action);
                    }
                }
                toolBarManager.update(true);
                section.setTextClient(toolbar);
            }
        } else {
            Composite group;
            if (hasGroup) {
                Group g = new Group(parent, SWT.NONE);
                g.setText(frameTitle);
                group = g;
            } else {
                group = new Composite(parent, groupProperties.dispayGroupFrame() ? SWT.BORDER : SWT.NONE);
            }
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            String customCSSKey = null;
            if (rendererProperties != null) {
                customCSSKey = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_CSS_KEY);
                if (customCSSKey != null && customCSSKey.trim().length() > 0) {
                    group.setData(EJ_RWT.CUSTOM_VARIANT, customCSSKey);
                }
            }
            group.setLayout(new FillLayout());
            group.setLayoutData(createItemGroupGridData(groupProperties));
            parent = group;
            hookKeyListener(group);
            group.addMouseListener(new MouseAdapter() {

                @Override
                public void mouseDown(MouseEvent arg0) {
                    setHasFocus(true);
                }
            });
            groupPane = new EJRWTEntireJGridPane(parent, groupProperties.getNumCols());
            groupPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            if (customCSSKey != null && customCSSKey.trim().length() > 0) {
                groupPane.setData(EJ_RWT.CUSTOM_VARIANT, customCSSKey);
            }
        // groupPane.getLayout().marginRight = 5;
        // groupPane.getLayout().marginLeft = 5;
        }
    } else {
        groupPane = new EJRWTEntireJGridPane(parent, groupProperties.getNumCols(), groupProperties.dispayGroupFrame() ? SWT.BORDER : SWT.NONE);
        groupPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
        if (rendererProperties != null) {
            String customCSSKey = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_CSS_KEY);
            if (customCSSKey != null && customCSSKey.trim().length() > 0) {
                groupPane.setData(EJ_RWT.CUSTOM_VARIANT, customCSSKey);
            }
        }
        if (groupProperties.dispayGroupFrame()) {
        // groupPane.getLayout().marginRight = 5;
        // groupPane.getLayout().marginLeft = 5;
        }
    }
    groupPane.getLayout().verticalSpacing = 1;
    hookKeyListener(groupPane);
    groupPane.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            setHasFocus(true);
        }
    });
    groupPane.setPaneName(groupProperties.getName());
    if (!hasGroup) {
        groupPane.setLayoutData(createItemGroupGridData(groupProperties));
    }
    // items adding
    Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
    for (EJScreenItemProperties screenItemProperties : itemProperties) {
        createScreenItem(groupPane, (EJCoreMainScreenItemProperties) screenItemProperties);
    }
    // build sub groups
    EJItemGroupPropertiesContainer groupPropertiesContainer = groupProperties.getChildItemGroupContainer();
    Collection<EJItemGroupProperties> itemGroupProperties = groupPropertiesContainer.getAllItemGroupProperties();
    for (EJItemGroupProperties ejItemGroupProperties : itemGroupProperties) {
        createItemGroup(groupPane, ejItemGroupProperties);
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Group(org.eclipse.swt.widgets.Group) IAction(org.eclipse.jface.action.IAction) EJRWTDeleteAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTDeleteAction) EJRWTQueryAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTQueryAction) EJRWTUpdateAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTUpdateAction) EJRWTInsertAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTInsertAction) Action(org.eclipse.jface.action.Action) EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) Label(org.eclipse.swt.widgets.Label) EJRWTAbstractLabel(org.entirej.applicationframework.rwt.application.components.EJRWTAbstractLabel) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolBarManager(org.eclipse.jface.action.ToolBarManager) EJScreenItemProperties(org.entirej.framework.core.properties.interfaces.EJScreenItemProperties) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) MouseEvent(org.eclipse.swt.events.MouseEvent) EJFrameworkExtensionPropertyList(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyList) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) MouseAdapter(org.eclipse.swt.events.MouseAdapter) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer) EJFrameworkExtensionPropertyListEntry(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyListEntry) ToolBar(org.eclipse.swt.widgets.ToolBar) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Event(org.eclipse.swt.widgets.Event) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)

Example 4 with EJItemGroupPropertiesContainer

use of org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer in project rap by entirej.

the class EJRWTSingleRecordBlockRenderer method buildGuiComponent.

@Override
public void buildGuiComponent(EJRWTEntireJGridPane blockCanvas) {
    EJBlockProperties blockProperties = _block.getProperties();
    EJMainScreenProperties mainScreenProperties = blockProperties.getMainScreenProperties();
    EJFrameworkExtensionProperties brendererProperties = blockProperties.getBlockRendererProperties();
    GridData gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = mainScreenProperties.getWidth();
    gridData.heightHint = mainScreenProperties.getHeight();
    gridData.horizontalSpan = mainScreenProperties.getHorizontalSpan();
    gridData.verticalSpan = mainScreenProperties.getVerticalSpan();
    gridData.grabExcessHorizontalSpace = mainScreenProperties.canExpandHorizontally();
    gridData.grabExcessVerticalSpace = mainScreenProperties.canExpandVertically();
    if (gridData.grabExcessHorizontalSpace) {
        gridData.minimumWidth = mainScreenProperties.getWidth();
    }
    if (gridData.grabExcessVerticalSpace) {
        gridData.minimumHeight = mainScreenProperties.getHeight();
    }
    blockCanvas.setLayoutData(gridData);
    ScrolledComposite scrollComposite = null;
    EJFrameworkExtensionProperties sectionProperties = null;
    if (brendererProperties != null) {
        sectionProperties = brendererProperties.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
    }
    if (sectionProperties != null && sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE) != null && !EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_GROUP.equals(sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE))) {
        int style = ExpandableComposite.TITLE_BAR;
        String mode = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE);
        if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TWISTIE.equals(mode)) {
            style = style | ExpandableComposite.TWISTIE;
        } else if (EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_MODE_TREE_NODE.equals(mode)) {
            style = style | ExpandableComposite.TREE_NODE;
        }
        if (sectionProperties.getBooleanProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_EXPANDED, true)) {
            style = style | ExpandableComposite.EXPANDED;
        }
        Section section = toolkit.createSection(blockCanvas, style);
        section.setLayoutData(gridData);
        String title = sectionProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
        if (title != null) {
            section.setText(title);
        }
        EJRWTImageRetriever.getGraphicsProvider().rendererSection(section);
        String frameTitle = mainScreenProperties.getFrameTitle();
        if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
            Group group = new Group(section, SWT.NONE);
            group.setLayout(new FillLayout());
            group.setLayoutData(gridData);
            scrollComposite = new EJRWTScrolledComposite(group, SWT.V_SCROLL | SWT.H_SCROLL);
            _mainPane = new EJRWTEntireJGridPane(scrollComposite, mainScreenProperties.getNumCols());
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            group.setText(frameTitle);
            section.setClient(group);
        } else {
            Composite composite = new Composite(blockCanvas, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
            composite.setLayout(new FillLayout());
            scrollComposite = new EJRWTScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
            _mainPane = new EJRWTEntireJGridPane(scrollComposite, mainScreenProperties.getNumCols());
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            _mainPane.setLayoutData(gridData);
            section.setClient(composite);
        }
        final EJFrameworkExtensionPropertyList propertyList = sectionProperties.getPropertyList(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTIONS);
        if (propertyList != null && propertyList.getAllListEntries().size() > 0) {
            ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
            final ToolBar toolbar = toolBarManager.createControl(section);
            final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
            toolbar.setCursor(handCursor);
            // Cursor needs to be explicitly disposed
            toolbar.addDisposeListener(new DisposeListener() {

                @Override
                public void widgetDisposed(DisposeEvent e) {
                    if (handCursor != null && handCursor.isDisposed() == false) {
                        handCursor.dispose();
                    }
                }
            });
            List<EJFrameworkExtensionPropertyListEntry> allListEntries = propertyList.getAllListEntries();
            for (EJFrameworkExtensionPropertyListEntry entry : allListEntries) {
                final String actionID = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_ID);
                String actionImage = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_IMAGE);
                String actionName = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_NAME);
                String actionTooltip = entry.getProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_ACTION_TOOLTIP);
                if (actionID != null) {
                    Action action = new Action(actionID, IAction.AS_PUSH_BUTTON) {

                        @Override
                        public void runWithEvent(Event event) {
                            _block.executeActionCommand(actionID, EJScreenType.MAIN);
                        }
                    };
                    if (actionName != null) {
                        action.setText(actionName);
                    }
                    if (actionTooltip != null) {
                        action.setDescription(actionTooltip);
                    }
                    if (actionImage != null && actionImage.length() > 0) {
                        action.setImageDescriptor((EJRWTImageRetriever.createDescriptor(actionImage)));
                    }
                    toolBarManager.add(action);
                }
            }
            toolBarManager.update(true);
            section.setTextClient(toolbar);
        }
    } else {
        String frameTitle = mainScreenProperties.getFrameTitle();
        if (mainScreenProperties.getDisplayFrame() && frameTitle != null && frameTitle.length() > 0) {
            Group group = new Group(blockCanvas, SWT.NONE);
            group.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            group.setLayout(new FillLayout());
            group.setLayoutData(gridData);
            group.setText(frameTitle);
            scrollComposite = new EJRWTScrolledComposite(group, SWT.V_SCROLL | SWT.H_SCROLL);
            _mainPane = new EJRWTEntireJGridPane(scrollComposite, mainScreenProperties.getNumCols());
        } else {
            Composite composite = new Composite(blockCanvas, mainScreenProperties.getDisplayFrame() ? SWT.BORDER : SWT.NONE);
            composite.setLayout(new FillLayout());
            scrollComposite = new EJRWTScrolledComposite(composite, SWT.V_SCROLL | SWT.H_SCROLL);
            _mainPane = new EJRWTEntireJGridPane(scrollComposite, mainScreenProperties.getNumCols());
            _mainPane.setData(EJ_RWT.CUSTOM_VARIANT, EJ_RWT.CSS_CV_ITEM_GROUP);
            composite.setLayoutData(gridData);
        }
    }
    EJFrameworkExtensionProperties rendererProp = EJCoreProperties.getInstance().getApplicationDefinedProperties();
    if (rendererProp != null) {
        EJFrameworkExtensionProperties propertyGroup = rendererProp.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ACTION_GROUP);
        if (propertyGroup != null) {
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_QUERY_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_INSERT_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_UPDATE_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_DELETE_KEY);
            addActionKeyinfo(propertyGroup.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY), EJRWTSingleRecordBlockDefinitionProperties.ACTION_REFRESH_KEY);
        }
    }
    hookKeyListener(_mainPane);
    hookFocusListener(_mainPane);
    _mainPane.cleanLayout();
    EJDataRecord registeredRecord = _mainItemRegister.getRegisteredRecord();
    _mainItemRegister.resetRegister();
    EJItemGroupPropertiesContainer container = blockProperties.getScreenItemGroupContainer(EJScreenType.MAIN);
    Collection<EJItemGroupProperties> itemGroupProperties = container.getAllItemGroupProperties();
    for (EJItemGroupProperties ejItemGroupProperties : itemGroupProperties) {
        createItemGroup(_mainPane, ejItemGroupProperties);
    }
    _mainItemRegister.clearRegisteredValues();
    if (registeredRecord == null) {
        registeredRecord = getFirstRecord();
    }
    if (registeredRecord != null) {
        _mainItemRegister.register(registeredRecord);
    }
    _mainPane.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent arg0) {
            setHasFocus(true);
        }
    });
    if (scrollComposite != null) {
        scrollComposite.setContent(_mainPane);
        scrollComposite.setLayout(new FillLayout());
        scrollComposite.setExpandHorizontal(true);
        scrollComposite.setExpandVertical(true);
        scrollComposite.setMinSize(_mainPane.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) DisposeListener(org.eclipse.swt.events.DisposeListener) IAction(org.eclipse.jface.action.IAction) EJRWTDeleteAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTDeleteAction) EJRWTQueryAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTQueryAction) EJRWTUpdateAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTUpdateAction) EJRWTInsertAction(org.entirej.applicationframework.rwt.application.components.actions.EJRWTInsertAction) Action(org.eclipse.jface.action.Action) EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolBarManager(org.eclipse.jface.action.ToolBarManager) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJFrameworkExtensionPropertyList(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyList) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) EJRWTScrolledComposite(org.entirej.applicationframework.rwt.layout.EJRWTScrolledComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) MouseAdapter(org.eclipse.swt.events.MouseAdapter) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer) EJFrameworkExtensionPropertyListEntry(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionPropertyListEntry) EJBlockProperties(org.entirej.framework.core.properties.interfaces.EJBlockProperties) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) DisposeEvent(org.eclipse.swt.events.DisposeEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Event(org.eclipse.swt.widgets.Event) EJMainScreenProperties(org.entirej.framework.core.properties.interfaces.EJMainScreenProperties) EJDataRecord(org.entirej.framework.core.data.EJDataRecord) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)

Example 5 with EJItemGroupPropertiesContainer

use of org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer in project rap by entirej.

the class EJRWTAbstractScreenRenderer method createItemGroup.

private void createItemGroup(Composite parent, EJItemGroupProperties groupProperties, EJScreenType screenType) {
    if (groupProperties.isSeparator()) {
        int style = SWT.SEPARATOR;
        if (groupProperties.getSeparatorOrientation() == EJSeparatorOrientation.HORIZONTAL) {
            style = style | SWT.HORIZONTAL;
        } else {
            style = style | SWT.VERTICAL;
        }
        Label layoutBody = new Label(parent, style);
        layoutBody.setLayoutData(createItemGroupGridData(groupProperties));
        switch(groupProperties.getSeparatorLineStyle()) {
            case DASHED:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator_dashed");
                break;
            case DOTTED:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator_dotted");
                break;
            case DOUBLE:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator_double");
                break;
            default:
                layoutBody.setData(EJ_RWT.CUSTOM_VARIANT, "separator");
                break;
        }
        return;
    }
    EJRWTEntireJGridPane groupPane;
    String frameTitle = groupProperties.getFrameTitle();
    boolean hasGroup = groupProperties.dispayGroupFrame() && frameTitle != null && frameTitle.length() > 0;
    if (hasGroup) {
        Group group = new Group(parent, SWT.NONE);
        group.setLayout(new FillLayout());
        group.setLayoutData(createItemGroupGridData(groupProperties));
        group.setText(frameTitle);
        parent = group;
        groupPane = new EJRWTEntireJGridPane(parent, groupProperties.getNumCols());
    } else {
        groupPane = new EJRWTEntireJGridPane(parent, groupProperties.getNumCols(), groupProperties.dispayGroupFrame() ? SWT.BORDER : SWT.NONE);
    }
    groupPane.getLayout().verticalSpacing = 1;
    groupPane.setPaneName(groupProperties.getName());
    if (!hasGroup) {
        groupPane.setLayoutData(createItemGroupGridData(groupProperties));
    }
    Collection<EJScreenItemProperties> itemProperties = groupProperties.getAllItemProperties();
    for (EJScreenItemProperties screenItemProperties : itemProperties) {
        createScreenItem(groupPane, screenItemProperties, screenType);
    }
    // build sub groups
    EJItemGroupPropertiesContainer groupPropertiesContainer = groupProperties.getChildItemGroupContainer();
    Collection<EJItemGroupProperties> itemGroupProperties = groupPropertiesContainer.getAllItemGroupProperties();
    for (EJItemGroupProperties ejItemGroupProperties : itemGroupProperties) {
        createItemGroup(groupPane, ejItemGroupProperties, screenType);
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) EJItemGroupProperties(org.entirej.framework.core.properties.interfaces.EJItemGroupProperties) EJScreenItemProperties(org.entirej.framework.core.properties.interfaces.EJScreenItemProperties) EJRWTAbstractLabel(org.entirej.applicationframework.rwt.application.components.EJRWTAbstractLabel) Label(org.eclipse.swt.widgets.Label) FillLayout(org.eclipse.swt.layout.FillLayout) EJRWTEntireJGridPane(org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane) EJItemGroupPropertiesContainer(org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)

Aggregations

EJItemGroupPropertiesContainer (org.entirej.framework.core.properties.containers.interfaces.EJItemGroupPropertiesContainer)5 EJItemGroupProperties (org.entirej.framework.core.properties.interfaces.EJItemGroupProperties)5 FillLayout (org.eclipse.swt.layout.FillLayout)3 Group (org.eclipse.swt.widgets.Group)3 EJRWTEntireJGridPane (org.entirej.applicationframework.rwt.layout.EJRWTEntireJGridPane)3 Action (org.eclipse.jface.action.Action)2 IAction (org.eclipse.jface.action.IAction)2 ToolBarManager (org.eclipse.jface.action.ToolBarManager)2 Axis (org.eclipse.rap.chartjs.Axis)2 Ticks (org.eclipse.rap.chartjs.Ticks)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 DisposeEvent (org.eclipse.swt.events.DisposeEvent)2 DisposeListener (org.eclipse.swt.events.DisposeListener)2 FocusEvent (org.eclipse.swt.events.FocusEvent)2 KeyEvent (org.eclipse.swt.events.KeyEvent)2 MouseAdapter (org.eclipse.swt.events.MouseAdapter)2 MouseEvent (org.eclipse.swt.events.MouseEvent)2 Cursor (org.eclipse.swt.graphics.Cursor)2 Composite (org.eclipse.swt.widgets.Composite)2 Event (org.eclipse.swt.widgets.Event)2