/** Updates {@link #labelAppVersion} with current verson information */ private void updateLabelAppVersion() { if (Version.isUpdateAvailable() == null) { if (ConfigurationFactory.getConfigurationFactory().getConfiguration().checkForUpdates()) { labelAppVersion.setToolTipText("Could not get version information."); } } else { if (Version.isUpdateAvailable()) { labelAppVersion.setForeground(SharedStyle.COLOR_RED); labelAppVersion.setText(Version.VERSION_NUMBER + " (Update Available!)"); labelAppVersion.setToolTipText("Click to go to update " + "download page"); labelAppVersion.setCursor(SharedStyle.CURSOR_HAND); labelAppVersion.addMouseListener( new MouseAdapter() { @Override public void mouseUp(final MouseEvent event) { Program.launch(Version.DOWNLOAD_URL); shell.dispose(); } }); } else { labelAppVersion.setText(Version.VERSION_NUMBER); labelAppVersion.setToolTipText("Latest available version!"); labelAppVersion.setForeground(SharedStyle.COLOR_GREEN); } } }
private void updateWlanLibraryStatus() { if (!wlanLibrary.isReady()) { for (Label ssidStatus : toolbarSsidLibraryLabels) { ssidStatus.setText("エラー"); ssidStatus.setForeground(colorRegistry.get(COLOR_NG)); ssidStatus.getParent().getParent().layout(); } } else if (wlanLibrary instanceof WlanProxyLibrary) { for (Label ssidStatus : toolbarSsidLibraryLabels) { ssidStatus.setText("プロキシ"); ssidStatus.setForeground(colorRegistry.get(COLOR_NG)); ssidStatus.getParent().getParent().layout(); } } else if (wlanLibrary.isSSIDEnabled()) { for (Label ssidStatus : toolbarSsidLibraryLabels) { ssidStatus.setText("On"); ssidStatus.setForeground(colorRegistry.get(COLOR_APP_NUMBER)); ssidStatus.getParent().getParent().layout(); } } else { for (Label ssidStatus : toolbarSsidLibraryLabels) { ssidStatus.setText("Off"); ssidStatus.setForeground(colorRegistry.get(COLOR_OK)); ssidStatus.getParent().getParent().layout(); } } }
private void createControls() { Display display = UIUtils.getDisplay(); if (tipShell != null) { return; } tipShell = new Shell(display, SWT.ON_TOP | SWT.TOOL); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; gridLayout.marginWidth = 2; gridLayout.marginHeight = 2; tipShell.setLayout(gridLayout); tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage = new Label(tipShell, SWT.NONE); tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage.setLayoutData( new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); tipLabelText = new Label(tipShell, SWT.NONE); tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelText.setLayoutData( new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); }
/** * setzt den Text des Verifiziert-Labels in Abhängigkeit von b: wenn b true ist, wird der Text in * grün ausgegeben, ansonsten in rot * * @param b gibt an, ob Bob das Ergebnis verifiziert hat oder nicht */ public void setVerifiziert(boolean b) { if (b) { verifiziert.setText(Messages.GParamsBob_3); verifiziert.setForeground(group.getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN)); } else { verifiziert.setText(Messages.GParamsBob_4); verifiziert.setForeground(group.getDisplay().getSystemColor(SWT.COLOR_RED)); } verifiziert.setVisible(true); }
private void createSearchSection(Composite editorComposite, FormToolkit toolkit) { Section section = toolkit.createSection( editorComposite, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); section.setText("Search"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); section.addExpansionListener( new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) { m_sform.reflow(true); } public void expansionStateChanged(ExpansionEvent e) { m_sform.reflow(true); } }); Composite sectionClient = toolkit.createComposite(section); section.setClient(sectionClient); GridLayout layout = new GridLayout(); layout.numColumns = 2; sectionClient.setLayout(layout); sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label_freeSearch = toolkit.createLabel(sectionClient, "Query", SWT.NONE); label_freeSearch.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_freeSearch = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_freeSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); m_text_freeSearch.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); Label label_state = toolkit.createLabel(sectionClient, "State"); label_state.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_news_state = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_news_state.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); try { m_combo_news_state.setItems(FieldDataHelper.getStates()); } catch (Exception e1) { m_combo_news_state.setEnabled(false); label_state.setEnabled(false); } }
private void checkLicense(Composite container, Label validationLabel) { if (ApplicationServerRegistry.get() .checkMobileLicense(companyText.getText(), licenseText.getText())) { validationLabel.setForeground(container.getDisplay().getSystemColor(SWT.COLOR_BLACK)); validationLabel.setText("License OK"); mobileExporter.setSkipConnect(true); } else { validationLabel.setForeground(container.getDisplay().getSystemColor(SWT.COLOR_RED)); validationLabel.setText("License invalid"); mobileExporter.setSkipConnect(false); } container.layout(); }
/** * Creates the Quartz controls. * * @param parent the parent * @param editorStyle true to use the editor style, false for wizards */ public void createControls(final Composite parent, boolean editorStyle) { Label l = SwtFactory.createLabel( parent, Messages.cronExpression, "A CRON expression to schedule service invocations"); if (editorStyle) l.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); this.cronText = SwtFactory.createSimpleTextField(parent, true); Link cronLink = new Link(parent, SWT.NONE); cronLink.setText("<A>" + Messages.cronHelp + "</A>"); cronLink.setLayoutData(new GridData(SWT.RIGHT, SWT.DEFAULT, true, false, 2, 1)); cronLink.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { try { final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser(); browser.openURL( new URL( "http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger")); } catch (Exception ex) { PetalsQuartzPlugin.log(ex, IStatus.ERROR); new ErrorDialog( parent.getShell(), Messages.couldNotOpenEditorTitle, Messages.couldNotOpenEditorMessage, new Status(IStatus.ERROR, PetalsQuartzPlugin.PLUGIN_ID, ex.getMessage()), 0) .open(); } } }); // The message skeleton l = SwtFactory.createLabel( parent, Messages.content, "A XML message to send to the target service"); GridDataFactory.swtDefaults().indent(0, 5).span(2, 1).applyTo(l); if (editorStyle) l.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); this.msgText = SwtFactory.createXmlTextViewer(parent); GridDataFactory.swtDefaults() .align(SWT.FILL, SWT.FILL) .grab(true, true) .span(2, 1) .applyTo(this.msgText.getParent()); }
private void updateLink() { if (meControl != null) { meControl.dispose(); } if (labelWidget != null) { labelWidget.dispose(); } EObject opposite = (EObject) getModelElement().eGet(eReference); if (opposite != null) { MELinkControlFactory meLinkControlFactory = new MELinkControlFactory(); meControl = meLinkControlFactory.createMELinkControl( getItemPropertyDescriptor(), opposite, getModelElement(), getContext()); meControl.createControl( linkArea, style, getItemPropertyDescriptor(), opposite, getModelElement(), getToolkit(), getContext()); } else { labelWidget = getToolkit().createLabel(linkArea, "(Not Set)"); labelWidget.setBackground(parent.getBackground()); labelWidget.setForeground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY)); } linkArea.layout(true); composite.layout(true); }
static void create(final List actions, final Composite actionBar) { Control[] children = actionBar.getChildren(); for (int i = 0; i < children.length; i++) { children[i].dispose(); } actionBar.setLayout(new RowLayout()); Iterator iterator = actions.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (next instanceof Action) { final Action action = (Action) next; new ActionBarButton(action, actionBar); Label separator = new Label(actionBar, SWT.NONE); separator.setText(" "); Label separator2 = new Label(actionBar, SWT.NONE); separator2.setText(" "); Label separator3 = new Label(actionBar, SWT.NONE); separator3.setText(" "); } else { Label separator = new Label(actionBar, SWT.SEPARATOR | SWT.VERTICAL); separator.setForeground(Graphics.getColor(255, 255, 255)); Label separator2 = new Label(actionBar, SWT.NONE); separator2.setText(" "); Label separator3 = new Label(actionBar, SWT.NONE); separator3.setText(" "); } } actionBar.layout(); }
/** Create the title */ private void createTitle() { final Label labelTitle = new Label(this, SWT.NONE); labelTitle.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false)); labelTitle.setFont(this.titleFont); labelTitle.setForeground(this.titleColor); labelTitle.setText(this.title); }
public TagItem(Composite parent, int style, int index, Tag tag, TagPanel parentTagPanel) { super(parent, style); this.tag = tag; this.index = index; this.parentTagPanel = parentTagPanel; FormLayout layout = new FormLayout(); setLayout(layout); imageLabel = new Label(this, SWT.None); imageLabel.setImage(image); FormData data = new FormData(); data.left = new FormAttachment(0, 15); imageLabel.setLayoutData(data); textLabel = new Label(this, SWT.None); textLabel.setText(tag.getName()); int rgb[] = ColorMap.get().getRGB(tag.getColorName()); if (rgb == null) { rgb = ColorMap.get().getRGB("Black"); } unselectedBackground = getBackground(); textLabel.setForeground(new Color(getDisplay(), rgb[0], rgb[1], rgb[2])); data = new FormData(); data.left = new FormAttachment(imageLabel, 5); data.top = new FormAttachment(imageLabel, 0, SWT.CENTER); data.right = new FormAttachment(100, 0); textLabel.setLayoutData(data); imageLabel.addMouseListener(this); textLabel.addMouseListener(this); addMouseListener(this); }
public void setSelected(boolean value, boolean enableNotification) { selected = value; if (selected) { setBackground(selectionBackground); textLabel.setForeground(white); parentTagPanel.addToSelection(this, enableNotification); } else { setBackground(unselectedBackground); int rgb[] = ColorMap.get().getRGB(tag.getColorName()); if (rgb == null) { rgb = ColorMap.get().getRGB("Black"); } textLabel.setForeground(new Color(getDisplay(), rgb[0], rgb[1], rgb[2])); parentTagPanel.removeFromSelection(this, false); } }
protected Composite createWarningComposite(final String text, final int imageType) { final Image image = getShell().getDisplay().getSystemImage(imageType); final Color backgroundColor = getShell().getBackground(); final Color foregroundColor = getShell().getForeground(); final Composite composite = new Composite(getShell(), SWT.NONE); final GridLayout gridLayout = new GridLayout(2, false); composite.setLayout(gridLayout); composite.setBackground(backgroundColor); composite.setForeground(foregroundColor); Composite imageCanvas = new SWTImageCanvas(composite, SWT.NONE, image); imageCanvas.setLayoutData(new GridData(ICONSIZE, ICONSIZE)); imageCanvas.setBackground(backgroundColor); imageCanvas.setForeground(foregroundColor); final Label label = new Label(composite, SWT.NONE); label.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, true, true)); label.setBackground(backgroundColor); label.setForeground(foregroundColor); label.setText(text); return composite; }
protected Composite createMaxOccurComp(Composite parent, FormToolkit toolkit) { fMaxLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_maxOccurLabel); fMaxLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(3, false); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMaxOccurSpinner = new Spinner(comp, SWT.BORDER); fMaxOccurSpinner.setMinimum(1); fMaxOccurSpinner.setMaximum(999); fMaxOccurSpinner.setIncrement(1); fUnboundSelect = toolkit.createButton(comp, PDEUIMessages.AbstractSchemaDetails_unboundedButton, SWT.CHECK); gd = new GridData(); gd.horizontalIndent = 10; fUnboundSelect.setLayoutData(gd); fUnboundSelect.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (blockListeners()) return; fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && isEditableElement()); } }); return comp; }
/** @param form2 */ private Composite getPageHeader(Composite parent) { final Composite header = new Composite(parent, SWT.FILL); final FormLayout layout = new FormLayout(); layout.marginHeight = 5; layout.marginWidth = 5; header.setLayout(layout); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header); header.setBackground(parent.getBackground()); final Label titleImage = new Label(header, SWT.FILL); final ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL( Activator.getDefault().getBundle().getResource("icons/view.png")); // $NON-NLS-1$ titleImage.setImage(new Image(parent.getDisplay(), imageDescriptor.getImageData())); final FormData titleImageData = new FormData(); final int imageOffset = -titleImage.computeSize(SWT.DEFAULT, SWT.DEFAULT).y / 2; titleImageData.top = new FormAttachment(50, imageOffset); titleImageData.left = new FormAttachment(0, 10); titleImage.setLayoutData(titleImageData); final Label title = new Label(header, SWT.WRAP); title.setText("View Editor"); // $NON-NLS-1$ titleFont = new Font(title.getDisplay(), getDefaultFontName(title), 12, SWT.BOLD); title.setFont(titleFont); title.setForeground(getTitleColor(parent)); final FormData titleData = new FormData(); title.setLayoutData(titleData); titleData.left = new FormAttachment(titleImage, 5, SWT.DEFAULT); return header; }
private void createLabel(Composite c, int span, String content, Image image, LabelAttributes la) { if (content == null && image == null) return; Label l = new Label(c, la.getFontStyle()); GridData gd = new GridData(); gd.verticalSpan = span; gd.horizontalIndent = 5; if (content != null) l.setText(content); if (image != null) l.setImage(image); if (la.getForegroundColor() != null) l.setForeground(new Color(DisplayManager.getDefaultDisplay(), la.getForegroundColor())); Font initialFont = l.getFont(); FontData[] fontData = initialFont.getFontData(); for (int i = 0; i < fontData.length; i++) { fontData[i].setHeight(la.getFontSize()); fontData[i].setStyle(la.getFontStyle()); } Font newFont = new Font(DisplayManager.getDefaultDisplay(), fontData[0]); l.setFont(newFont); l.pack(); l.setBackground(c.getBackground()); l.setLayoutData(gd); }
public Composite createForm(Composite parent) { Composite ret = new Composite(parent, SWT.NONE); ret.setLayout(new GridLayout(2, false)); Image img = getImage(); GridData gd1 = null; GridData gd2 = null; Composite cImg = new Composite(ret, SWT.NONE); if (img != null) { cImg.setBackgroundImage(img); gd1 = new GridData(img.getBounds().width, img.getBounds().height); gd2 = new GridData(SWT.DEFAULT, img.getBounds().height); } else { gd1 = new GridData(10, 10); gd2 = new GridData(SWT.DEFAULT, SWT.DEFAULT); } cImg.setLayoutData(gd1); Label lbl = new Label(ret, SWT.NONE); lbl.setLayoutData(gd2); lbl.setText(sticker.getLabel()); lbl.setForeground(UiDesk.getColorFromRGB(sticker.getForeground())); lbl.setBackground(UiDesk.getColorFromRGB(sticker.getBackground())); return ret; }
protected Control createContents(Composite parent) { ViewForm form = new ViewForm(parent, SWT.NONE); form.setSize(400, 290); final Composite shell = new Composite(form.getShell(), SWT.NONE); Label lbApp1 = new Label(shell, SWT.NONE); lbApp1.setText("Version:"); lbApp1.setBounds(10, 10, 50, 20); controls.add(lbApp1); Label lbApp2 = new Label(shell, SWT.NONE); lbApp2.setText("noti-J 1.0"); lbApp2.setBounds(UIUtils.getBoundsH(lbApp1, 10, 100)); controls.add(lbApp2); Label lbStatus1 = new Label(shell, SWT.NONE); lbStatus1.setText("State:"); lbStatus1.setBounds(UIUtils.getBoundsV(lbApp1, 10)); controls.add(lbStatus1); Label lbStatus2 = new Label(shell, SWT.NONE); lbStatus2.setText(connected ? "connected" : "disconnect"); lbStatus2.setForeground( Display.getDefault().getSystemColor(connected ? SWT.COLOR_BLUE : SWT.COLOR_RED)); lbStatus2.setBounds(UIUtils.getBoundsV(lbApp2, 10)); controls.add(lbStatus2); Label lbUser1 = new Label(shell, SWT.NONE); lbUser1.setText("Account:"); lbUser1.setBounds(UIUtils.getBoundsV(lbStatus1, 10)); controls.add(lbUser1); Label lbUser2 = new Label(shell, SWT.NONE); lbUser2.setText(userid + "(" + userName + ")"); lbUser2.setBounds(UIUtils.getBoundsV(lbStatus2, 10)); controls.add(lbUser2); Label lbLic1 = new Label(shell, SWT.NONE); lbLic1.setText("License:"); lbLic1.setBounds(UIUtils.getBoundsV(lbUser1, 10)); controls.add(lbLic1); Label lbLic2 = new Label(shell, SWT.NONE); lbLic2.setText("GPL 3.0"); lbLic2.setBounds(UIUtils.getBoundsV(lbUser2, 10)); controls.add(lbLic2); Label lbDev1 = new Label(shell, SWT.NONE); lbDev1.setText("Author:"); lbDev1.setBounds(UIUtils.getBoundsV(lbLic1, 10)); controls.add(lbDev1); Label lbDev2 = new Label(shell, SWT.NONE); lbDev2.setText("Jong-Bok,Park([email protected])"); lbDev2.setBounds(UIUtils.getBoundsV(lbLic2, 10, 300)); controls.add(lbDev2); Text txError = new Text(shell, SWT.NONE | SWT.WRAP); txError.setText(errorMsg == null ? "" : errorMsg); txError.setBounds(UIUtils.getBoundsV(lbDev1, 10, 300, 100)); txError.setEditable(false); controls.add(txError); controls.add(form); return form; }
private void createLabel(FormToolkit toolkit, Composite composite, String label) { Label portLabel = toolkit.createLabel(composite, label); portLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = 20; data.widthHint = 20; portLabel.setLayoutData(data); }
private Label createLabel(Composite parent, FormToolkit toolkit, Color color, String labelName) { Label label = toolkit.createLabel(parent, labelName); label.setForeground(color); GridData gd = new GridData(); gd.horizontalIndent = 10; label.setLayoutData(gd); return label; }
@PostConstruct public void createComposite(Composite parent) throws IOException { label = new Label(parent, SWT.LEFT); label.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); label.setText(""); // $NON-NLS-1$ parent.addDisposeListener(e -> disposed()); }
private Label createScriptgLabel(Composite parent, String text) { Label label = new Label(parent, SWT.NONE); if (text != null) label.setText(text); label.setBackground(fBackgroundColor); label.setForeground(fForegroundColor); // label.setFont(JFaceResources.getBannerFont()); return label; }
private Label createLabel(Composite parent, String text) { Label label = new Label(parent, SWT.WRAP); if (text != null) label.setText(text); label.setBackground(fBackgroundColor); label.setForeground(fForegroundColor); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false); label.setLayoutData(gd); return label; }
public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_HORIZONTAL); section.setLayoutData(data); section.setText(PDEUIMessages.IntroSection_sectionText); section.setDescription(PDEUIMessages.IntroSection_sectionDescription); boolean canCreateNew = TargetPlatformHelper.getTargetVersion() >= NEW_INTRO_SUPPORT_VERSION; Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, canCreateNew ? 3 : 2)); client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = toolkit.createLabel(client, PDEUIMessages.IntroSection_introLabel, SWT.WRAP); GridData td = new GridData(); td.horizontalSpan = canCreateNew ? 3 : 2; label.setLayoutData(td); Label introLabel = toolkit.createLabel(client, PDEUIMessages.IntroSection_introInput); introLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fIntroCombo = new ComboPart(); fIntroCombo.createControl(client, toolkit, SWT.READ_ONLY); td = new GridData(GridData.FILL_HORIZONTAL); fIntroCombo.getControl().setLayoutData(td); loadManifestAndIntroIds(false); if (fAvailableIntroIds != null) fIntroCombo.setItems(fAvailableIntroIds); fIntroCombo.add(""); // $NON-NLS-1$ fIntroCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleSelection(); } }); if (canCreateNew) { Button button = toolkit.createButton(client, PDEUIMessages.IntroSection_new, SWT.PUSH); button.setEnabled(isEditable()); button.setLayoutData(new GridData(GridData.FILL)); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleNewIntro(); } }); } fIntroCombo.getControl().setEnabled(isEditable()); toolkit.paintBordersFor(client); section.setClient(client); // Register to be notified when the model changes getModel().addModelChangedListener(this); }
protected String layoutBeforeChild( Control control, String labelText, String elementName, Map<String, String> attributes, Composite composite, SwtMetawidget metawidget) { // Add label if (SimpleLayoutUtils.needsLabel(labelText, elementName)) { Label label = new Label(composite, SWT.None); label.setData(NAME, attributes.get(NAME) + LABEL_NAME_SUFFIX); if (mLabelFont != null) { label.setFont(mLabelFont); } if (mLabelForeground != null) { label.setForeground(mLabelForeground); } label.setAlignment(mLabelAlignment); // Required String labelTextToUse = labelText; if (mRequiredText != null && TRUE.equals(attributes.get(REQUIRED)) && !WidgetBuilderUtils.isReadOnly(attributes) && !metawidget.isReadOnly()) { if (mRequiredAlignment == SWT.CENTER) { labelTextToUse += mRequiredText; } else if (mRequiredAlignment == SWT.LEFT) { labelTextToUse = mRequiredText + labelTextToUse; } } if (mLabelSuffix != null) { labelTextToUse += mLabelSuffix; } label.setText(labelTextToUse); GridData labelLayoutData = new GridData(); labelLayoutData.horizontalAlignment = SWT.FILL; labelLayoutData.verticalAlignment = SWT.FILL; label.setLayoutData(labelLayoutData); label.moveAbove(control); } return labelText; }
public static void main(String[] args) throws Exception { final Shell shell = new Shell(); final Display display = shell.getDisplay(); shell.setLayout(new GridLayout(1, false)); final Switch control = new Switch(shell); control.setLayoutData(GridDataFactory.swtDefaults().create()); control.setActiveText("Shown"); control.setActiveBackground(new Color(display, 135, 209, 243)); control.setInactiveBackground(new Color(display, 198, 198, 198)); control.setInactiveText("Hidden"); control.setFont(new Font(display, "Arial", 10, SWT.BOLD)); control.setEnabled(true); control.setSelection(true); final Switch control1 = new Switch(shell); control1.setLayoutData(GridDataFactory.swtDefaults().create()); control1.setActiveText("Shown"); control1.setActiveBackground(new Color(display, 135, 209, 243)); control1.setInactiveBackground(new Color(display, 198, 198, 198)); control1.setInactiveText("Hidden"); control1.setFont(new Font(display, "Arial", 10, SWT.BOLD)); control1.setEnabled(false); control1.setSelection(true); final Switch control2 = new Switch(shell); control2.setLayoutData(GridDataFactory.swtDefaults().create()); control2.setActiveText("Shown"); control2.setActiveBackground(new Color(display, 135, 209, 243)); control2.setInactiveBackground(new Color(display, 198, 198, 198)); control2.setInactiveText("Hidden"); control2.setFont(new Font(display, "Arial", 10, SWT.BOLD)); control2.setEnabled(false); control2.setSelection(false); final RoundedComposite c3 = new RoundedComposite(shell, SWT.LEFT); c3.setBackground(new Color(display, 135, 209, 243)); c3.setLayoutData( GridDataFactory // .swtDefaults() // .hint(SWT.DEFAULT, SWT.DEFAULT) // .create()); final Label label = new Label(c3, SWT.NONE); label.setText("Hi"); label.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); label.setFont(new Font(display, "Arial", 11, SWT.BOLD)); c3.setClient(label); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
private void createStatusBar(Composite parent) { statusComposite = new Composite(parent, SWT.BORDER); statusComposite.setLayout(new GridLayout(2, false)); statusComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false)); statusComposite.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); statusComposite.setForeground(Displays.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); Label imageLabel = new Label(statusComposite, SWT.NONE); imageLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false)); imageLabel.setImage( PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK)); imageLabel.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); imageLabel.setForeground(Displays.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); statusLabel = new Label(statusComposite, SWT.NONE); statusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); statusLabel.setText(""); statusLabel.setBackground(Displays.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); statusLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); }
public SMAEstimatedHoursHeader( Composite parent, int style, final AbstractWorkflowArtifact sma, final SMAEditor editor) { super(parent, style); this.awa = sma; setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false)); setLayout(ALayout.getZeroMarginLayout(2, false)); editor.getToolkit().adapt(this); try { if (!sma.isCancelled() && !sma.isCompleted()) { Hyperlink link = editor.getToolkit().createHyperlink(this, LABEL, SWT.NONE); link.addHyperlinkListener( new IHyperlinkListener() { @Override public void linkEntered(HyperlinkEvent e) { // do nothing } @Override public void linkExited(HyperlinkEvent e) { // do nothing } @Override public void linkActivated(HyperlinkEvent e) { try { if (editor.isDirty()) { editor.doSave(null); } PromptChangeUtil.promptChangeAttribute( sma, AtsAttributeTypes.EstimatedHours, true, false); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }); } else { Label origLabel = editor.getToolkit().createLabel(this, LABEL); origLabel.setLayoutData(new GridData()); } valueLabel = editor.getToolkit().createLabel(this, "0.0"); valueLabel.setToolTipText(getToolTip()); valueLabel.setLayoutData(new GridData()); updateLabel(sma); } catch (OseeCoreException ex) { Label errorLabel = editor.getToolkit().createLabel(this, "Error: " + ex.getLocalizedMessage()); errorLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED)); OseeLog.log(Activator.class, Level.SEVERE, ex); } }
/* (non-Javadoc) * @see IgoOutlinePanel#setFocus(boolean) */ public void setFocus(boolean focused) { isFocused_ = focused; Display display = frame_.getDisplay(); frame_.setBackground( display.getSystemColor(focused ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_BACKGROUND)); annotationLabel_.setBackground( display.getSystemColor(focused ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_BACKGROUND)); annotationLabel_.setForeground( display.getSystemColor( focused ? SWT.COLOR_LIST_SELECTION_TEXT : SWT.COLOR_WIDGET_FOREGROUND)); }
private void createUI() { GridLayoutFactory.swtDefaults().applyTo(this); statusLabel = getToolkit().createLabel(this, "\n\n\n", SWT.CENTER); statusLabel.setFont(UIResources.getDefaultFont(SWT.BOLD)); GridDataFactory.fillDefaults().grab(true, false).applyTo(statusLabel); currentBufferLabel = getToolkit().createLabel(this, TEXT_NO_RUNNING_BUFFER, SWT.NONE); currentBufferLabel.setForeground(getForeground()); currentBufferLabel.setBackground(getBackground()); currentBufferLabel.setFont(UIResources.getDefaultFont(SWT.BOLD)); GridDataFactory.fillDefaults().grab(true, false).applyTo(currentBufferLabel); }