Search in sources :

Example 1 with EJDevBlockRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.

the class EJRWTTreeRecordBlockDefinition method addBlockControlToCanvas.

@Override
public EJDevBlockRendererDefinitionControl addBlockControlToCanvas(EJMainScreenProperties mainScreenProperties, EJDevBlockDisplayProperties blockDisplayProperties, Composite parent, FormToolkit toolkit) {
    EJFrameworkExtensionProperties rendererProperties = blockDisplayProperties.getBlockRendererProperties();
    if (blockDisplayProperties != null) {
        rendererProperties = rendererProperties.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
    }
    Composite layoutBody;
    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;
        }
        String title = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
        Section section = toolkit.createSection(parent, style);
        if (title != null)
            section.setText(title);
        section.setFont(parent.getFont());
        section.setForeground(parent.getForeground());
        if (mainScreenProperties.getDisplayFrame()) {
            layoutBody = new Group(section, SWT.NONE);
            layoutBody.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
            if (mainScreenProperties.getFrameTitle() != null)
                ((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
        } else {
            layoutBody = toolkit.createComposite(section);
        }
        section.setClient(layoutBody);
    } else {
        if (mainScreenProperties.getDisplayFrame()) {
            layoutBody = new Group(parent, SWT.NONE);
            if (mainScreenProperties.getFrameTitle() != null)
                ((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
        } else {
            layoutBody = new Composite(parent, SWT.NONE);
        }
    }
    layoutBody.setLayout(new FillLayout());
    EJDevItemGroupDisplayProperties displayProperties = null;
    if (blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().size() > 0) {
        displayProperties = blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().iterator().next();
    }
    StringBuilder builder = new StringBuilder();
    if (displayProperties != null)
        for (EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
            if (!screenItem.isSpacerItem()) {
                EJFrameworkExtensionProperties properties = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties();
                String prefix = properties.getStringProperty(EJRWTTreeBlockDefinitionProperties.ITEM_PREFIX);
                if (prefix != null) {
                    builder.append(prefix);
                }
                builder.append(screenItem.getReferencedItemName());
                String sufix = properties.getStringProperty(EJRWTTreeBlockDefinitionProperties.ITEM_SUFFIX);
                if (sufix != null) {
                    builder.append(sufix);
                }
            }
        }
    String tag = builder.toString();
    if (tag.length() == 0) {
        tag = "<empty>";
    }
    final Tree browser = new Tree(layoutBody, SWT.BORDER);
    for (int i = 0; i < 4; i++) {
        TreeItem iItem = new TreeItem(browser, 0);
        iItem.setText(tag + " " + (i + 1));
        for (int j = 0; j < 4; j++) {
            TreeItem jItem = new TreeItem(iItem, 0);
            jItem.setText(tag + " " + (j + 1));
        }
    }
    return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, Collections.<EJDevItemRendererDefinitionControl>emptyList());
}
Also used : EJDevPropertyDefinitionGroup(org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup) EJPropertyDefinitionGroup(org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup) Group(org.eclipse.swt.widgets.Group) EJDevItemGroupDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJDevScreenItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TreeItem(org.eclipse.swt.widgets.TreeItem) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) EJDevBlockRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl) Tree(org.eclipse.swt.widgets.Tree)

Example 2 with EJDevBlockRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.

the class EJRWTLineChartRecordBlockDefinition method addTreeTable.

private EJDevBlockRendererDefinitionControl addTreeTable(EJDevBlockDisplayProperties blockDisplayProperties, Composite client, FormToolkit toolkit) {
    Label label = new Label(client, SWT.NONE);
    label.setText("Line Chart");
    return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, Collections.<EJDevItemRendererDefinitionControl>emptyList());
}
Also used : EJDevBlockRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label)

Example 3 with EJDevBlockRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.

the class EJRWTPieChartRecordBlockDefinition method addTreeTable.

private EJDevBlockRendererDefinitionControl addTreeTable(EJDevBlockDisplayProperties blockDisplayProperties, Composite client, FormToolkit toolkit) {
    Label label = new Label(client, SWT.NONE);
    label.setText("Pie Chart");
    return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, Collections.<EJDevItemRendererDefinitionControl>emptyList());
}
Also used : EJDevBlockRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label)

Example 4 with EJDevBlockRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.

the class EJRWTPieChartRecordBlockDefinition method addBlockControlToCanvas.

