use of org.talend.designer.core.ui.views.subjob.SubjobBasicComposite in project tdi-studio-se by Talend.
the class ComponentSettingsView method createDynamicComposite.
/**
* yzhang Comment method "createDynamicComposite".
*
* @param parent
* @param element
* @param category
*/
private void createDynamicComposite(final Composite parent, Element element, EComponentCategory category) {
// DynamicComposite dc = null;
getParentMap().put(ComponentSettingsView.PARENT, parent);
getCategoryMap().put(ComponentSettingsView.CATEGORY, category);
if (element instanceof Node) {
IComponent component = ((Node) element).getComponent();
IGenericWizardService wizardService = null;
boolean generic = false;
if (EComponentType.GENERIC.equals(component.getComponentType())) {
generic = true;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
}
}
tabFactory.getTabbedPropertyComposite().setCompactViewVisible(false);
if (category == EComponentCategory.BASIC) {
// getElementMap().put(ComponentSettingsView.ELEMENT, element);
createButtonListener();
boolean isCompactView = true;
if (ComponentSettingsView.TABLEVIEW.equals(getPreference().getString(TalendDesignerPrefConstants.VIEW_OPTIONS))) {
isCompactView = false;
}
tabFactory.getTabbedPropertyComposite().setCompactViewVisible(true);
tabFactory.getTabbedPropertyComposite().setCompactView(isCompactView);
// Generic
if (generic && wizardService != null) {
Composite composite = wizardService.creatDynamicComposite(parent, element, EComponentCategory.BASIC, true);
if (composite instanceof MultipleThreadDynamicComposite) {
dc = (MultipleThreadDynamicComposite) composite;
}
} else {
dc = new MissingSettingsMultiThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, isCompactView);
}
} else if (category == EComponentCategory.DYNAMICS_SETTINGS) {
dc = new AdvancedContextComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, element);
} else if (category == EComponentCategory.SQL_PATTERN) {
dc = new SQLPatternComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, element);
} else if (category == EComponentCategory.ADVANCED) {
dc = new MissingSettingsMultiThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, true);
// Generic
if (generic && wizardService != null) {
Composite composite = wizardService.creatDynamicComposite(parent, element, EComponentCategory.ADVANCED, true);
if (composite instanceof MultipleThreadDynamicComposite) {
dc = (MultipleThreadDynamicComposite) composite;
}
}
} else {
dc = new MultipleThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, true);
}
} else if (element instanceof Connection) {
dc = new MainConnectionComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element);
} else if (element instanceof Note) {
if (category == EComponentCategory.BASIC) {
if (parent.getLayout() instanceof FillLayout) {
FillLayout layout = (FillLayout) parent.getLayout();
layout.type = SWT.VERTICAL;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.spacing = 0;
}
ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolled.setExpandHorizontal(true);
scrolled.setExpandVertical(true);
scrolled.setMinWidth(600);
scrolled.setMinHeight(400);
Composite composite = tabFactory.getWidgetFactory().createComposite(scrolled);
scrolled.setContent(composite);
composite.setLayout(new FormLayout());
FormData d = new FormData();
d.left = new FormAttachment(0, 0);
d.right = new FormAttachment(100, 0);
d.top = new FormAttachment(0, 0);
d.bottom = new FormAttachment(100, 0);
composite.setLayoutData(d);
AbstractNotePropertyComposite c1 = new BasicNotePropertyComposite(composite, (Note) element, tabFactory);
// AbstractNotePropertyComposite c2 = new TextNotePropertyComposite(composite, (Note) element,
// tabFactory);
// FormData data = new FormData();
// data.top = new FormAttachment(c1.getComposite(), 20, SWT.DOWN);
// data.left = new FormAttachment(0, 0);
// data.right = new FormAttachment(100, 0);
// c2.getComposite().setLayoutData(data);
parent.layout();
}
} else if (element instanceof SubjobContainer) {
if (category == EComponentCategory.BASIC) {
dc = new SubjobBasicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, element);
}
} else {
tabFactory.getTabbedPropertyComposite().setCompactViewVisible(false);
dc = new MultipleThreadDynamicComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, category, element, true);
}
if (parent.getChildren().length == 0) {
if (parent.getLayout() instanceof FillLayout) {
FillLayout layout = (FillLayout) parent.getLayout();
layout.type = SWT.VERTICAL;
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.spacing = 0;
}
Composite composite = tabFactory.getWidgetFactory().createComposite(parent);
composite.setLayout(new FormLayout());
FormData d = new FormData();
d.left = new FormAttachment(2, 0);
d.right = new FormAttachment(100, 0);
d.top = new FormAttachment(5, 0);
d.bottom = new FormAttachment(100, 0);
composite.setLayoutData(d);
Label alertText = new Label(composite, SWT.NONE);
//$NON-NLS-1$
alertText.setText(Messages.getString("ComponentSettingsView.noAdvancedSetting"));
alertText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
parent.layout();
}
if (dc != null) {
dc.refresh();
}
}
Aggregations