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;
}
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);
}
Aggregations