/** * Aktualisiert den Text neben dem Logo. Normalerweise steht da nichts. Man kann aber was * hinschreiben. * * @param text der text links neben dem Logo. */ public void setLogoText(String text) { this.logotext = text == null ? "" : text; if (this.logoBg != null && !this.logoBg.isDisposed()) { GUI.getDisplay() .asyncExec( new Runnable() { public void run() { logoBg.redraw(); } }); } }
/** Initialisiert das Layout der View. */ private void init() { sash = new SashForm(parent, SWT.VERTICAL); sash.setLayoutData(new GridData(GridData.FILL_BOTH)); sash.setLayout(SWTUtil.createGrid(1, true)); view = new Composite(sash, SWT.BORDER); view.setLayoutData(new GridData(GridData.FILL_BOTH)); view.setLayout(SWTUtil.createGrid(1, true)); snapin = new Composite(sash, SWT.BORDER); snapin.setLayoutData(new GridData(GridData.FILL_BOTH)); snapin.setLayout(SWTUtil.createGrid(1, true)); sash.setMaximizedControl(view); if (!Customizing.SETTINGS.getBoolean("application.view.hidelogo", false)) { //////////////////////////////////////////////////////////////////////////// // final Image logo = SWTUtil.getImage(Customizing.SETTINGS.getString("application.view.logo", "panel.png")); final Rectangle imageSize = logo.getBounds(); logoBg = SWTUtil.getCanvas(view, logo, SWT.TOP | SWT.RIGHT); RGB bg = Customizing.SETTINGS.getRGB( "application.view.background", GUI.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()); logoBg.setBackground(new org.eclipse.swt.graphics.Color(GUI.getDisplay(), bg)); logoBg.setLayout(SWTUtil.createGrid(1, false)); logoBg.addListener( SWT.Paint, new Listener() { public void handleEvent(Event event) { GC gc = event.gc; Rectangle size = logoBg.getBounds(); gc.fillRectangle(size); gc.drawImage(logo, size.width - imageSize.width, 0); gc.setFont(Font.SMALL.getSWTFont()); // kein Hintergrund hinter dem Text malen // Ist zumindest unter Linux nicht noetig. Windows und OSX muesste man mal noch testen gc.setBackground(GUI.getDisplay().getSystemColor(SWT.TRANSPARENT)); gc.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); gc.setAlpha(150); gc.drawText(logotext == null ? "" : logotext, 8, 10, true); } }); Label sep = new Label(view, SWT.SEPARATOR | SWT.HORIZONTAL); sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); //////////////////////////////////////////////////////////////////////////// } if (!Customizing.SETTINGS.getBoolean("application.view.hidepanel", false)) { //////////////////////////////////////////////////////////////////////////// // Composite comp = new Composite(view, SWT.NONE); comp.setLayout(SWTUtil.createGrid(1, false)); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.titlePart = new TitlePart(title, false); this.titlePart.paint(comp); } if (!Customizing.SETTINGS.getBoolean("application.view.hidemessages", false)) { //////////////////////////////////////////////////////////////////////////// // try { notifications = new NotificationPanel(); notifications.paint(view); } catch (Exception e) { Logger.error("unable to paint notification panel", e); } //////////////////////////////////////////////////////////////////////////// } }