use of org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController in project tdi-studio-se by Talend.
the class MainConnectionComposite method addComponents.
@Override
public void addComponents(boolean forceRedraw) {
if (conSchema()) {
disposeChildren();
curRowSize = 0;
List<? extends IElementParameter> listParam = ((Connection) elem).getSource().getElementParameters();
generator.initController(this);
for (IElementParameter cur : listParam) {
if (cur.getCategory() == this.section) {
if ((cur.getFieldType() == EParameterFieldType.SCHEMA_TYPE || cur.getFieldType() == EParameterFieldType.SCHEMA_REFERENCE) && (cur.getContext().equals(((Connection) elem).getConnectorName()))) {
AbstractElementPropertySectionController contorller = generator.getController(EParameterFieldType.SCHEMA_TYPE, this);
contorller.createControl(composite, cur, 1, 1, 0, null);
}
}
}
if (((Connection) elem).getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
IMetadataTable outputMetaTable = ((Connection) elem).getMetadataTable();
if (outputMetaTable != null && this.section == EComponentCategory.BASIC) {
// Composite compositeEditorView = new Composite(composite, SWT.BORDER);
// compositeEditorView.setLayoutData(data);
metadataTableEditor = new MetadataTableEditor(outputMetaTable, //$NON-NLS-1$
"Schema from " + ((Connection) elem).getSource().getElementName() + //$NON-NLS-1$
" output ");
metadataTableEditorView = new MetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, true, false, true, false);
MetadataDialog.initializeMetadataTableView(metadataTableEditorView, ((Connection) elem).getSource(), outputMetaTable);
metadataTableEditorView.initGraphicComponents();
metadataTableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
CustomTableManager.addCustomManagementToTable(metadataTableEditorView, true);
Composite compositeEditorView = metadataTableEditorView.getMainComposite();
Table table = metadataTableEditorView.getTable();
FormData data = new FormData();
data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(0, curRowSize + ITabbedPropertyConstants.VSPACE);
// to correct bug of table growing indefinitly
data.width = 300;
/*
* On windows it will adjust automatically the size depends the number of columns. Seems this system
* doesn't work on linux
*/
// fix bug 3893.
int tableHeight = 160;
int maxTableHeight = table.getHeaderHeight() + 22 * table.getItemHeight();
int rows = outputMetaTable.getListColumns().size();
int currentHeightEditor = table.getHeaderHeight() + rows * table.getItemHeight() + 50;
if (currentHeightEditor > tableHeight) {
tableHeight = currentHeightEditor;
}
if (currentHeightEditor > maxTableHeight) {
tableHeight = maxTableHeight;
}
// fix bug 3893.
data.height = tableHeight;
compositeEditorView.setLayoutData(data);
// compositeEditorView.getParent().layout();
// Table table = metadataTableEditorView.getTable();
// int currentHeightEditor = table.getHeaderHeight() + outputMetaTable.getListColumns().size()
// * table.getItemHeight() + table.getItemHeight() + 50;
curRowSize = tableHeight + ITabbedPropertyConstants.VSPACE + curRowSize;
}
}
super.addComponents(forceRedraw, false, curRowSize);
} else if (conIf()) {
super.addComponents(forceRedraw);
} else if (resumingIf()) {
super.addComponents(forceRedraw);
} else {
disposeChildren();
}
}
use of org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController in project tdi-studio-se by Talend.
the class MainConnectionSection method addComponents.
@Override
public void addComponents(boolean forceRedraw) {
if (conSchema()) {
disposeChildren();
curRowSize = 0;
List<? extends IElementParameter> listParam = ((Connection) elem).getSource().getElementParameters();
generator.initController(this);
for (IElementParameter cur : listParam) {
if ((cur.getFieldType() == EParameterFieldType.SCHEMA_TYPE || cur.getFieldType() == EParameterFieldType.SCHEMA_REFERENCE) && (cur.getContext().equals(((Connection) elem).getConnectorName()))) {
AbstractElementPropertySectionController contorller = generator.getController(EParameterFieldType.SCHEMA_TYPE, this);
contorller.createControl(composite, cur, 0, 0, 0, null);
}
}
FormData data = new FormData();
data.left = new FormAttachment(0, ITabbedPropertyConstants.HSPACE);
data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(0, curRowSize + ITabbedPropertyConstants.VSPACE);
// to correct bug of table growing indefinitly
data.width = 300;
IMetadataTable outputMetaTable = ((Connection) elem).getMetadataTable();
if (outputMetaTable != null) {
// Composite compositeEditorView = new Composite(composite, SWT.BORDER);
// compositeEditorView.setLayoutData(data);
metadataTableEditor = new MetadataTableEditor(outputMetaTable, //$NON-NLS-1$
"Schema from " + ((Connection) elem).getSource().getElementName() + //$NON-NLS-1$
" output ");
metadataTableEditorView = new MetadataTableEditorView(composite, SWT.NONE, metadataTableEditor, true, false, true, false);
MetadataDialog.initializeMetadataTableView(metadataTableEditorView, ((Connection) elem).getSource(), outputMetaTable);
metadataTableEditorView.initGraphicComponents();
metadataTableEditorView.getExtendedTableViewer().setCommandStack(getCommandStack());
CustomTableManager.addCustomManagementToTable(metadataTableEditorView, true);
Composite compositeEditorView = metadataTableEditorView.getMainComposite();
compositeEditorView.setLayoutData(data);
// compositeEditorView.getParent().layout();
Table table = metadataTableEditorView.getTable();
int currentHeightEditor = table.getHeaderHeight() + outputMetaTable.getListColumns().size() * table.getItemHeight() + table.getItemHeight() + 50;
curRowSize = currentHeightEditor + ITabbedPropertyConstants.VSPACE + curRowSize;
}
super.addComponents(forceRedraw, false);
} else if (conIf()) {
super.addComponents(forceRedraw);
} else {
disposeChildren();
}
}
Aggregations