Search in sources :

Example 6 with LabeledText

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

the class ObjectStatusChart method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (ObjectStatusChartConfig) getElement().getAdapter(ObjectStatusChartConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, false);
    objectSelector.setLabel(Messages.get().ObjectStatusChart_RootObject);
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getRootObject());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().ObjectStatusChart_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().ObjectStatusChart_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    optionsGroup.setLayoutData(gd);
    GridLayout optionsLayout = new GridLayout();
    optionsGroup.setLayout(optionsLayout);
    checkShowLegend = new Button(optionsGroup, SWT.CHECK);
    checkShowLegend.setText(Messages.get().ObjectStatusChart_ShowLegend);
    checkShowLegend.setSelection(config.isShowLegend());
    checkShow3D = new Button(optionsGroup, SWT.CHECK);
    checkShow3D.setText(Messages.get().ObjectStatusChart_3DView);
    checkShow3D.setSelection(config.isShowIn3D());
    checkTransposed = new Button(optionsGroup, SWT.CHECK);
    checkTransposed.setText(Messages.get().ObjectStatusChart_Transposed);
    checkTransposed.setSelection(config.isTransposed());
    checkTranslucent = new Button(optionsGroup, SWT.CHECK);
    checkTranslucent.setText(Messages.get().ObjectStatusChart_Translucent);
    checkTranslucent.setSelection(config.isTranslucent());
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    refreshRate = WidgetHelper.createLabeledSpinner(dialogArea, SWT.BORDER, Messages.get().ObjectStatusChart_RefreshInterval, 1, 10000, gd);
    refreshRate.setSelection(config.getRefreshRate());
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 7 with LabeledText

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

the class SnmpTrapMonitor method createContents.

@Override
protected Control createContents(Composite parent) {
    config = (SnmpTrapMonitorConfig) getElement().getAdapter(SnmpTrapMonitorConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    objectSelector.setLabel("Root object");
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getObjectId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel("Title");
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) GridData(org.eclipse.swt.layout.GridData)

Example 8 with LabeledText

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

the class StatusMap method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (StatusMapConfig) getElement().getAdapter(StatusMapConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    dialogArea.setLayout(layout);
    objectSelector = new ObjectSelector(dialogArea, SWT.NONE, true);
    objectSelector.setLabel(Messages.get().AlarmViewer_RootObject);
    objectSelector.setObjectClass(AbstractObject.class);
    objectSelector.setObjectId(config.getObjectId());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    objectSelector.setLayoutData(gd);
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().AlarmViewer_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    title.setLayoutData(gd);
    Group severityGroup = new Group(dialogArea, SWT.NONE);
    severityGroup.setText(Messages.get().StatusMap_SeverityFilter);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    severityGroup.setLayoutData(gd);
    layout = new GridLayout();
    layout.numColumns = 4;
    layout.makeColumnsEqualWidth = true;
    severityGroup.setLayout(layout);
    checkSeverity = new Button[7];
    for (int severity = 6; severity >= 0; severity--) {
        checkSeverity[severity] = new Button(severityGroup, SWT.CHECK);
        checkSeverity[severity].setText(StatusDisplayInfo.getStatusText(severity));
        checkSeverity[severity].setSelection((config.getSeverityFilter() & (1 << severity)) != 0);
    }
    Group optionsGroup = new Group(dialogArea, SWT.NONE);
    optionsGroup.setText(Messages.get().StatusMap_Options);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    optionsGroup.setLayoutData(gd);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = true;
    optionsGroup.setLayout(layout);
    checkGroupObjects = new Button(optionsGroup, SWT.CHECK);
    checkGroupObjects.setText(Messages.get().StatusMap_Group);
    checkGroupObjects.setSelection(config.isGroupObjects());
    checkShowFilter = new Button(optionsGroup, SWT.CHECK);
    checkShowFilter.setText(Messages.get().StatusMap_ShowFilter);
    checkShowFilter.setSelection(config.isShowTextFilter());
    checkRadial = new Button(optionsGroup, SWT.CHECK);
    checkRadial.setText("Show in radial form");
    checkRadial.setSelection(config.isShowRadial());
    return dialogArea;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 9 with LabeledText

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

the class DefaultMobileLoginForm method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    colors = new ColorCache(parent);
    Rectangle displayBounds = parent.getDisplay().getPrimaryMonitor().getBounds();
    boolean isLandscape = displayBounds.width > displayBounds.height;
    System.out.println(">>>> " + displayBounds.width + " x " + displayBounds.height + " DPI=" + parent.getDisplay().getDPI());
    // $NON-NLS-1$
    final Font headerFont = new Font(parent.getDisplay(), "Verdana", 18, SWT.BOLD);
    parent.setBackground(colors.create(255, 255, 255));
    // SWT.NO_FOCUS is a workaround for Eclipse/RAP bug 321274
    final Canvas content = new Canvas(parent, SWT.NO_FOCUS);
    GridLayout layout = new GridLayout();
    layout.numColumns = isLandscape ? 2 : 1;
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    layout.horizontalSpacing = 10;
    layout.verticalSpacing = 10;
    content.setLayout(layout);
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = SWT.CENTER;
    gd.verticalAlignment = SWT.CENTER;
    content.setLayoutData(gd);
    content.setBackground(parent.getBackground());
    Label title = new Label(content, SWT.CENTER);
    final String customTitle = BrandingManager.getInstance().getLoginTitle();
    title.setText((customTitle != null) ? customTitle : Messages.get().LoginForm_Title);
    title.setFont(headerFont);
    title.setForeground(colors.create(57, 33, 89));
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = layout.numColumns;
    title.setLayoutData(gd);
    Image userImage = null;
    try {
        // $NON-NLS-1$
        ImageDescriptor d = ImageDescriptor.createFromURL(new URL("http://127.0.0.1/netxms_login.dat"));
        if (d != null)
            userImage = d.createImage(false);
    } catch (Exception e) {
        Activator.logError("Exception while reading custom image", e);
        userImage = null;
    }
    final ImageDescriptor customImage = BrandingManager.getInstance().getLoginTitleImage();
    // $NON-NLS-1$
    final Image loginImage = (userImage != null) ? userImage : ((customImage != null) ? customImage.createImage() : Activator.getImageDescriptor("icons/login.png").createImage());
    Label logo = new Label(content, SWT.NONE);
    logo.setImage(loginImage);
    logo.setLayoutData(isLandscape ? new GridData(SWT.LEFT, SWT.TOP, false, true) : new GridData(SWT.CENTER, SWT.TOP, true, false));
    Composite loginArea = new Composite(content, SWT.NONE);
    layout = new GridLayout();
    loginArea.setLayout(layout);
    gd = new GridData();
    gd.widthHint = 300;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessVerticalSpace = true;
    loginArea.setLayoutData(gd);
    textLogin = new LabeledText(loginArea, SWT.NONE);
    textLogin.setLabel(Messages.get().LoginForm_UserName);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textLogin.setLayoutData(gd);
    textPassword = new LabeledText(loginArea, SWT.NONE, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    textPassword.setLabel(Messages.get().LoginForm_Password);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    textPassword.setLayoutData(gd);
    Button okButton = new Button(loginArea, SWT.PUSH);
    okButton.setText(Messages.get().LoginForm_LoginButton);
    okButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            okPressed();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    gd = new GridData();
    gd.horizontalAlignment = SWT.RIGHT;
    gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
    gd.verticalIndent = 5;
    okButton.setLayoutData(gd);
    content.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent event) {
            loginImage.dispose();
            headerFont.dispose();
        }
    });
    Label version = new Label(parent, SWT.NONE);
    version.setText(String.format(Messages.get().LoginForm_Version, NXCommon.VERSION + " (" + BuildNumber.TEXT + ")"));
    version.setBackground(parent.getBackground());
    version.setForeground(colors.create(32, 32, 32));
    gd = new GridData();
    gd.horizontalAlignment = SWT.RIGHT;
    gd.verticalAlignment = SWT.BOTTOM;
    version.setLayoutData(gd);
    getShell().setDefaultButton(okButton);
    textLogin.getTextControl().setFocus();
    return content;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ColorCache(org.netxms.ui.eclipse.tools.ColorCache) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Canvas(org.eclipse.swt.widgets.Canvas) Rectangle(org.eclipse.swt.graphics.Rectangle) Label(org.eclipse.swt.widgets.Label) Image(org.eclipse.swt.graphics.Image) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Font(org.eclipse.swt.graphics.Font) URL(java.net.URL) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 10 with LabeledText

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

