use of org.entirej.framework.dev.properties.interfaces.EJDevMainScreenItemDisplayProperties 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);
}
use of org.entirej.framework.dev.properties.interfaces.EJDevMainScreenItemDisplayProperties in project rap by entirej.
the class EJRWTMultiRecordBlockDefinition 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(true);
table.setLinesVisible(true);
TableLayout tableLayout = new TableLayout();
// There is only one item group for a flow layout
int itemCount = 0;
if (displayProperties != null)
for (EJDevScreenItemDisplayProperties screenItem : displayProperties.getAllItemDisplayProperties()) {
if (!screenItem.isSpacerItem()) {
int width = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties().getIntProperty(EJRWTMultiRecordBlockDefinitionProperties.DISPLAY_WIDTH_PROPERTY, 0);
TableColumn masterColumn = new TableColumn(table, SWT.NONE);
masterColumn.setData("SCREEN_ITEM", screenItem);
masterColumn.setText(screenItem.getLabel());
masterColumn.setWidth(width);
String alignment = ((EJDevMainScreenItemDisplayProperties) screenItem).getBlockRendererRequiredProperties().getStringProperty(EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALIGNMENT);
if (EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALLIGN_RIGHT.equals(alignment)) {
masterColumn.setAlignment(SWT.RIGHT);
} else if (EJRWTMultiRecordBlockDefinitionProperties.COLUMN_ALLIGN_CENTER.equals(alignment)) {
masterColumn.setAlignment(SWT.CENTER);
}
ColumnWeightData colData = new ColumnWeightData(5, 50, true);
tableLayout.addColumnData(colData);
columnPositions.put(screenItem.getReferencedItemName(), itemCount);
itemCount++;
}
}
table.setLayout(tableLayout);
return new EJRWTTableRendererDefinitionControl(blockDisplayProperties, table, columnPositions);
}
Aggregations