Search in sources :

Example 1 with EJDevBlockItemDisplayProperties

use of org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties in project rap by entirej.

the class EJRWTLabelItemRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    // toolkit.createText(parent,
    Label text = new Label(parent, SWT.NULL);
    // itemProperties.getLabel(),
    // SWT.NULL);
    text.setText(itemProperties.getLabel());
    EJDevBlockItemDisplayProperties blockItemDisplayProperties = itemProperties.getBlockItemDisplayProperties();
    if (blockItemDisplayProperties != null) {
        EJFrameworkExtensionProperties itemRendererProperties = blockItemDisplayProperties.getItemRendererProperties();
        if (itemRendererProperties != null) {
            String labelAlignment = itemRendererProperties.getStringProperty(PROPERTY_ALIGNMENT);
            if (PROPERTY_ALIGNMENT_LEFT.equals(labelAlignment)) {
                text.setAlignment(SWT.LEFT);
            } else if (PROPERTY_ALIGNMENT_RIGHT.equals(labelAlignment)) {
                text.setAlignment(SWT.RIGHT);
            } else if (PROPERTY_ALIGNMENT_CENTER.equals(labelAlignment)) {
                text.setAlignment(SWT.CENTER);
            }
        }
    }
    return new EJDevItemRendererDefinitionControl(itemProperties, text);
}
Also used : EJFrameworkExtensionProperties(org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties) EJDevBlockItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label)

Example 2 with EJDevBlockItemDisplayProperties

use of org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties in project rap by entirej.

the class EJRWTScreenPreviewerCreator method addItemGroup.

private void addItemGroup(Composite parent, EJRWTScreenRendererDefinition screenRenderer, EJDevBlockDisplayProperties blockDisplayProperties, EJDevItemGroupDisplayProperties itemGroupProperties, FormToolkit toolkit, List<EJDevItemRendererDefinitionControl> itemControls) {
    if (itemGroupProperties.isSeparator()) {
        int style = SWT.SEPARATOR;
        if (itemGroupProperties.getSeparatorOrientation() == EJSeparatorOrientation.HORIZONTAL) {
            style = style | SWT.HORIZONTAL;
        } else {
            style = style | SWT.VERTICAL;
        }
        Label layoutBody = new Label(parent, style);
        layoutBody.setLayoutData(createItemGroupGridData(itemGroupProperties));
        return;
    }
    Composite group = null;
    if (itemGroupProperties.dispayGroupFrame()) {
        if (itemGroupProperties.getFrameTitle() == null) {
            group = new Composite(parent, SWT.SHADOW_NONE);
        } else {
            group = new Group(parent, SWT.SHADOW_ETCHED_IN);
            ((Group) group).setText(itemGroupProperties.getFrameTitle());
        }
    } else {
        group = new Composite(parent, SWT.SHADOW_NONE);
    }
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = itemGroupProperties.getNumCols();
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    group.setLayout(gridLayout);
    group.setLayoutData(createItemGroupGridData(itemGroupProperties));
    ItemCreator itemCreator = new ItemCreator();
    for (EJDevScreenItemDisplayProperties definition : itemGroupProperties.getAllItemDisplayProperties()) {
        if (definition.isSpacerItem()) {
            EJDevItemRendererDefinitionControl control = itemCreator.addSpacerItem(screenRenderer, group, definition, toolkit);
            itemControls.add(control);
        } else {
            EJDevBlockItemDisplayProperties blockItemProperties = blockDisplayProperties.getBlockItemDisplayContainer().getItemProperties(definition.getReferencedItemName());
            EJDevItemRendererDefinitionControl control = itemCreator.createItem(itemGroupProperties.getNumCols(), blockItemProperties, definition, group, toolkit);
            itemControls.add(control);
        }
    }
    for (EJDevItemGroupDisplayProperties subGroup : itemGroupProperties.getChildItemGroupContainer().getAllItemGroupDisplayProperties()) {
        addItemGroup(group, screenRenderer, blockDisplayProperties, subGroup, toolkit, itemControls);
    }
    toolkit.paintBordersFor(group);
}
Also used : Group(org.eclipse.swt.widgets.Group) EJDevItemGroupDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties) GridLayout(org.eclipse.swt.layout.GridLayout) EJDevScreenItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties) Composite(org.eclipse.swt.widgets.Composite) EJDevBlockItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label)

