use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.
the class EJRWTTreeRecordBlockDefinition 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 FillLayout());
EJDevItemGroupDisplayProperties displayProperties = null;
if (blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().size() > 0) {
displayProperties = blockDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().iterator().next();
}
StringBuilder builder = new StringBuilder();
if (displayProperties != null)
for (EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
if (!screenItem.isSpacerItem()) {
EJFrameworkExtensionProperties properties = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties();
String prefix = properties.getStringProperty(EJRWTTreeBlockDefinitionProperties.ITEM_PREFIX);
if (prefix != null) {
builder.append(prefix);
}
builder.append(screenItem.getReferencedItemName());
String sufix = properties.getStringProperty(EJRWTTreeBlockDefinitionProperties.ITEM_SUFFIX);
if (sufix != null) {
builder.append(sufix);
}
}
}
String tag = builder.toString();
if (tag.length() == 0) {
tag = "<empty>";
}
final Tree browser = new Tree(layoutBody, SWT.BORDER);
for (int i = 0; i < 4; i++) {
TreeItem iItem = new TreeItem(browser, 0);
iItem.setText(tag + " " + (i + 1));
for (int j = 0; j < 4; j++) {
TreeItem jItem = new TreeItem(iItem, 0);
jItem.setText(tag + " " + (j + 1));
}
}
return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, Collections.<EJDevItemRendererDefinitionControl>emptyList());
}
use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.
the class EJRWTLineChartRecordBlockDefinition method addTreeTable.
private EJDevBlockRendererDefinitionControl addTreeTable(EJDevBlockDisplayProperties blockDisplayProperties, Composite client, FormToolkit toolkit) {
Label label = new Label(client, SWT.NONE);
label.setText("Line Chart");
return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, Collections.<EJDevItemRendererDefinitionControl>emptyList());
}
use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.
the class EJRWTPieChartRecordBlockDefinition method addTreeTable.
private EJDevBlockRendererDefinitionControl addTreeTable(EJDevBlockDisplayProperties blockDisplayProperties, Composite client, FormToolkit toolkit) {
Label label = new Label(client, SWT.NONE);
label.setText("Pie Chart");
return new EJDevBlockRendererDefinitionControl(blockDisplayProperties, Collections.<EJDevItemRendererDefinitionControl>emptyList());
}
use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl in project rap by entirej.
the class EJRWTPieChartRecordBlockDefinition 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));
EJDevBlockRendererDefinitionControl control = addTreeTable(blockDisplayProperties, layoutBody, toolkit);
return control;
}
use of org.entirej.framework.dev.renderer.definition.EJDevBlockRendererDefinitionControl 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);
}
Aggregations