Search in sources :

Example 6 with EJDevItemRendererDefinitionControl

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

the class EJRWTDateTimeItemRendererDefinition method getItemControl.

@Override
public EJDevItemRendererDefinitionControl getItemControl(EJDevScreenItemDisplayProperties itemProperties, Composite parent, FormToolkit toolkit) {
    String type = itemProperties.getBlockItemDisplayProperties().getItemRendererProperties().getStringProperty(PROPERTY_TYPE);
    String details = itemProperties.getBlockItemDisplayProperties().getItemRendererProperties().getStringProperty(PROPERTY_DETAILS);
    int style = SWT.BORDER;
    if (PROPERTY_DETAILS_LONG.equals(details)) {
        style = style | SWT.LONG;
    } else if (PROPERTY_DETAILS_MEDIUM.equals(details)) {
        style = style | SWT.MEDIUM;
    } else if (PROPERTY_DETAILS_SHORT.equals(details)) {
        style = style | SWT.SHORT;
    }
    if (PROPERTY_TYPE_CALENDAR.equals(type)) {
        style = style | SWT.CALENDAR;
    } else if (PROPERTY_TYPE_DATE.equals(type)) {
        style = style | SWT.DATE;
    } else if (PROPERTY_TYPE_TIME.equals(type)) {
        style = style | SWT.TIME;
    }
    if (itemProperties.getBlockItemDisplayProperties().getItemRendererProperties().getBooleanProperty(PROPERTY_DROP_DOWN, false)) {
        style = style | SWT.DROP_DOWN;
    }
    DateTime text = new DateTime(parent, style);
    return new EJDevItemRendererDefinitionControl(itemProperties, text);
}
Also used : EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) DateTime(org.eclipse.swt.widgets.DateTime)

Example 7 with EJDevItemRendererDefinitionControl

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

the class EJRWTListBoxRendererDefinition method getItemControl.

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

Example 8 with EJDevItemRendererDefinitionControl

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

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

the class EJRWTUpdateScreenRendererDefinition method addUpdateScreenControl.

public EJDevScreenRendererDefinitionControl addUpdateScreenControl(EJDevBlockDisplayProperties blockDisplayProperties, Composite parent, FormToolkit formToolkit) {
    int height = blockDisplayProperties.getUpdateScreenRendererProperties().getIntProperty(EJRWTScreenRendererDefinitionProperties.HEIGHT, 300);
    int width = blockDisplayProperties.getUpdateScreenRendererProperties().getIntProperty(EJRWTScreenRendererDefinitionProperties.WIDTH, 300);
    int numcols = blockDisplayProperties.getUpdateScreenRendererProperties().getIntProperty(EJRWTScreenRendererDefinitionProperties.NUM_COLS, 1);
    Composite screen = new Composite(parent, SWT.SHADOW_NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = numcols;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    screen.setLayout(gridLayout);
    GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    gd.widthHint = width;
    gd.heightHint = height;
    screen.setLayoutData(gd);
    EJRWTScreenPreviewerCreator creator = new EJRWTScreenPreviewerCreator();
    List<EJDevItemRendererDefinitionControl> itemControls = creator.addUpdateScreenPreviewControl(this, blockDisplayProperties, screen, formToolkit);
    return new EJDevScreenRendererDefinitionControl(blockDisplayProperties, itemControls);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) EJDevItemRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevItemRendererDefinitionControl) GridData(org.eclipse.swt.layout.GridData) EJDevScreenRendererDefinitionControl(org.entirej.framework.dev.renderer.definition.EJDevScreenRendererDefinitionControl)

Example 10 with EJDevItemRendererDefinitionControl

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

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