the class SetEntryEditDialog 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);
    textName = new LabeledText(dialogArea, SWT.NONE);
    textName.setLabel("Key");
    textName.getTextControl().setTextLimit(256);
    if (pStorageKey != null) {
        textName.setText(pStorageKey);
    }
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = 300;
    textName.setLayoutData(gd);
    textName.setEditable(!isSet || isNew);
    if (isSet) {
        textValue = new LabeledText(dialogArea, SWT.NONE);
        textValue.setLabel("Value");
        if (pStorageValue != null)
            textValue.setText(pStorageValue);
        gd = new GridData();
        gd.horizontalAlignment = SWT.FILL;
        gd.grabExcessHorizontalSpace = true;
        textValue.setLayoutData(gd);
        if (pStorageKey != null)
            textValue.setFocus();
    }
    return dialogArea;
}
Also used : 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)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)104 LabeledText (org.netxms.ui.eclipse.widgets.LabeledText)104 GridLayout (org.eclipse.swt.layout.GridLayout)103 GridData (org.eclipse.swt.layout.GridData)102 Button (org.eclipse.swt.widgets.Button)50 SelectionEvent (org.eclipse.swt.events.SelectionEvent)37 SelectionListener (org.eclipse.swt.events.SelectionListener)31 Group (org.eclipse.swt.widgets.Group)24 ObjectSelector (org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector)22 Label (org.eclipse.swt.widgets.Label)18 RowLayout (org.eclipse.swt.layout.RowLayout)11 Spinner (org.eclipse.swt.widgets.Spinner)11 ModifyEvent (org.eclipse.swt.events.ModifyEvent)9 ModifyListener (org.eclipse.swt.events.ModifyListener)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 LabeledSpinner (org.netxms.ui.eclipse.widgets.LabeledSpinner)8 ColorSelector (org.eclipse.jface.preference.ColorSelector)6 DisposeEvent (org.eclipse.swt.events.DisposeEvent)6 DisposeListener (org.eclipse.swt.events.DisposeListener)6 WidgetFactory (org.netxms.ui.eclipse.tools.WidgetFactory)6