use of org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties 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);
}
use of org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties in project rap by entirej.
the class EJRWTStandardLovRendererDefinition method addTable.
private EJRWTTableRendererDefinitionControl addTable(EJDevLovDefinitionDisplayProperties lovDisplayProperties, 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);
GridLayout glayout = new GridLayout();
glayout.marginWidth = glayout.marginHeight = 0;
glayout.numColumns = 1;
sc.getBody().setLayout(glayout);
Composite tablePanel = sc.getBody();
Table table = new Table(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
gd.verticalSpan = 6;
gd.horizontalSpan = 2;
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableLayout tableLayout = new TableLayout();
// There is only one item group for a flow layout
Iterator<EJDevItemGroupDisplayProperties> itemGroups = lovDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().iterator();
if (itemGroups.hasNext()) {
EJDevItemGroupDisplayProperties displayProperties = itemGroups.next();
int itemCount = 0;
for (EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
int width = 0;
TableColumn masterColumn = new TableColumn(table, SWT.NONE);
masterColumn.setData("SCREEN_ITEM", screenItem);
masterColumn.setText(screenItem.getLabel());
masterColumn.setWidth(width);
ColumnWeightData colData = new ColumnWeightData(5, 50, true);
tableLayout.addColumnData(colData);
columnPositions.put(screenItem.getReferencedItemName(), itemCount);
itemCount++;
}
}
table.setLayout(tableLayout);
setColumnResizeHook(table, tablePanel);
return new EJRWTTableRendererDefinitionControl(lovDisplayProperties, table, columnPositions);
}
use of org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties in project rap by entirej.
the class EJRWTLookupFormLovRendererDefinition method addTable.
private EJRWTTableRendererDefinitionControl addTable(EJDevLovDefinitionDisplayProperties lovDisplayProperties, 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);
GridLayout glayout = new GridLayout();
glayout.marginWidth = glayout.marginHeight = 0;
glayout.numColumns = 1;
sc.getBody().setLayout(glayout);
Composite tablePanel = sc.getBody();
Table table = new Table(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
// gd.widthHint = 300;
// gd.heightHint = 100;
gd.verticalSpan = 6;
gd.horizontalSpan = 2;
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableLayout tableLayout = new TableLayout();
// There is only one item group for a flow layout
Iterator<EJDevItemGroupDisplayProperties> itemGroups = lovDisplayProperties.getMainScreenItemGroupDisplayContainer().getAllItemGroupDisplayProperties().iterator();
if (itemGroups.hasNext()) {
EJDevItemGroupDisplayProperties displayProperties = itemGroups.next();
int itemCount = 0;
for (EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
int width = 0;
TableColumn masterColumn = new TableColumn(table, SWT.NONE);
masterColumn.setData("SCREEN_ITEM", screenItem);
masterColumn.setText(screenItem.getLabel());
masterColumn.setWidth(width);
ColumnWeightData colData = new ColumnWeightData(5, 50, true);
tableLayout.addColumnData(colData);
columnPositions.put(screenItem.getReferencedItemName(), itemCount);
itemCount++;
}
}
table.setLayout(tableLayout);
setColumnResizeHook(table, tablePanel);
return new EJRWTTableRendererDefinitionControl(lovDisplayProperties, table, columnPositions);
}
use of org.entirej.framework.dev.properties.interfaces.EJDevItemGroupDisplayProperties 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.properties.interfaces.EJDevItemGroupDisplayProperties in project rap by entirej.
the class EJRWTTreeTableRecordBlockDefinition method addTreeTable.
private EJRWTTreeRendererDefinitionControl addTreeTable(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;
}
}
Tree table = new Tree(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableLayout tableLayout = new TableLayout();
// There is only one item group for a flow layout
TreeViewer _tableViewer = new TreeViewer(table);
_tableViewer.setContentProvider(new ITreeContentProvider() {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public boolean hasChildren(Object element) {
return true;
}
@Override
public Object getParent(Object element) {
return null;
}
@Override
public Object[] getElements(Object inputElement) {
return new Object[] { new Object(), new Object(), new Object() };
}
@Override
public Object[] getChildren(Object parentElement) {
return new Object[] { new Object(), new Object() };
}
});
int itemCount = 0;
if (displayProperties != null)
for (final EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
if (!screenItem.isSpacerItem()) {
int width = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties().getIntProperty(EJRWTMultiRecordBlockDefinitionProperties.DISPLAY_WIDTH_PROPERTY, 0);
TreeViewerColumn masterColumn = new TreeViewerColumn(_tableViewer, SWT.NONE);
masterColumn.getColumn().setData("SCREEN_ITEM", screenItem);
masterColumn.getColumn().setText(screenItem.getLabel());
masterColumn.getColumn().setWidth(width);
String alignment = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties().getStringProperty(EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALIGNMENT);
if (EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALLIGN_RIGHT.equals(alignment)) {
masterColumn.getColumn().setAlignment(SWT.RIGHT);
} else if (EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALLIGN_CENTER.equals(alignment)) {
masterColumn.getColumn().setAlignment(SWT.CENTER);
}
masterColumn.setLabelProvider(new ColumnLabelProvider() {
@Override
public String getText(Object element) {
return screenItem.getReferencedItemName();
}
});
ColumnWeightData colData = new ColumnWeightData(5, 50, true);
tableLayout.addColumnData(colData);
columnPositions.put(screenItem.getReferencedItemName(), itemCount);
itemCount++;
}
}
table.setLayout(tableLayout);
_tableViewer.setInput(new Object());
return new EJRWTTreeRendererDefinitionControl(blockDisplayProperties, table, columnPositions);
}
Aggregations