Search in sources :

Example 11 with EJDevItemRendererDefinitionControl

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

the class EJRWTSingleRecordBlockDefinition method getSpacerItemControl.

@Override
public EJDevItemRendererDefinitionControl getSpacerItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    int style = SWT.NULL;
    if (itemProperties.isSeparator()) {
        style = SWT.SEPARATOR;
        if (itemProperties.getSeparatorOrientation() == EJSeparatorOrientation.HORIZONTAL) {
            style = style | SWT.HORIZONTAL;
        } else {
            style = style | SWT.VERTICAL;
        }
    }
    Label text = new Label(parent, style);
    return new EJDevItemRendererDefinitionControl(itemProperties, text);
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label)

Example 12 with EJDevItemRendererDefinitionControl

use of org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl 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)

Example 13 with EJDevItemRendererDefinitionControl

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

the class EJRWTScreenRendererDefinition method getSpacerItemControl.

public EJDevItemRendererDefinitionControl getSpacerItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    int style = SWT.NULL;
    if (itemProperties.isSeparator()) {
        style = SWT.SEPARATOR;
        if (itemProperties.getSeparatorOrientation() == EJSeparatorOrientation.HORIZONTAL) {
            style = style | SWT.HORIZONTAL;
        } else {
            style = style | SWT.VERTICAL;
        }
    }
    Label text = new Label(parent, style);
    return new EJDevItemRendererDefinitionControl(itemProperties, text);
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Label(org.eclipse.swt.widgets.Label)

Example 14 with EJDevItemRendererDefinitionControl

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

the class EJRWTComboBoxRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    Combo combo = new Combo(parent, SWT.DROP_DOWN);
    combo.add("Value 1");
    combo.add("Value 2");
    combo.add("Value 3");
    return new EJDevItemRendererDefinitionControl(itemProperties, combo);
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Combo(org.eclipse.swt.widgets.Combo)

Example 15 with EJDevItemRendererDefinitionControl

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

the class EJRWTImageItemRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    Text text = new Text(parent, SWT.NULL);
    text.setText("IMAGE");
    text.setEditable(false);
    EJDevItemRendererDefinitionControl definitionControl = new EJDevItemRendererDefinitionControl(itemProperties, text);
    definitionControl.setUseFontDimensions(false);
    return definitionControl;
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) Text(org.eclipse.swt.widgets.Text)

Aggregations

EJDevItemRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl)19 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 Label (org.eclipse.swt.widgets.Label)5 Group (org.eclipse.swt.widgets.Group)4 Text (org.eclipse.swt.widgets.Text)4 GridData (org.eclipse.swt.layout.GridData)3 Button (org.eclipse.swt.widgets.Button)3 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)3 EJDevBlockItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevBlockItemDisplayProperties)3 EJDevScreenRendererDefinitionControl (org.entirej.framework.dev.renderer.definition.EJDevScreenRendererDefinitionControl)3 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 Section (org.eclipse.ui.forms.widgets.Section)2 EJPropertyDefinitionGroup (org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup)2 EJDevPropertyDefinitionGroup (org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup)2 EJDevItemGroupDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties)2 EJDevScreenItemDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevScreenItemDisplayProperties)2 ArrayList (java.util.ArrayList)1 MouseListener (org.eclipse.swt.events.MouseListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1