use of org.eclipse.swt.custom.ScrolledComposite in project knime-core by knime.
the class NodeUsageComposite method createNodeGrid.
private void createNodeGrid(final SubNodeContainer subNodeContainer, @SuppressWarnings("rawtypes") final Map<NodeIDSuffix, WizardNode> viewNodes) {
ScrolledComposite scrollPane = new ScrolledComposite(this, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
scrollPane.setExpandHorizontal(true);
scrollPane.setExpandVertical(true);
Composite composite = new Composite(scrollPane, SWT.NONE);
scrollPane.setContent(composite);
scrollPane.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
composite.setLayout(new GridLayout(3, false));
composite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false));
// titles
new Composite(composite, SWT.NONE);
/* Placeholder */
Label wizardLabel = new Label(composite, SWT.CENTER);
FontData fontData = wizardLabel.getFont().getFontData()[0];
Font boldFont = new Font(Display.getCurrent(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
wizardLabel.setText("WebPortal /\nWrapped Metanode View");
wizardLabel.setFont(boldFont);
Label dialogLabel = new Label(composite, SWT.CENTER);
dialogLabel.setText("\nWrapped Metanode Dialog");
dialogLabel.setFont(boldFont);
// select all checkboxes
Label selectAllLabel = new Label(composite, SWT.LEFT);
selectAllLabel.setText("Enable/Disable");
Button selectAllWizard = createCheckbox(composite);
Button selectAllDialog = createCheckbox(composite);
// individual nodes
for (@SuppressWarnings("rawtypes") Entry<NodeIDSuffix, WizardNode> entry : viewNodes.entrySet()) {
NodeIDSuffix suffix = entry.getKey();
NodeID id = suffix.prependParent(subNodeContainer.getWorkflowManager().getID());
NodeContainer nodeContainer = viewNodes.containsKey(suffix) ? subNodeContainer.getWorkflowManager().getNodeContainer(id) : null;
createNodeLabelComposite(composite, id, nodeContainer);
@SuppressWarnings("rawtypes") WizardNode model = entry.getValue();
Button wizardButton = createCheckbox(composite);
wizardButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
checkAllSelected(m_wizardUsageMap, selectAllWizard);
}
});
wizardButton.setToolTipText("Enable/disable for usage in WebPortal and wizard execution.");
wizardButton.setSelection(!((WizardNode<?, ?>) model).isHideInWizard());
m_wizardUsageMap.put(id, wizardButton);
if (model instanceof DialogNode) {
Button dialogButton = createCheckbox(composite);
dialogButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
checkAllSelected(m_dialogUsageMap, selectAllDialog);
}
});
dialogButton.setToolTipText("Enable/disable for usage in wrapped metanode configure dialog.");
dialogButton.setSelection(!((DialogNode<?, ?>) model).isHideInDialog());
m_dialogUsageMap.put(id, dialogButton);
} else {
new Composite(composite, SWT.NONE);
/* Placeholder */
}
}
checkAllSelected(m_wizardUsageMap, selectAllWizard);
checkAllSelected(m_dialogUsageMap, selectAllDialog);
selectAllWizard.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
selectAllWizard.setGrayed(false);
for (Button b : m_wizardUsageMap.values()) {
b.setSelection(selectAllWizard.getSelection());
}
}
});
if (m_wizardUsageMap.size() < 1) {
selectAllWizard.setEnabled(false);
}
selectAllDialog.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
selectAllDialog.setGrayed(false);
for (Button b : m_dialogUsageMap.values()) {
b.setSelection(selectAllDialog.getSelection());
}
}
});
if (m_dialogUsageMap.size() < 1) {
selectAllDialog.setEnabled(false);
}
}
use of org.eclipse.swt.custom.ScrolledComposite in project knime-core by knime.
the class PreferredRendererPreferencePage method createFieldEditors.
/**
* {@inheritDoc}
*/
@Override
protected void createFieldEditors() {
Map<String, List<ExtensibleUtilityFactory>> groupedUtilityFactories = new HashMap<String, List<ExtensibleUtilityFactory>>();
// TODO retrieve the utility factories from the data type extension point once we have it
for (ExtensibleUtilityFactory fac : ExtensibleUtilityFactory.getAllFactories()) {
List<ExtensibleUtilityFactory> groupList = groupedUtilityFactories.get(fac.getGroupName());
if (groupList == null) {
groupList = new ArrayList<ExtensibleUtilityFactory>(16);
groupedUtilityFactories.put(fac.getGroupName(), groupList);
}
groupList.add(fac);
}
List<String> groupNames = new ArrayList<String>(groupedUtilityFactories.keySet());
Collections.sort(groupNames);
for (String group : groupNames) {
final Section sectionExpander = new Section(getFieldEditorParent(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
sectionExpander.setText(group);
final Composite section = new Composite(sectionExpander, SWT.NONE);
sectionExpander.setClient(section);
sectionExpander.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(final ExpansionEvent e) {
Composite comp = section;
while (!(comp instanceof ScrolledComposite)) {
comp = comp.getParent();
}
// this is to fix a bug in Eclipse, no scrollbar is shown when this is true
((ScrolledComposite) comp).setExpandVertical(false);
comp = section;
while (!(comp instanceof ScrolledComposite)) {
comp.setSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
comp.layout();
comp = comp.getParent();
}
}
});
List<ExtensibleUtilityFactory> utilityFactories = groupedUtilityFactories.get(group);
Collections.sort(utilityFactories, utilityFactoryComparator);
for (ExtensibleUtilityFactory utilFac : utilityFactories) {
List<DataValueRendererFactory> rendererFactories = new ArrayList<DataValueRendererFactory>(utilFac.getAvailableRenderers());
Collections.sort(rendererFactories, rendererFactoryComparator);
String[][] comboEntries = new String[utilFac.getAvailableRenderers().size()][2];
int i = 0;
for (DataValueRendererFactory rendFac : rendererFactories) {
comboEntries[i++] = new String[] { rendFac.getDescription(), rendFac.getId() };
}
ComboFieldEditor c = new ComboFieldEditor(utilFac.getPreferenceKey(), utilFac.getName(), comboEntries, section);
c.setEnabled(comboEntries.length > 1, section);
addField(c);
m_fieldEditors.put(utilFac.getPreferenceKey(), c);
}
// add a dummy control which occupies the second column so that the next expander is in a new row
new Label(getFieldEditorParent(), SWT.NONE);
}
DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(DataValueRendererFactory.class).getSymbolicName()).addPreferenceChangeListener(this);
}
use of org.eclipse.swt.custom.ScrolledComposite in project eclipse.platform.swt by eclipse.
the class Bug515915_ScrolledCompositeCTabFolder method main.
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
shell.setSize(100, 150);
CTabFolder tabFolder = new CTabFolder(shell, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE);
tabItem.setText("Tab");
ScrolledComposite scroller = new ScrolledComposite(tabFolder, SWT.V_SCROLL | SWT.H_SCROLL);
scroller.setExpandHorizontal(true);
scroller.setExpandVertical(true);
tabItem.setControl(scroller);
Label label = new Label(scroller, SWT.NONE);
label.setText("Label\n with\n a\n tall\n text\n string\n inside\n of\n it.");
label.pack();
scroller.setContent(label);
scroller.setMinSize(label.computeSize(SWT.DEFAULT, SWT.DEFAULT));
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
use of org.eclipse.swt.custom.ScrolledComposite in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_ScrolledComposite method setUp.
@Override
@Before
public void setUp() {
super.setUp();
scrolledComposite = new ScrolledComposite(shell, 0);
setWidget(scrolledComposite);
}
use of org.eclipse.swt.custom.ScrolledComposite in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_ScrolledComposite method test_ConstructorLorg_eclipse_swt_widgets_CompositeI.
@Override
@Test
public void test_ConstructorLorg_eclipse_swt_widgets_CompositeI() {
try {
scrolledComposite = new ScrolledComposite(null, 0);
fail("No exception thrown");
} catch (IllegalArgumentException e) {
}
int[] cases = { SWT.H_SCROLL, SWT.V_SCROLL, SWT.BORDER, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT };
for (int i = 0; i < cases.length; i++) {
scrolledComposite = new ScrolledComposite(shell, cases[i]);
}
}
Aggregations