List of usage examples for org.eclipse.jface.resource JFaceResources getHeaderFont
public static Font getHeaderFont()
From source file:org.eclipse.ui.texteditor.InfoForm.java
License:Open Source License
private Label createHeader(Composite parent, String text) { Label label = new Label(parent, SWT.NONE); GridData data = new GridData(GridData.FILL_HORIZONTAL); label.setLayoutData(data);/*from w ww. ja v a 2 s.c om*/ if (text != null) label.setText(text); label.setBackground(fBackgroundColor); label.setForeground(fForegroundColor); label.setFont(JFaceResources.getHeaderFont()); return label; }
From source file:org.iatrix.widgets.JournalHeader.java
License:Open Source License
/** * The main SWT for the journal header//from w w w . j a va 2s .c o m * @param formBody */ public JournalHeader(Composite formBody) { tk = UiDesk.getToolkit(); formBody.setLayout(new GridLayout(1, true)); Composite formHeader = new Composite(formBody, SWT.NONE); tk.adapt(formHeader); formHeader.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); formHeader.setLayout(new GridLayout(3, false)); GridData gd; formTitel = tk.createHyperlink(formHeader, "Iatrix KG", SWT.WRAP); // set font formTitel.setFont(JFaceResources.getHeaderFont()); formTitel.setText("Kein Patient ausgewhlt"); formTitel.setEnabled(false); formTitel.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { if (actPat != null) { try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView(PatientDetailView2.ID); } catch (Exception ex) { ExHandler.handle(ex); log.error("Fehler beim ffnen von PatientDetailView: " + ex.getMessage()); } } } }); Composite patInfoArea = tk.createComposite(formHeader); gd = SWTHelper.getFillGridData(1, true, 1, false); patInfoArea.setLayoutData(gd); GridLayout infoLayout = new GridLayout(2, false); // save space infoLayout.horizontalSpacing = 5; infoLayout.verticalSpacing = 0; infoLayout.marginWidth = 0; infoLayout.marginHeight = 0; patInfoArea.setLayout(infoLayout); remarkLabel = tk.createLabel(patInfoArea, ""); gd = new GridData(SWT.LEFT, SWT.TOP, false, false); remarkLabel.setLayoutData(gd); remarkLabel.setBackground(patInfoArea.getDisplay().getSystemColor(SWT.COLOR_YELLOW)); remarkLabel.setToolTipText("Bemerkung kann via Doppelclick gendert werden"); remarkLabel.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { openRemarkEditorDialog(); } }); cEtiketten = new Composite(patInfoArea, SWT.NONE); cEtiketten.setLayout(new RowLayout(SWT.HORIZONTAL)); cEtiketten.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); cEtiketten.setBackground(patInfoArea.getBackground()); Composite kontoArea = tk.createComposite(formHeader); gd = new GridData(SWT.END, SWT.CENTER, true, false); kontoArea.setLayoutData(gd); GridLayout gridLayout = new GridLayout(2, false); // save space gridLayout.horizontalSpacing = 5; gridLayout.verticalSpacing = 0; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; kontoArea.setLayout(gridLayout); Hyperlink kontoHyperlink = tk.createHyperlink(kontoArea, "Kontostand:", SWT.NONE); kontoHyperlink.setData("TEST_COMP_NAME", "KG_Iatrix_acount_balance_hl"); // for Jubula kontoHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { if (actPat != null) { try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView(AccountView.ID); } catch (Exception ex) { ExHandler.handle(ex); log.error("Fehler beim ffnen von AccountView: " + ex.getMessage()); } } } }); kontoLabel = tk.createLabel(kontoArea, "", SWT.RIGHT); gd = SWTHelper.getFillGridData(1, true, 1, false); gd.verticalAlignment = GridData.END; kontoLabel.setLayoutData(gd); kontoLabelColor = kontoLabel.getForeground(); Hyperlink openBillsHyperlink = tk.createHyperlink(kontoArea, "Rechnungsbersicht", SWT.NONE); openBillsHyperlink.setData("TEST_COMP_NAME", "KG_Iatrix_account_overview_hl"); // for Jubula openBillsHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { if (actPat != null) { try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView(BillSummary.ID); } catch (Exception ex) { ExHandler.handle(ex); log.error("Fehler beim ffnen von AccountView: " + ex.getMessage()); } } } }); openBillsHyperlink.setLayoutData(SWTHelper.getFillGridData(2, true, 1, false)); formTitel.getParent().layout(); }
From source file:org.iatrix.widgets.KonsHeader.java
License:Open Source License
public KonsHeader(Composite konsultationComposite) { tk = UiDesk.getToolkit();//from w w w . ja va2 s. co m konsFallArea = tk.createComposite(konsultationComposite); konsFallArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); konsFallArea.setLayout(new GridLayout(4, false)); hlKonsultationDatum = new EnhancedDatePickerCombo(konsFallArea, SWT.NONE, new EnhancedDatePickerCombo.ExecuteIfValidInterface() { @Override public void doIt() { String new_date = new TimeTool(hlKonsultationDatum.getDate().getTime()) .toString(TimeTool.DATE_GER); if (actKons != null && !actKons.getDatum().equals(new_date)) { log.info("fire EVENT_UPDATE from hlKonsultationDatum " + actKons.getDatum() + " => " + new_date); actKons.setDatum(new_date, false); JournalView.updateAllKonsAreas(actKons.getFall().getPatient(), actKons, KonsActions.EVENT_UPDATE); ElexisEventDispatcher.getInstance() .fire(new ElexisEvent(actKons, Konsultation.class, ElexisEvent.EVENT_UPDATE)); setKonsDate(); } } }); hlKonsultationDatum.setToolTipText("Datum der Konsultation ndern"); hlKonsultationDatum.setFont(JFaceResources.getHeaderFont()); if (actKons != null) { actKons.setDatum(hlKonsultationDatum.getText(), false); } hlMandant = tk.createHyperlink(konsFallArea, StringTool.leer, SWT.NONE); hlMandant.setText("--"); //$NON-NLS-1$ hlMandant.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { KontaktSelektor ksl = new KontaktSelektor( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Mandant.class, "Mandant auswhlen", "Auf wen soll diese Kons verrechnet werden?", new String[] { Mandant.FLD_SHORT_LABEL, Mandant.FLD_NAME1, Mandant.FLD_NAME2 }); if (ksl.open() == Dialog.OK) { actKons.setMandant((Mandant) ksl.getSelection()); setKons(actPat, actKons, KonsActions.ACTIVATE_KONS); } } }); String autherOverride = "Ersteller der Konsultation berschreiben"; hlAuthor = tk.createHyperlink(konsFallArea, StringTool.leer, SWT.NONE); hlAuthor.setText("--"); //$NON-NLS-1$ hlAuthor.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { if (actKons != null) { VersionedResource resource = actKons.getEintrag(); if (resource != null) { ResourceItem item = resource.getVersion(resource.getHeadVersion()); int version = resource.getHeadVersion(); String actUser = CoreHub.actUser.getLabel(); String actLabel = actKons.getLabel(); String actAuthor = actKons.getAuthor(); if (MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), autherOverride, String.format("Wollen Sie wirklich fr die aktuelle Konsultation %s mit der " + "Version %s den aktuellen Ersteller (%s) durch Sie (%s)\nberschreiben? (Keine Wirkung im Moment)", actLabel, version, actAuthor, actUser))) { // setKonsAuthor(actKons, actUser); // JournalView.updateAllKonsAreas(actKons.getFall().getPatient(), actKons, KonsActions.ACTIVATE_KONS); } } } } }); Composite fallArea = tk.createComposite(konsFallArea); // GridData gd = SWTHelper.getFillGridData(1, false, 1, false); // gd.horizontalAlignment = SWT.RIGHT; GridData gd = new GridData(SWT.RIGHT, SWT.TOP, true, false); fallArea.setLayoutData(gd); fallArea.setLayout(new GridLayout(2, false)); cbLabel = tk.createLabel(fallArea, "Fall:"); cbFall = new Combo(fallArea, SWT.SINGLE | SWT.READ_ONLY); cbFall.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); cbFall.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Fall[] faelle = (Fall[]) cbFall.getData(); int i = cbFall.getSelectionIndex(); Fall nFall = faelle[i]; Fall actFall = actKons.getFall(); if (!nFall.getId().equals(actFall.getId())) { MessageDialog msd = new MessageDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Fallzuordnung ndern", Images.IMG_LOGO.getImage(), "Mchten Sie diese Behandlung vom Fall:\n'" + actFall.getLabel() + "' zum Fall:\n'" + nFall.getLabel() + "' transferieren?", MessageDialog.QUESTION, new String[] { "Ja", "Nein" }, 0); if (msd.open() == 0) { // TODO check compatibility of assigned problems actKons.setFall(nFall); setKons(actPat, actKons, KonsActions.ACTIVATE_KONS); } } } }); tk.adapt(cbFall); cbFall.setEnabled(false); }
From source file:org.jboss.tools.common.model.ui.widgets.DefaultSettings.java
License:Open Source License
protected void initFonts() { defaultFont = JFaceResources.getDefaultFont(); headerFont = JFaceResources.getBannerFont(); titleFont = JFaceResources.getHeaderFont(); }
From source file:org.kalypso.contribs.eclipse.ui.forms.ToolkitUtils.java
License:Open Source License
/** * Same as {@link FormToolkit#createScrolledForm(Composite)}, but allows to specify which style to use.<br/> * {@link ScrolledForm#setExpandXXXX} is called depending on which style bits are set. *//*from ww w.j a va2 s .co m*/ public static ScrolledForm createScrolledForm(final FormToolkit toolkit, final Composite parent, final int style) { final ScrolledForm form = new ScrolledForm(parent, SWT.V_SCROLL | SWT.H_SCROLL | toolkit.getOrientation()); form.setExpandHorizontal((style & SWT.H_SCROLL) != 0); form.setExpandVertical((style & SWT.V_SCROLL) != 0); form.setBackground(toolkit.getColors().getBackground()); form.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); form.setFont(JFaceResources.getHeaderFont()); return form; }
From source file:org.kalypso.ui.editor.mapeditor.MapForm.java
License:Open Source License
/** * Does nothing more than create an empty form containing a {@link FillLayout}'ed body. This form is suitable to be * filled next by {@link #createMapPanel(Form, ICommandTarget, IFeatureSelectionManager). *//*from w ww. j ava 2 s.c o m*/ public static MapForm createMapForm(final Composite parent) { final FormToolkit formToolkit = ToolkitUtils.createToolkit(parent); final MapForm form = new MapForm(parent, SWT.NONE); formToolkit.adapt(form, false, false); formToolkit.decorateFormHeading(form); form.setFont(JFaceResources.getHeaderFont()); form.setSeparatorVisible(true); final Composite body = form.getBody(); body.setLayout(new FillLayout()); return form; }
From source file:org.netxms.ui.eclipse.osm.widgets.AbstractGeoMapViewer.java
License:Open Source License
@Override public void paintControl(PaintEvent e) { final GC gc = e.gc; gc.setAntialias(SWT.ON);//from w w w .j av a 2 s. c o m gc.setTextAntialias(SWT.ON); if (currentTileSet != null) drawTiles(gc, currentTileSet); GeoLocation currentLocation; // Draw objects and decorations if user is not dragging map // and map is not currently loading if (dragStartPoint == null) { currentLocation = accessor.getCenterPoint(); Rectangle rect = getClientArea(); drawContent(gc, currentLocation, rect.width, rect.height); } else { Point cp = GeoLocationCache.coordinateToDisplay(accessor.getCenterPoint(), accessor.getZoom()); cp.x += offsetX; cp.y += offsetY; currentLocation = GeoLocationCache.displayToCoordinates(cp, accessor.getZoom()); } // Draw selection rectangle if ((selectionStartPoint != null) && (selectionEndPoint != null)) { int x = Math.min(selectionStartPoint.x, selectionEndPoint.x); int y = Math.min(selectionStartPoint.y, selectionEndPoint.y); int w = Math.abs(selectionStartPoint.x - selectionEndPoint.x); int h = Math.abs(selectionStartPoint.y - selectionEndPoint.y); gc.setBackground(SELECTION_COLOR); gc.setForeground(SELECTION_COLOR); gc.setAlpha(64); gc.fillRectangle(x, y, w, h); gc.setAlpha(255); gc.setLineWidth(2); gc.drawRectangle(x, y, w, h); } // Draw current location info String text = currentLocation.toString(); Point textSize = gc.textExtent(text); Rectangle rect = getClientArea(); rect.x = rect.width - textSize.x - 20; rect.y += 10; rect.width = textSize.x + 10; rect.height = textSize.y + 8; gc.setBackground(INFO_BLOCK_BACKGROUND); gc.setAlpha(128); gc.fillRoundRectangle(rect.x, rect.y, rect.width, rect.height, 8, 8); gc.setAlpha(255); gc.setForeground(INFO_BLOCK_TEXT); gc.drawText(text, rect.x + 5, rect.y + 4, true); // Draw title if ((title != null) && !title.isEmpty()) { gc.setFont(mapTitleFont); rect = getClientArea(); int x = (rect.width - gc.textExtent(title).x) / 2; gc.setForeground(SharedColors.getColor(SharedColors.GEOMAP_TITLE, getDisplay())); gc.drawText(title, x, 10, true); } // Draw zoom control gc.setFont(JFaceResources.getHeaderFont()); text = Integer.toString(accessor.getZoom()); textSize = gc.textExtent(text); rect = getClientArea(); rect.x = 10; rect.y = 10; rect.width = 80; rect.height = 47 + textSize.y; gc.setBackground(INFO_BLOCK_BACKGROUND); gc.setAlpha(128); gc.fillRoundRectangle(rect.x, rect.y, rect.width, rect.height, 8, 8); gc.setAlpha(255); gc.drawText(text, rect.x + rect.width / 2 - textSize.x / 2, rect.y + 5, true); gc.drawImage(imageZoomIn, rect.x + 5, rect.y + rect.height - 37); gc.drawImage(imageZoomOut, rect.x + 42, rect.y + rect.height - 37); zoomControlRect = rect; }
From source file:org.polarsys.capella.ocl.requester.view.OCLInterpreterView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { // force left-to-right text direction in the console, because it // works with OCL text and the OCL language is based on English page = new SashForm(parent, SWT.VERTICAL | SWT.LEFT_TO_RIGHT); page.setFont(JFaceResources.getHeaderFont()); colorManager = new ColorManager(); document = new OCLDocument(); document.setModelingLevel(modelingLevel); contextName = new Label(page, SWT.NONE); errorOutput = new Label(page, SWT.NONE); errorOutput.setForeground(colorManager.getColor(ColorManager.OUTPUT_ERROR)); input = new OCLSourceViewer(page, colorManager, SWT.BORDER | SWT.MULTI); input.setDocument(document);//from w ww .j a v a 2 s . co m input.getTextWidget().addKeyListener(new InputKeyListener()); input.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); CTabFolder tabFolder = new CTabFolder(page, SWT.BORDER); tabFolder.setSelectionBackground( Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); CTabItem tabItem1 = new CTabItem(tabFolder, SWT.NONE); tabItem1.setText(OCLInterpreterMessages.OCLInterpreterView_tbtmModelOutput_text); Composite composite = new Composite(tabFolder, SWT.NONE); tabItem1.setControl(composite); composite.setLayout(new TreeColumnLayout()); ComposedAdapterFactory adapterFactory = (ComposedAdapterFactory) SiriusEditPlugin.getPlugin() .getItemProvidersAdapterFactory(); adapterFactory.insertAdapterFactory(new TupleItemProviderAdapterFactory()); labelProvider = new AdapterFactoryLabelProvider(adapterFactory); treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.MULTI); Tree tree = treeViewer.getTree(); tree.setHeaderVisible(true); tree.setLinesVisible(true); treeViewer.setContentProvider(getContentProvider()); treeViewer.setLabelProvider(labelProvider); CTabItem tabItem2 = new CTabItem(tabFolder, SWT.NONE); tabItem2.setText("Console Output"); //$NON-NLS-1$ output = new TextViewer(tabFolder, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); StyledText styledTextOutput = output.getTextWidget(); tabItem2.setControl(styledTextOutput); output.getTextWidget().setLayoutData(new GridData(GridData.FILL_BOTH)); output.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); output.setEditable(false); output.setDocument(new Document()); tabFolder.setSelection(0); selectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { OCLInterpreterView.this.selectionChanged(selection); } }; selectionService = getSite().getWorkbenchWindow().getSelectionService(); selectionService.addPostSelectionListener(selectionListener); // get current selection ISelection selection = selectionService.getSelection(); if (selection == null) { selection = getActiveSelection(); } selectionChanged(selection); ((SashForm) page).setWeights(new int[] { 1, 1, 5, 8 }); createActions(); }
From source file:org.robotframework.ide.eclipse.main.plugin.navigator.actions.LibraryDocumentationComposite.java
License:Apache License
@Override protected Composite createControl(final Composite parent) { setFormImage(RedImages.getBookImage()); final Composite actualComposite = getToolkit().createComposite(parent); GridLayoutFactory.fillDefaults().numColumns(2).margins(3, 3).applyTo(actualComposite); final Label version = getToolkit().createLabel(actualComposite, "Version"); version.setFont(JFaceResources.getHeaderFont()); version.setForeground(getToolkit().getColors().getColor(IFormColors.TITLE)); versionLabel = getToolkit().createLabel(actualComposite, ""); versionLabel.setFont(JFaceResources.getHeaderFont()); versionLabel.setForeground(getToolkit().getColors().getColor(IFormColors.TITLE)); GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(versionLabel); final Label scope = getToolkit().createLabel(actualComposite, "Scope"); scope.setFont(JFaceResources.getBannerFont()); scope.setForeground(getToolkit().getColors().getColor(IFormColors.TITLE)); scopeLabel = getToolkit().createLabel(actualComposite, ""); scopeLabel.setFont(JFaceResources.getBannerFont()); scopeLabel.setForeground(getToolkit().getColors().getColor(IFormColors.TITLE)); GridDataFactory.fillDefaults().grab(true, false).align(SWT.END, SWT.CENTER).applyTo(scopeLabel); final Label separator = getToolkit().createSeparator(actualComposite, SWT.HORIZONTAL | SWT.SHADOW_OUT); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(separator); scrolledFormText = new ScrolledFormText(actualComposite, SWT.V_SCROLL | SWT.H_SCROLL, true); getToolkit().adapt(scrolledFormText); GridDataFactory.fillDefaults().span(2, 1).hint(400, 500).grab(true, true).applyTo(scrolledFormText); GridLayoutFactory.fillDefaults().applyTo(scrolledFormText); documentationText = scrolledFormText.getFormText(); GridDataFactory.fillDefaults().grab(true, true).applyTo(documentationText); documentationText.setWhitespaceNormalized(false); documentationText.setFont("monospace", JFaceResources.getTextFont()); documentationText.setFont("monospace_inline", JFaceResources.getTextFont()); documentationText.setColor("header", getToolkit().getColors().getColor(IFormColors.TITLE)); documentationText.setFont("header", JFaceResources.getBannerFont()); final HyperlinkAdapter hyperlinkListener = createHyperlinkListener(); documentationText.addHyperlinkListener(hyperlinkListener); addDisposeListener(new DisposeListener() { @Override/*w w w .j a v a 2 s .c o m*/ public void widgetDisposed(final DisposeEvent e) { documentationText.removeHyperlinkListener(hyperlinkListener); } }); return actualComposite; }
From source file:org.topcased.model2doc.query2table.ui.widgets.Query2TableToolkit.java
License:Open Source License
/** * Creates a scrolled form widget in the provided parent. If you do not * require scrolling because there is already a scrolled composite up the * parent chain, use 'createForm' instead. * //from w w w . ja v a2 s .co m * @param parent * the scrolled form parent * @param style * the style to create the scrolled form * @return the form that can scroll itself * @see #createForm */ public ScrolledForm createScrolledForm(Composite parent, int style) { ScrolledForm form = new ScrolledForm(parent, style); form.setExpandHorizontal(true); form.setExpandVertical(true); form.setBackground(getColors().getBackground()); form.setForeground(getColors().getForeground()); form.setFont(JFaceResources.getHeaderFont()); return form; }