use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class LoginDialog method createDialogArea.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
IDialogSettings settings = Activator.getDefault().getDialogSettings();
toolkit = new FormToolkit(parent.getDisplay());
Form dialogArea = toolkit.createForm(parent);
dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));
applyDialogFont(dialogArea);
GridLayout dialogLayout = new GridLayout();
dialogLayout.numColumns = 2;
dialogLayout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
dialogLayout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
dialogLayout.horizontalSpacing = WidgetHelper.DIALOG_SPACING * 2;
dialogArea.getBody().setLayout(dialogLayout);
RGB customColor = BrandingManager.getInstance().getLoginTitleColor();
labelColor = (customColor != null) ? new Color(dialogArea.getDisplay(), customColor) : new Color(dialogArea.getDisplay(), dialogArea.getBody().getBackground().getRGB());
dialogArea.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
labelColor.dispose();
}
});
// Login image
Label label = new Label(dialogArea.getBody(), SWT.NONE);
label.setBackground(labelColor);
label.setImage(loginImage.createImage());
label.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent event) {
((Label) event.widget).getImage().dispose();
}
});
GridData gd = new GridData();
gd.horizontalAlignment = SWT.CENTER;
gd.verticalAlignment = SWT.TOP;
gd.grabExcessVerticalSpace = true;
label.setLayoutData(gd);
final Composite fields = toolkit.createComposite(dialogArea.getBody());
fields.setBackgroundMode(SWT.INHERIT_DEFAULT);
GridLayout fieldsLayout = new GridLayout();
fieldsLayout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
fieldsLayout.marginHeight = 0;
fieldsLayout.marginWidth = 0;
fields.setLayout(fieldsLayout);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.verticalAlignment = SWT.TOP;
gd.grabExcessVerticalSpace = true;
fields.setLayoutData(gd);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
comboServer = WidgetHelper.createLabeledCombo(fields, SWT.DROP_DOWN, Messages.get().LoginDialog_server, gd, toolkit);
checkSlowLink = new Button(fields, SWT.CHECK);
checkSlowLink.setText(Messages.get().LoginDialog_SlowLinkConnection);
gd = new GridData();
gd.horizontalIndent = 8;
checkSlowLink.setLayoutData(gd);
textLogin = new LabeledText(fields, SWT.NONE, SWT.SINGLE | SWT.BORDER, toolkit);
textLogin.setLabel(Messages.get().LoginDialog_login);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
// $NON-NLS-1$
gd.widthHint = WidgetHelper.getTextWidth(textLogin, "M") * 24;
textLogin.setLayoutData(gd);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
comboAuth = WidgetHelper.createLabeledCombo(fields, SWT.DROP_DOWN | SWT.READ_ONLY, Messages.get().LoginDialog_Auth, gd, toolkit);
comboAuth.add(Messages.get().LoginDialog_Passwd);
comboAuth.add(Messages.get().LoginDialog_Cert);
comboAuth.select(authMethod.getValue());
comboAuth.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectAuthenticationField(true);
}
});
authEntryFields = toolkit.createComposite(fields);
authEntryFields.setLayout(new StackLayout());
authEntryFields.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
textPassword = new LabeledText(authEntryFields, SWT.NONE, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD, toolkit);
textPassword.setLabel(Messages.get().LoginDialog_Passwd);
comboCert = WidgetHelper.createLabeledCombo(authEntryFields, SWT.DROP_DOWN | SWT.READ_ONLY, Messages.get().LoginDialog_Cert, null, toolkit);
comboCert.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectCertificate();
}
});
// Read field data
// $NON-NLS-1$
String[] items = settings.getArray("Connect.ServerHistory");
if (items != null)
comboServer.setItems(items);
// $NON-NLS-1$
String text = settings.get("Connect.Server");
if (text != null)
comboServer.setText(text);
// $NON-NLS-1$
text = settings.get("Connect.Login");
if (text != null)
textLogin.setText(text);
// $NON-NLS-1$
checkSlowLink.setSelection(settings.getBoolean("Connect.SlowLink"));
try {
// $NON-NLS-1$
authMethod = AuthenticationType.getByValue(settings.getInt("Connect.AuthMethod"));
} catch (NumberFormatException e) {
authMethod = AuthenticationType.PASSWORD;
}
comboAuth.select(authMethod.getValue());
selectAuthenticationField(false);
// Set initial focus
if (comboServer.getText().isEmpty()) {
comboServer.setFocus();
} else if (textLogin.getText().isEmpty()) {
textLogin.setFocus();
} else {
if (authMethod == AuthenticationType.PASSWORD)
textPassword.setFocus();
else if (authMethod == AuthenticationType.CERTIFICATE)
comboCert.setFocus();
}
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class PasswordRequestDialog method createDialogArea.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
final Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
container.setLayout(layout);
lblMessage = new Label(container, SWT.NONE | SWT.WRAP);
lblMessage.setText(message);
lblMessage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
textPassword = new LabeledText(container, SWT.NONE, SWT.BORDER | SWT.PASSWORD);
textPassword.setLabel(Messages.get().LoginDialog_Passwd);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.widthHint = 400;
textPassword.setLayoutData(gd);
return container;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class CreateNewCertificateDialog 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;
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(layout);
textFileName = WidgetHelper.createLabeledText(dialogArea, SWT.BORDER, 300, Messages.get().CreateNewCertificateDialog_FileNameLabel, null, WidgetHelper.DEFAULT_LAYOUT_DATA);
browseButton = new Button(dialogArea, SWT.PUSH);
browseButton.setText(Messages.get().CreateNewCertificateDialog_BrowseLabel);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.RIGHT;
gd.widthHint = WidgetHelper.BUTTON_WIDTH_HINT;
browseButton.setLayoutData(gd);
browseButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
fd.setText(Messages.get().CreateNewCertificateDialog_SelectFileHeader);
String selected = fd.open();
if (selected != null)
textFileName.setText(selected);
}
});
textComments = new LabeledText(dialogArea, SWT.MULTI);
textComments.setLabel(Messages.get().CreateNewCertificateDialog_CertificateCommentLabel);
GridData gdText = new GridData();
gdText.horizontalAlignment = SWT.FILL;
gdText.horizontalSpan = 2;
gdText.grabExcessHorizontalSpace = true;
textComments.setLayoutData(gdText);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class EditCertificateDialog 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;
layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
dialogArea.setLayout(layout);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.widthHint = 300;
textId = new LabeledText(dialogArea, SWT.NONE);
textId.setEditable(false);
textId.setLabel(Messages.get().EditCertificateDialog_CertIDLabel);
textId.setText(Long.toString(cert.getId()));
textId.setLayoutData(gd);
comboType = WidgetHelper.createLabeledCombo(dialogArea, SWT.READ_ONLY, Messages.get().EditCertificateDialog_CertTypeLabel, WidgetHelper.DEFAULT_LAYOUT_DATA);
String[] options = { Messages.get().EditCertificateDialog_CertType_AC, Messages.get().EditCertificateDialog_CertType_UC };
comboType.add(options[cert.getType()]);
comboType.select(0);
textSubject = new LabeledText(dialogArea, SWT.NONE);
textSubject.setEditable(false);
textSubject.setLabel(Messages.get().EditCertificateDialog_CertSubjectLabel);
textSubject.setText(cert.getSubject());
textSubject.setLayoutData(gd);
textComments = new LabeledText(dialogArea, SWT.NONE);
textComments.setLabel(Messages.get().EditCertificateDialog_CertCommentLabel);
textComments.setText(cert.getComments());
textComments.setLayoutData(gd);
return dialogArea;
}
use of org.netxms.ui.eclipse.widgets.LabeledText in project netxms by netxms.
the class EventMonitor method createContents.
@Override
protected Control createContents(Composite parent) {
config = (EventMonitorConfig) getElement().getAdapter(EventMonitorConfig.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;
}
Aggregations