Search in sources :

Example 21 with LabeledText

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

the class SummaryTableGeneral method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    table = (DciSummaryTable) getElement().getAdapter(DciSummaryTable.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = WidgetHelper.OUTER_SPACING;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    menuPath = new LabeledText(dialogArea, SWT.NONE);
    menuPath.setLabel(Messages.get().SummaryTableGeneral_MenuPath);
    menuPath.setText(table.getMenuPath());
    menuPath.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
    title = new LabeledText(dialogArea, SWT.NONE);
    title.setLabel(Messages.get().SummaryTableGeneral_Title);
    title.setText(table.getTitle());
    title.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
    if (table.isTableSoure()) {
        dciName = new LabeledText(dialogArea, SWT.NONE);
        dciName.setLabel("DCI name");
        dciName.getTextControl().setTextLimit(255);
        dciName.setText(table.getTableDciName());
        dciName.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
        importButton = new Button(dialogArea, SWT.PUSH);
        importButton.setText("Import...");
        GridData gd = new GridData();
        gd.verticalAlignment = SWT.BOTTOM;
        gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
        importButton.setLayoutData(gd);
        importButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                selectDci();
            }
        });
    }
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 22 with LabeledText

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

the class EditCommentDialog 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.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
    layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
    dialogArea.setLayout(layout);
    textControl = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    textControl.setLabel(Messages.get().EditCommentDialog_Comment);
    if (noteID != 0)
        textControl.setText(text);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    textControl.setLayoutData(gd);
    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)

Example 23 with LabeledText

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

the class DefaultLoginForm 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);
    parent.setBackground(colors.create(SCREEN_BACKGROUND));
    Composite fillerTop = new Composite(parent, SWT.NONE);
    fillerTop.setBackground(colors.create(SCREEN_BACKGROUND));
    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = false;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.heightHint = 100;
    fillerTop.setLayoutData(gd);
    // 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 = 2;
    layout.marginWidth = 10;
    layout.marginHeight = 10;
    layout.horizontalSpacing = 10;
    layout.verticalSpacing = 10;
    content.setLayout(layout);
    gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalAlignment = SWT.CENTER;
    gd.verticalAlignment = SWT.CENTER;
    content.setLayoutData(gd);
    content.setBackground(colors.create(FORM_BACKGROUND));
    final Image userImage = (properties.getProperty("loginFormImage") != null) ? loadUserImage() : 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.setBackground(colors.create(FORM_BACKGROUND));
    logo.setImage(loginImage);
    logo.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
    Composite loginArea = new Composite(content, SWT.NONE);
    loginArea.setBackground(colors.create(FORM_BACKGROUND));
    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.setBackground(colors.create(FORM_BACKGROUND));
    textLogin.setLabel(Messages.get().LoginForm_UserName);
    textLogin.getTextControl().setData(RWT.CUSTOM_VARIANT, "login");
    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.setBackground(colors.create(FORM_BACKGROUND));
    textPassword.setLabel(Messages.get().LoginForm_Password);
    textPassword.getTextControl().setData(RWT.CUSTOM_VARIANT, "login");
    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.setData(RWT.CUSTOM_VARIANT, "login");
    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.LEFT;
    gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
    gd.verticalIndent = 5;
    okButton.setLayoutData(gd);
    final ImageHyperlink setupLink = new ImageHyperlink(loginArea, SWT.NONE);
    setupLink.setText(Messages.get().LoginForm_Options);
    setupLink.setForeground(colors.create(33, 0, 127));
    gd = new GridData();
    gd.horizontalAlignment = SWT.RIGHT;
    gd.verticalAlignment = SWT.BOTTOM;
    gd.grabExcessVerticalSpace = true;
    setupLink.setLayoutData(gd);
    setupLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkEntered(HyperlinkEvent e) {
            super.linkEntered(e);
            setupLink.setUnderlined(true);
        }

        @Override
        public void linkExited(HyperlinkEvent e) {
            super.linkExited(e);
            setupLink.setUnderlined(false);
        }

        @Override
        public void linkActivated(HyperlinkEvent e) {
            if (advancedSettingsEnabled) {
                LoginSettingsDialog dlg = new LoginSettingsDialog(getShell(), properties);
                dlg.open();
            } else {
                MessageDialog.openError(getShell(), Messages.get().LoginForm_Error, Messages.get().LoginForm_AdvOptionsDisabled);
            }
        }
    });
    content.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent event) {
            loginImage.dispose();
        }
    });
    Composite fillerBottom = new Composite(parent, SWT.NONE);
    fillerBottom.setBackground(colors.create(SCREEN_BACKGROUND));
    fillerBottom.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    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(VERSION_FOREGROUND));
    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) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Canvas(org.eclipse.swt.widgets.Canvas) Label(org.eclipse.swt.widgets.Label) Image(org.eclipse.swt.graphics.Image) DisposeEvent(org.eclipse.swt.events.DisposeEvent) 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) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 24 with LabeledText

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