@Override
public EJDevBlockRendererDefinitionControl addBlockControlToCanvas(EJMainScreenProperties mainScreenProperties, EJDevBlockDisplayProperties blockDisplayProperties, Composite parent, FormToolkit toolkit) {
    EJFrameworkExtensionProperties rendererProperties = blockDisplayProperties.getBlockRendererProperties();
    if (blockDisplayProperties != null) {
        rendererProperties = rendererProperties.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
    }
    Composite layoutBody;
    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;
        }
        String title = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
        Section section = toolkit.createSection(parent, style);
        if (title != null)
            section.setText(title);
        section.setFont(parent.getFont());
        section.setForeground(parent.getForeground());
        if (mainScreenProperties.getDisplayFrame()) {
            layoutBody = new Group(section, SWT.NONE);
            layoutBody.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
            if (mainScreenProperties.getFrameTitle() != null)
                ((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
        } else {
            layoutBody = toolkit.createComposite(section);
        }
        section.setClient(layoutBody);
    } else {
        if (mainScreenProperties.getDisplayFrame()) {
            layoutBody = new Group(parent, SWT.NONE);
            if (mainScreenProperties.getFrameTitle() != null)
                ((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
        } else {
            layoutBody = new Composite(parent, SWT.NONE);
        }
    }
    layoutBody.setLayout(new GridLayout(mainScreenProperties.getNumCols(), false));
    EJDevBlockRendererDefinitionControl control = addTreeTable(blockDisplayProperties, layoutBody, toolkit);
    return control;
}
Also used : EJDevPropertyDefinitionGroup(org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup) EJPropertyDefinitionGroup(org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup) Group(org.eclipse.swt.widgets.Group) EJDevBlockRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Section(org.eclipse.ui.forms.widgets.Section)

Example 5 with EJDevBlockRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.

the class EJRWTSingleRecordBlockDefinition method addBlockControlToCanvas.

@Override
public EJDevBlockRendererDefinitionControl addBlockControlToCanvas(EJMainScreenProperties mainScreenProperties, EJDevBlockDisplayProperties blockDisplayProperties, Composite parent, FormToolkit toolkit) {
    EJFrameworkExtensionProperties rendererProperties = blockDisplayProperties.getBlockRendererProperties();
    if (blockDisplayProperties != null) {
        rendererProperties = rendererProperties.getPropertyGroup(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR);
    }
    Composite layoutBody;
    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;
        }
        String title = rendererProperties.getStringProperty(EJRWTSingleRecordBlockDefinitionProperties.ITEM_GROUP_TITLE_BAR_TITLE);
        Section section = toolkit.createSection(parent, style);
        if (title != null)
            section.setText(title);
        section.setFont(parent.getFont());
        section.setForeground(parent.getForeground());
        if (mainScreenProperties.getDisplayFrame()) {
            layoutBody = new Group(section, SWT.NONE);
            layoutBody.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
            if (mainScreenProperties.getFrameTitle() != null)
                ((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
        } else {
            layoutBody = toolkit.createComposite(section);
        }
        section.setClient(layoutBody);
    } else {
        if (mainScreenProperties.getDisplayFrame()) {
            layoutBody = new Group(parent, SWT.NONE);
            if (mainScreenProperties.getFrameTitle() != null)
                ((Group) layoutBody).setText(mainScreenProperties.getFrameTitle());
        } else {
            layoutBody = new Composite(parent, SWT.NONE);
        }
    }
    layoutBody.setLayout(new GridLayout(mainScreenProperties.getNumCols(), false));
    EJRWTBlockPreviewerCreator creator = new EJRWTBlockPreviewerCreator();
    List<EJDevItemRendererDefinitionControl> itemControls = creator.addBlockPreviewControl(this, blockDisplayProperties, layoutBody, toolkit);
    return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, itemControls);
}
Also used : EJDevPropertyDefinitionGroup(org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup) EJPropertyDefinitionGroup(org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup) Group(org.eclipse.swt.widgets.Group) EJDevBlockRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl) EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Section(org.eclipse.ui.forms.widgets.Section)

Aggregations

EJDevBlockRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl)9 Composite (org.eclipse.swt.widgets.Composite)6 Group (org.eclipse.swt.widgets.Group)6 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)6 EJPropertyDefinitionGroup (org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup)6 EJDevPropertyDefinitionGroup (org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup)6 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)5 Section (org.eclipse.ui.forms.widgets.Section)5 GridLayout (org.eclipse.swt.layout.GridLayout)4 Label (org.eclipse.swt.widgets.Label)4 FillLayout (org.eclipse.swt.layout.FillLayout)2 EJDevItemGroupDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties)2 EJDevScreenItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties)2 Browser (org.eclipse.swt.browser.Browser)1 Font (org.eclipse.swt.graphics.Font)1 Tree (org.eclipse.swt.widgets.Tree)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 EJDevBlockDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevBlockDisplayProperties)1 EJDevItemRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl)1