Example 3 with EJDevBlockItemDisplayProperties

use of org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties in project rap by entirej.

the class EJRWTBlockPreviewerCreator method addItemGroup.

private void addItemGroup(Composite parent, EJDevBlockRendererDefinition blockRendererDef, EJDevBlockDisplayProperties blockDisplayProperties, EJDevItemGroupDisplayProperties itemGroupProperties, FormToolkit toolkit, List<EJDevItemRendererDefinitionControl> itemControls) {
    if (itemGroupProperties.isSeparator()) {
        int style = SWT.SEPARATOR;
        if (itemGroupProperties.getSeparatorOrientation() == EJSeparatorOrientation.HORIZONTAL) {
            style = style | SWT.HORIZONTAL;
        } else {
            style = style | SWT.VERTICAL;
        }
        Label layoutBody = new Label(parent, style);
        layoutBody.setLayoutData(createItemGroupGridData(itemGroupProperties));
        return;
    }
    Composite group = null;
    if (itemGroupProperties.dispayGroupFrame()) {
        if (itemGroupProperties.getFrameTitle() == null) {
            group = new Composite(parent, SWT.SHADOW_NONE);
            group.setLayoutData(createItemGroupGridData(itemGroupProperties));
        } else {
            EJFrameworkExtensionProperties rendererProperties = itemGroupProperties.getRendererProperties();
            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.setFont(parent.getFont());
                section.setText(itemGroupProperties.getFrameTitle());
                group = toolkit.createComposite(section);
                section.setLayoutData(createItemGroupGridData(itemGroupProperties));
                section.setClient(group);
            } else {
                group = new Group(parent, SWT.SHADOW_ETCHED_IN);
                ((Group) group).setText(itemGroupProperties.getFrameTitle());
                group.setLayoutData(createItemGroupGridData(itemGroupProperties));
            }
        }
    } else {
        group = new Composite(parent, SWT.SHADOW_NONE);
        group.setLayoutData(createItemGroupGridData(itemGroupProperties));
    }
    // toolkit.adapt(group);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = itemGroupProperties.getNumCols();
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    group.setLayout(gridLayout);
    ItemCreator itemCreator = new ItemCreator();
    for (EJDevScreenItemDisplayProperties definition : itemGroupProperties.getAllItemDisplayProperties()) {
        if (definition.isSpacerItem()) {
            EJDevItemRendererDefinitionControl control = itemCreator.addSpacerItem(blockRendererDef, group, definition, toolkit);
            itemControls.add(control);
        } else {
            EJDevBlockItemDisplayProperties blockItemProperties = blockDisplayProperties.getBlockItemDisplayContainer().getItemProperties(definition.getReferencedItemName());
            if (blockItemProperties == null) {
                throw new IllegalStateException("Unable to retrrieve the blockItemProperties for: " + definition.getBlockName() + ":" + definition.getBlockItemDisplayProperties().getName());
            }
            EJDevItemRendererDefinitionControl control = itemCreator.createItem(itemGroupProperties.getNumCols(), blockItemProperties, (EJDevMainScreenItemDisplayProperties) definition, group, toolkit);
            itemControls.add(control);
        }
    }
    for (EJDevItemGroupDisplayProperties subGroup : itemGroupProperties.getChildItemGroupContainer().getAllItemGroupDisplayProperties()) {
        addItemGroup(group, blockRendererDef, blockDisplayProperties, subGroup, toolkit, itemControls);
    }
    toolkit.paintBordersFor(group);
}
Also used : 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) EJDevBlockItemDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label) Section(org.eclipse.ui.forms.widgets.Section) GridLayout(org.eclipse.swt.layout.GridLayout)

Aggregations

Label (org.eclipse.swt.widgets.Label)3 EJDevBlockItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties)3 EJDevItemRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl)3 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Group (org.eclipse.swt.widgets.Group)2 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)2 EJDevItemGroupDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties)2 EJDevScreenItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1 Section (org.eclipse.ui.forms.widgets.Section)1