Search in sources :

Example 1 with EJRWTTableRendererDefinitionControl

use of org.entirej.applicationframework.rwt.renderers.block.definition.EJRWTTableRendererDefinitionControl in project rap by entirej.

the class EJRWTListRecordBlockDefinition method addBlockControlToCanvas.

@Override
public EJRWTTableRendererDefinitionControl 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));
    EJRWTTableRendererDefinitionControl control = addTable(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) EJRWTTableRendererDefinitionControl(org.entirej.applicationframework.rwt.renderers.block.definition.EJRWTTableRendererDefinitionControl) 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 2 with EJRWTTableRendererDefinitionControl

use of org.entirej.applicationframework.rwt.renderers.block.definition.EJRWTTableRendererDefinitionControl in project rap by entirej.

the class EJRWTListRecordBlockDefinition method addTable.

private EJRWTTableRendererDefinitionControl addTable(EJDevBlockDisplayProperties blockDisplayProperties, Composite client, FormToolkit toolkit) {
    Map<String, Integer> columnPositions = new HashMap<String, Integer>();
    final ScrolledForm sc = toolkit.createScrolledForm(client);
    GridData scgd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    scgd.grabExcessHorizontalSpace = true;
    scgd.grabExcessVerticalSpace = true;
    sc.setLayoutData(scgd);
    GridLayout gl = new GridLayout();
    gl.marginHeight = gl.marginWidth = 0;
    sc.getBody().setLayout(gl);
    toolkit.adapt(sc);
    sc.getBody().setLayout(new FillLayout());
    Composite tablePanel = sc.getBody();
    EJDevItemGroupDisplayProperties displayProperties = null;
    if (blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().size() > 0) {
        displayProperties = blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().iterator().next();
        if (displayProperties.dispayGroupFrame()) {
            Group group = new Group(tablePanel, SWT.NONE);
            group.setLayout(new FillLayout());
            if (displayProperties.getFrameTitle() != null && displayProperties.getFrameTitle().length() > 0)
                group.setText(displayProperties.getFrameTitle());
            tablePanel = group;
        }
    }
    Table table = new Table(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    table.setHeaderVisible(false);
    table.setLinesVisible(true);
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    return new EJRWTTableRendererDefinitionControl(blockDisplayProperties, table, columnPositions);
}
Also used : EJDevItemGroupDisplayProperties(org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties) EJDevPropertyDefinitionGroup(org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup) EJPropertyDefinitionGroup(org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup) Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HashMap(java.util.HashMap) FillLayout(org.eclipse.swt.layout.FillLayout) EJRWTTableRendererDefinitionControl(org.entirej.applicationframework.rwt.renderers.block.definition.EJRWTTableRendererDefinitionControl) GridLayout(org.eclipse.swt.layout.GridLayout) ScrolledForm(org.eclipse.ui.forms.widgets.ScrolledForm) GridData(org.eclipse.swt.layout.GridData) TableLayout(org.eclipse.jface.viewers.TableLayout)

Aggregations

GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Group (org.eclipse.swt.widgets.Group)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 EJRWTTableRendererDefinitionControl (org.entirej.applicationframework.rwt.renderers.block.definition.EJRWTTableRendererDefinitionControl)2 EJPropertyDefinitionGroup (org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup)2 EJDevPropertyDefinitionGroup (org.entirej.framework.dev.properties.EJDevPropertyDefinitionGroup)2 HashMap (java.util.HashMap)1 TableLayout (org.eclipse.jface.viewers.TableLayout)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 GridData (org.eclipse.swt.layout.GridData)1 Table (org.eclipse.swt.widgets.Table)1 ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)1 Section (org.eclipse.ui.forms.widgets.Section)1 EJFrameworkExtensionProperties (org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties)1 EJDevItemGroupDisplayProperties (org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties)1