use of org.eclipse.ui.forms.widgets.TableWrapData in project netxms by netxms.
the class NetworkDiscoveryConfigurator method createFilterSection.
/**
* Create "Filter" section
*/
private void createFilterSection() {
Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR);
section.setText(Messages.get().NetworkDiscoveryConfigurator_SectionFilter);
section.setDescription(Messages.get().NetworkDiscoveryConfigurator_SectionFilterDescr);
TableWrapData td = new TableWrapData();
td.align = TableWrapData.FILL;
td.grabHorizontal = true;
section.setLayoutData(td);
Composite clientArea = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
clientArea.setLayout(layout);
section.setClient(clientArea);
final SelectionListener radioButtonListener = new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
updateElementEnablement();
setModified();
if (radioFilterOff.getSelection()) {
config.setFilter(NetworkDiscovery.FILTER_NONE);
} else if (radioFilterAuto.getSelection()) {
config.setFilter(NetworkDiscovery.FILTER_AUTO);
} else {
config.setFilter(filterScript.getScriptName());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
final SelectionListener checkBoxListener = new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
setModified();
int flags = 0;
if (checkAgentOnly.getSelection())
flags |= NetworkDiscovery.FILTER_ALLOW_AGENT;
if (checkSnmpOnly.getSelection())
flags |= NetworkDiscovery.FILTER_ALLOW_SNMP;
if (checkRangeOnly.getSelection())
flags |= NetworkDiscovery.FILTER_LIMIT_BY_RANGE;
config.setFilterFlags(flags);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
};
radioFilterOff = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_NoFiltering, SWT.RADIO);
radioFilterOff.addSelectionListener(radioButtonListener);
radioFilterCustom = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_CustomScript, SWT.RADIO);
radioFilterCustom.addSelectionListener(radioButtonListener);
filterScript = new ScriptSelector(clientArea, SWT.NONE, true, false);
toolkit.adapt(filterScript);
filterScript.getTextControl().setBackground(clientArea.getBackground());
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.horizontalIndent = 20;
filterScript.setLayoutData(gd);
filterScript.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if (radioFilterCustom.getSelection()) {
setModified();
config.setFilter(filterScript.getScriptName());
}
}
});
radioFilterAuto = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AutoScript, SWT.RADIO);
radioFilterAuto.addSelectionListener(radioButtonListener);
checkAgentOnly = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AcceptAgent, SWT.CHECK);
checkAgentOnly.addSelectionListener(checkBoxListener);
gd = new GridData();
gd.horizontalIndent = 20;
checkAgentOnly.setLayoutData(gd);
checkSnmpOnly = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AcceptSNMP, SWT.CHECK);
checkSnmpOnly.addSelectionListener(checkBoxListener);
gd = new GridData();
gd.horizontalIndent = 20;
checkSnmpOnly.setLayoutData(gd);
checkRangeOnly = toolkit.createButton(clientArea, Messages.get().NetworkDiscoveryConfigurator_AcceptRange, SWT.CHECK);
checkRangeOnly.addSelectionListener(checkBoxListener);
gd = new GridData();
gd.horizontalIndent = 20;
checkRangeOnly.setLayoutData(gd);
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project liferay-ide by liferay.
the class FormEntry method _fillIntoGrid.
private void _fillIntoGrid(Composite parent, int indent, int tcolspan) {
Layout layout = parent.getLayout();
int tspan;
if (layout instanceof GridLayout) {
int span = ((GridLayout) layout).numColumns;
if (tcolspan > 0) {
tspan = tcolspan;
} else {
tspan = _fBrowse != null ? span - 2 : span - 1;
}
GridData gd;
if (_fLabel != null) {
gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
gd.horizontalIndent = indent;
_fLabel.setLayoutData(gd);
}
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = tspan;
if (_fLabel != null) {
gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
}
gd.grabExcessHorizontalSpace = tspan == 1;
gd.widthHint = 10;
_fText.setLayoutData(gd);
if (_fBrowse != null) {
gd = new GridData(GridData.VERTICAL_ALIGN_CENTER);
_fBrowse.setLayoutData(gd);
}
} else if (layout instanceof TableWrapLayout) {
int span = ((TableWrapLayout) layout).numColumns;
if (tcolspan > 0) {
tspan = tcolspan;
} else {
tspan = _fBrowse != null ? span - 2 : span - 1;
}
TableWrapData td;
if (_fLabel != null) {
td = new TableWrapData();
td.valign = TableWrapData.MIDDLE;
td.indent = indent;
_fLabel.setLayoutData(td);
}
td = new TableWrapData(TableWrapData.FILL);
td.colspan = tspan;
if (_fLabel != null) {
td.indent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
}
td.grabHorizontal = tspan == 1;
td.valign = TableWrapData.MIDDLE;
_fText.setLayoutData(td);
if (_fBrowse != null) {
td = new TableWrapData(TableWrapData.FILL);
td.valign = TableWrapData.MIDDLE;
_fBrowse.setLayoutData(td);
}
}
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project titan.EclipsePlug-ins by eclipse.
the class StatisticalView method createPartControl.
/**
* This is a callback that will allow us to create the viewer and
* initialize it.
*/
@Override
public void createPartControl(final Composite parent) {
List<StatisticalData> statisticalData = restoreState();
createToolbar();
createStatisticalViewContextMenuActions();
toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createScrolledForm(parent);
// $NON-NLS-1$
form.setText("Statistics");
TableWrapLayout layout = new TableWrapLayout();
form.getBody().setLayout(layout);
TableWrapData td = new TableWrapData();
td.colspan = 2;
layout.numColumns = 2;
toolkit.paintBordersFor(form.getBody());
if (statisticalData != null) {
setData(statisticalData);
}
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project jbosstools-hibernate by jbosstools.
the class RevEngOverviewPage method createContentsSection.
private void createContentsSection() {
String sectionTitle;
sectionTitle = MapperMessages.RevEngOverviewPage_contents;
Section section = createStaticSection(getManagedForm().getToolkit(), getManagedForm().getForm().getBody(), sectionTitle);
Composite container = getManagedForm().getToolkit().createComposite(section, SWT.NONE);
TableWrapLayout layout = new TableWrapLayout();
layout.leftMargin = layout.rightMargin = layout.topMargin = layout.bottomMargin = 0;
container.setLayout(layout);
container.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
FormText text = createClient(container, MapperMessages.RevEngOverviewPage_the_content, getManagedForm().getToolkit());
// text.setImage("page", EclipseImages.getImage(ImageConstants.)); //$NON-NLS-1$
section.setClient(container);
// section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
// section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL,GridData.FILL_VERTICAL));
// getManagedForm().addPart(s);
}
use of org.eclipse.ui.forms.widgets.TableWrapData in project jbosstools-hibernate by jbosstools.
the class RevEngOverviewPage method createClient.
private FormText createClient(Composite section, String content, FormToolkit toolkit) {
FormText text = toolkit.createFormText(section, true);
try {
text.setText(content, true, false);
} catch (SWTException e) {
text.setText(e.getMessage(), false, false);
}
section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
text.addHyperlinkListener(new IHyperlinkListener() {
public void linkEntered(HyperlinkEvent e) {
}
public void linkExited(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
String href = (String) e.getHref();
getEditor().setActivePage(href);
}
});
return text;
}
Aggregations