Ejemplo n.º 1
0
  /** Leert die Anzeige. Wird beim Wechsel von einem Dialog auf den naechsten aufgerufen. */
  protected void cleanContent() {
    if (content != null && !content.isDisposed()) content.dispose();

    if (scroll != null && !scroll.isDisposed()) scroll.dispose();

    if (Customizing.SETTINGS.getBoolean("application.scrollview", false)) {
      scroll = new ScrolledComposite(view, SWT.V_SCROLL | SWT.H_SCROLL);
      scroll.setLayoutData(new GridData(GridData.FILL_BOTH));
      scroll.setLayout(SWTUtil.createGrid(1, true));
      scroll.setExpandHorizontal(true);
      scroll.setExpandVertical(true);
      scroll.setMinHeight(Customizing.SETTINGS.getInt("application.scrollview.minheight", 580));

      content = new Composite(scroll, SWT.NONE);
      scroll.setContent(content);
    } else {
      content = new Composite(view, SWT.NONE);
    }

    content.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout l = new GridLayout();
    l.marginHeight = 6;
    l.marginWidth = 6;
    content.setLayout(l);

    if (this.titlePart != null) {
      this.titlePart.clearButtons();
      this.titlePart.addButton(new PanelButtonBack()); // Zurueckbutton ist immer dabei
    }

    if (notifications != null) notifications.reset();

    setTitle(null);
  }
Ejemplo n.º 2
0
  /** 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);
      }
      ////////////////////////////////////////////////////////////////////////////
    }
  }