Search in sources :

Example 1 with LabeledControl

use of org.netxms.ui.eclipse.widgets.LabeledControl in project netxms by netxms.

the class ObjectToolInputDialog method createDialogArea.

/* (non-Javadoc)
    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
    */
@Override
protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
    dialogArea.setLayout(layout);
    for (int i = 0; i < fields.length; i++) {
        LabeledControl c;
        switch(fields[i].getType()) {
            case NUMBER:
                c = new LabeledSpinner(dialogArea, SWT.NONE);
                break;
            case PASSWORD:
                c = new LabeledText(dialogArea, SWT.NONE, SWT.PASSWORD);
                break;
            default:
                c = new LabeledText(dialogArea, SWT.NONE);
                break;
        }
        c.setLabel(fields[i].getDisplayName());
        GridData gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        gd.widthHint = 300;
        c.setLayoutData(gd);
        controls[i] = c;
    }
    return dialogArea;
}
Also used : LabeledControl(org.netxms.ui.eclipse.widgets.LabeledControl) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData) LabeledSpinner(org.netxms.ui.eclipse.widgets.LabeledSpinner)

Aggregations

GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 LabeledControl (org.netxms.ui.eclipse.widgets.LabeledControl)1 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)1 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)1