the class LabelProperties method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (LabelConfig) getElement().getAdapter(LabelConfig.class);
    Composite dialogArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    dialogArea.setLayout(layout);
    title = new LabeledText(dialogArea, SWT.NONE, SWT.BORDER | SWT.MULTI);
    title.setLabel(Messages.get().LabelProperties_Title);
    title.setText(config.getTitle());
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    Composite fgArea = new Composite(dialogArea, SWT.NONE);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    fgArea.setLayoutData(gd);
    RowLayout areaLayout = new RowLayout();
    areaLayout.type = SWT.HORIZONTAL;
    areaLayout.marginBottom = 0;
    areaLayout.marginTop = 0;
    areaLayout.marginLeft = 0;
    areaLayout.marginRight = 0;
    fgArea.setLayout(areaLayout);
    new Label(fgArea, SWT.NONE).setText(Messages.get().LabelProperties_TextColor);
    foreground = new ColorSelector(fgArea);
    foreground.setColorValue(ColorConverter.rgbFromInt(config.getForegroundColorAsInt()));
    Composite bgArea = new Composite(dialogArea, SWT.NONE);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    bgArea.setLayoutData(gd);
    areaLayout = new RowLayout();
    areaLayout.type = SWT.HORIZONTAL;
    areaLayout.marginBottom = 0;
    areaLayout.marginTop = 0;
    areaLayout.marginLeft = 0;
    areaLayout.marginRight = 0;
    bgArea.setLayout(areaLayout);
    new Label(bgArea, SWT.NONE).setText(Messages.get().LabelProperties_BgColor);
    background = new ColorSelector(bgArea);
    background.setColorValue(ColorConverter.rgbFromInt(config.getBackgroundColorAsInt()));
    return dialogArea;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) ColorSelector(org.eclipse.jface.preference.ColorSelector)

Example 25 with LabeledText

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

the class NetworkMap method createContents.

/* (non-Javadoc)
	 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
	 */
@Override
protected Control createContents(Composite parent) {
    config = (NetworkMapConfig) getElement().getAdapter(NetworkMapConfig.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().NetworkMap_NetworkMap);
    objectSelector.setObjectClass(org.netxms.client.objects.NetworkMap.class);
    objectSelector.setObjectId(config.getObjectId());
    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().NetworkMap_Title);
    title.setText(config.getTitle());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    title.setLayoutData(gd);
    Label label = new Label(dialogArea, SWT.NONE);
    label.setText(Messages.get().NetworkMap_ZoomLevel);
    gd = new GridData();
    gd.horizontalSpan = 2;
    label.setLayoutData(gd);
    zoomLevelScale = new Scale(dialogArea, SWT.HORIZONTAL);
    zoomLevelScale.setMinimum(10);
    zoomLevelScale.setMaximum(400);
    zoomLevelScale.setSelection(config.getZoomLevel());
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    zoomLevelScale.setLayoutData(gd);
    zoomLevelScale.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            zoomLevelSpinner.setSelection(zoomLevelScale.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    zoomLevelSpinner = new Spinner(dialogArea, SWT.BORDER);
    zoomLevelSpinner.setMinimum(10);
    zoomLevelSpinner.setMaximum(400);
    zoomLevelSpinner.setSelection(config.getZoomLevel());
    zoomLevelSpinner.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            zoomLevelScale.setSelection(zoomLevelSpinner.getSelection());
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    enableObjectDoubleClick = new Button(dialogArea, SWT.CHECK);
    enableObjectDoubleClick.setText(Messages.get().NetworkMap_EnableDoubleClickAction);
    enableObjectDoubleClick.setSelection(config.isObjectDoubleClickEnabled());
    return dialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) LabeledText(org.netxms.ui.eclipse.widgets.LabeledText) Spinner(org.eclipse.swt.widgets.Spinner) Label(org.eclipse.swt.widgets.Label) Scale(org.eclipse.swt.widgets.Scale) GridLayout(org.eclipse.swt.layout.GridLayout) ObjectSelector(org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

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