protected void onPropertyChange(
     JXHeader h, String propertyName, Object oldValue, final Object newValue) {
   if ("title".equals(propertyName)) {
     titleLabel.setText(h.getTitle());
   } else if ("description".equals(propertyName)) {
     descriptionPane.setText(h.getDescription());
   } else if ("icon".equals(propertyName)) {
     imagePanel.setIcon(h.getIcon());
   } else if ("enabled".equals(propertyName)) {
     boolean enabled = h.isEnabled();
     titleLabel.setEnabled(enabled);
     descriptionPane.setEnabled(enabled);
     imagePanel.setEnabled(enabled);
   } else if ("titleFont".equals(propertyName)) {
     titleLabel.setFont((Font) newValue);
   } else if ("descriptionFont".equals(propertyName)) {
     descriptionPane.setFont((Font) newValue);
   } else if ("titleForeground".equals(propertyName)) {
     titleLabel.setForeground((Color) newValue);
   } else if ("descriptionForeground".equals(propertyName)) {
     descriptionPane.setForeground((Color) newValue);
   } else if ("iconPosition".equals(propertyName)) {
     resetLayout(h);
   }
 }
示例#2
0
  public RehaHMKTab() {
    super();
    setLayout(new BorderLayout());
    hmkTab = new JTabbedPane();
    hmkTab.setUI(new WindowsTabbedPaneUI());

    rehaHMKPanel1 = new RehaHMKPanel1(this);
    rehaHMKPanel2 = new RehaHMKPanel2(this);
    hmkTab.addTab("Passenden Indikatiosschlüssel suchen", RehaHMK.icons.get("lupe"), rehaHMKPanel1);
    hmkTab.addTab("Rezeptänderung beantragen", RehaHMK.icons.get("blitz"), rehaHMKPanel2);
    /*
    sqlEditPanel = new RehaSqlEdit(this);
    hmkTab.add("Sql-Befehle entwerfen/bearbeiten",sqlEditPanel);
    */

    jxh = new JXHeader();
    ((JLabel) jxh.getComponent(1)).setVerticalAlignment(JLabel.NORTH);

    /*
    jxh.setTitle("Nach machbaren Indikationsschlüsseln suchen");
    jxh.setDescription("<html><br>Sie wissen welche Behandlungsformen gut sind für Ihren Patienten?<br>"+
    		"Sie wissen aber nicht welche Indikationsschlüssel für diese Behandlung(en) möglich sind?<br><br>"+
    		"<b>Dann ist diese Seite genau das Richtige für Sie!</b>");
    jxh.setIcon(RehaHMK.icons.get("erde"));
    */
    add(getHeader(0), BorderLayout.NORTH);
    add(hmkTab, BorderLayout.CENTER);
    hmkTab.validate();
    hmkTab.addChangeListener(this);
    validate();
  }
 protected void installListeners(final JXHeader header) {
   propListener =
       new PropertyChangeListener() {
         public void propertyChange(PropertyChangeEvent evt) {
           onPropertyChange(header, evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
         }
       };
   boundsListener =
       new HierarchyBoundsAdapter() {
         public void ancestorResized(HierarchyEvent e) {
           if (header == e.getComponent()) {
             View v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
             // view might get lost on LAF change ...
             if (v == null) {
               descriptionPane.putClientProperty(
                   BasicHTML.propertyKey,
                   descriptionPane.getMultiLineSupport().createView(descriptionPane));
               v = (View) descriptionPane.getClientProperty(BasicHTML.propertyKey);
             }
             if (v != null) {
               int h =
                   Math.max(descriptionPane.getHeight(), header.getTopLevelAncestor().getHeight());
               int w =
                   Math.min(
                       header.getTopLevelAncestor().getWidth(), header.getParent().getWidth());
               // 35 = description pane insets, TODO: obtain dynamically
               w -=
                   35
                       + header.getInsets().left
                       + header.getInsets().right
                       + descriptionPane.getInsets().left
                       + descriptionPane.getInsets().right
                       + imagePanel.getInsets().left
                       + imagePanel.getInsets().right
                       + imagePanel.getWidth()
                       + descriptionPane.getBounds().x;
               v.setSize(w, h);
               descriptionPane.setSize(w, (int) Math.ceil(v.getPreferredSpan(View.Y_AXIS)));
             }
           }
         }
       };
   header.addPropertyChangeListener(propListener);
   header.addHierarchyBoundsListener(boundsListener);
 }
  protected void installDefaults(JXHeader h) {
    gradientLightColor = UIManager.getColor("JXHeader.startBackground");
    if (gradientLightColor == null) {
      // fallback to white
      gradientLightColor = Color.WHITE;
    }
    gradientDarkColor = UIManager.getColor("JXHeader.background");
    // for backwards compatibility (mostly for substance and synthetica,
    // I suspect) I'll fall back on the "control" color if JXHeader.background
    // isn't specified.
    if (gradientDarkColor == null) {
      gradientDarkColor = UIManager.getColor("control");
    }

    Painter p = h.getBackgroundPainter();
    if (p == null || p instanceof PainterUIResource) {
      h.setBackgroundPainter(createBackgroundPainter());
    }

    // title properties
    Font titleFont = h.getTitleFont();
    if (titleFont == null || titleFont instanceof FontUIResource) {
      titleFont = UIManager.getFont("JXHeader.titleFont");
      // fallback to label font
      titleLabel.setFont(titleFont != null ? titleFont : UIManager.getFont("Label.font"));
    }

    Color titleForeground = h.getTitleForeground();
    if (titleForeground == null || titleForeground instanceof ColorUIResource) {
      titleForeground = UIManager.getColor("JXHeader.titleForeground");
      // fallback to label foreground
      titleLabel.setForeground(
          titleForeground != null ? titleForeground : UIManager.getColor("Label.foreground"));
    }

    titleLabel.setText(h.getTitle());

    // description properties
    Font descFont = h.getDescriptionFont();
    if (descFont == null || descFont instanceof FontUIResource) {
      descFont = UIManager.getFont("JXHeader.descriptionFont");
      // fallback to label font
      descriptionPane.setFont(descFont != null ? descFont : UIManager.getFont("Label.font"));
    }

    Color descForeground = h.getDescriptionForeground();
    if (descForeground == null || descForeground instanceof ColorUIResource) {
      descForeground = UIManager.getColor("JXHeader.descriptionForeground");
      // fallback to label foreground
      descriptionPane.setForeground(
          descForeground != null ? descForeground : UIManager.getColor("Label.foreground"));
    }

    descriptionPane.setText(h.getDescription());
  }
  /**
   * Configures the specified component appropriate for the look and feel. This method is invoked
   * when the <code>ComponentUI</code> instance is being installed as the UI delegate on the
   * specified component. This method should completely configure the component for the look and
   * feel, including the following:
   *
   * <ol>
   *   <li>Install any default property values for color, fonts, borders, icons, opacity, etc. on
   *       the component. Whenever possible, property values initialized by the client program
   *       should <i>not</i> be overridden.
   *   <li>Install a <code>LayoutManager</code> on the component if necessary.
   *   <li>Create/add any required sub-components to the component.
   *   <li>Create/install event listeners on the component.
   *   <li>Create/install a <code>PropertyChangeListener</code> on the component in order to detect
   *       and respond to component property changes appropriately.
   *   <li>Install keyboard UI (mnemonics, traversal, etc.) on the component.
   *   <li>Initialize any appropriate instance data.
   * </ol>
   *
   * @param c the component where this UI delegate is being installed
   * @see #uninstallUI
   * @see javax.swing.JComponent#setUI
   * @see javax.swing.JComponent#updateUI
   */
  @Override
  public void installUI(JComponent c) {
    super.installUI(c);
    assert c instanceof JXHeader;
    JXHeader header = (JXHeader) c;

    titleLabel = new JLabel();
    descriptionPane = new DescriptionPane();
    descriptionPane.setLineWrap(true);
    descriptionPane.setOpaque(false);

    installDefaults(header);

    imagePanel = new JLabel();
    imagePanel.setIcon(
        header.getIcon() == null ? UIManager.getIcon("Header.defaultIcon") : header.getIcon());

    installComponents(header);
    installListeners(header);
  }
  private void initialize() {
    this.setModal(true);
    this.setTitle(Translations.getString("general.manage_task_templates"));
    this.setSize(800, 700);
    this.setResizable(true);
    this.setLayout(new BorderLayout());
    this.setDefaultCloseOperation(HIDE_ON_CLOSE);

    if (this.getOwner() != null) this.setLocationRelativeTo(this.getOwner());

    JXHeader header = new JXHeader();
    header.setTitle(Translations.getString("header.title.manage_task_templates"));
    header.setDescription(Translations.getString("header.description.manage_task_templates"));
    header.setIcon(ImageUtils.getResourceImage("template.png", 32, 32));

    this.add(header, BorderLayout.NORTH);
    this.add(new TaskTemplateConfigurationPanel(), BorderLayout.CENTER);

    this.initializeButtonsPanel();
  }
示例#7
0
  public RehaUrlaubTab() {
    super();
    setLayout(new BorderLayout());

    String cmd = UrlaubFunktionen.getUrlaubTableDef("");
    SqlInfo.sqlAusfuehren(cmd);

    billEditTab = new JTabbedPane();
    billEditTab.setUI(new WindowsTabbedPaneUI());

    urlaubPanel = new RehaUrlaubPanel(this);
    billEditTab.add("Stundenerfassung", urlaubPanel);

    /*
    altimportPanel = new AltImport(this);
    billEditTab.add("alten RTA-Urlaub importieren",altimportPanel);
    */

    urlaubTabelle = new RehaUrlaubTabelle(this);
    billEditTab.add("Urlaubtabelle", urlaubTabelle);

    jxh = new JXHeader();
    ((JLabel) jxh.getComponent(1)).setVerticalAlignment(JLabel.NORTH);
    add(jxh, BorderLayout.NORTH);
    add(billEditTab, BorderLayout.CENTER);

    jxh.validate();
    billEditTab.validate();
    validate();
    new SwingWorker() {
      @Override
      protected Object doInBackground() throws Exception {
        holeKalUser();
        return null;
      }
    }.execute();
  }
示例#8
0
 private JXHeader getHeader(int welcher) {
   switch (welcher) {
     case 0:
       jxh.setTitle("Nach machbaren Indikationsschlüsseln suchen");
       jxh.setDescription(
           "<html><br>Sie wissen welche Behandlungsformen gut sind für Ihren Patienten?<br>"
               + "Sie wissen aber nicht welche Indikationsschlüssel für diese Behandlung(en) möglich sind?<br><br>"
               + "<b>Dann ist diese Seite genau das Richtige für Sie!</b>");
       jxh.setIcon(RehaHMK.icons.get("erde"));
       jxh.validate();
       break;
     case 1:
       jxh.setTitle("Rezeptänderung beim zuständigen Arzt beantragen");
       jxh.setDescription(
           "<html><br>Indikationsschlüssel falsch, ein Kreuzchen fehlt?<br>"
               + "Hier können Sie auf einfache Weise die Änderung Ihres Rezeptes beantragen<br><br>"
               + "<b>Auch wenn einem dieser Mist zutiefst zuwider ist....</b>");
       jxh.setIcon(RehaHMK.icons.get("strauss"));
       jxh.validate();
       break;
   }
   return jxh;
 }
 protected void uninstallComponents(JXHeader h) {
   h.remove(titleLabel);
   h.remove(descriptionPane);
   h.remove(imagePanel);
 }
 private void resetLayout(JXHeader h) {
   h.remove(titleLabel);
   h.remove(descriptionPane);
   h.remove(imagePanel);
   if (h.getIconPosition() == null || h.getIconPosition() == IconPosition.RIGHT) {
     h.add(
         titleLabel,
         new GridBagConstraints(
             0,
             0,
             1,
             1,
             1.0,
             0.0,
             GridBagConstraints.LINE_START,
             GridBagConstraints.HORIZONTAL,
             new Insets(12, 12, 0, 11),
             0,
             0));
     h.add(
         descriptionPane,
         new GridBagConstraints(
             0,
             1,
             1,
             1,
             1.0,
             1.0,
             GridBagConstraints.FIRST_LINE_START,
             GridBagConstraints.BOTH,
             new Insets(0, 24, 12, 11),
             0,
             0));
     h.add(
         imagePanel,
         new GridBagConstraints(
             1,
             0,
             1,
             2,
             0.0,
             1.0,
             GridBagConstraints.FIRST_LINE_END,
             GridBagConstraints.NONE,
             new Insets(12, 0, 11, 11),
             0,
             0));
   } else {
     h.add(
         titleLabel,
         new GridBagConstraints(
             1,
             0,
             1,
             1,
             1.0,
             0.0,
             GridBagConstraints.LINE_START,
             GridBagConstraints.HORIZONTAL,
             new Insets(12, 12, 0, 11),
             0,
             0));
     h.add(
         descriptionPane,
         new GridBagConstraints(
             1,
             1,
             1,
             1,
             1.0,
             1.0,
             GridBagConstraints.FIRST_LINE_START,
             GridBagConstraints.BOTH,
             new Insets(0, 24, 12, 11),
             0,
             0));
     h.add(
         imagePanel,
         new GridBagConstraints(
             0,
             0,
             1,
             2,
             0.0,
             1.0,
             GridBagConstraints.FIRST_LINE_END,
             GridBagConstraints.NONE,
             new Insets(12, 11, 0, 11),
             0,
             0));
   }
 }
 protected void installComponents(JXHeader h) {
   h.setLayout(new GridBagLayout());
   resetLayout(h);
 }
 protected void uninstallListeners(JXHeader h) {
   h.removePropertyChangeListener(propListener);
   h.removeHierarchyBoundsListener(boundsListener);
 }
  private void init() {
    JPanel jpPrincipal = new JPanel();
    JPanel jpAction = new JPanel();

    GridbagComposer gbComposer = new GridbagComposer();
    GridBagConstraints c = new GridBagConstraints();

    GlossPainter gloss = new GlossPainter();
    jxhFederation.setBackground(new Color(200, 200, 255));
    jxhFederation.setBackgroundPainter(gloss);
    jxhFederation.setTitleFont(jxhFederation.getTitleFont().deriveFont(16.0f));

    jlFederationLocaleNiveau.setOpaque(true);
    jlFederationLocaleNiveau.setBackground(Color.WHITE);

    gbcTraduction.setParentPanel(jpTraduction);
    cTraduction.gridy = -1;
    cTraduction.anchor = GridBagConstraints.WEST;
    cTraduction.fill = GridBagConstraints.HORIZONTAL;

    String[] libelleLangues = Configuration.listLangue();

    jcbAvailableLocale.setRenderer(
        new DefaultListCellRenderer() {
          /* (non-Javadoc)
           * @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
           */
          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

            if (value != null) value = ((Locale) value).getDisplayLanguage((Locale) value);
            else value = ""; // $NON-NLS-1$
            return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
          }
        });
    for (int i = 0; i < libelleLangues.length; i++) {
      if (!new Locale(libelleLangues[i]).equals(new Locale(profile.getConfiguration().getLangue())))
        jcbAvailableLocale.addItem(new Locale(libelleLangues[i]));
    }
    if (libelleLangues.length < 2) {
      jcbAvailableLocale.setEnabled(false);
    }

    jlAddLocaleInfo.setVisible(false);
    jbAddLocale.addActionListener(this);
    jbValider.addActionListener(this);
    jbAnnuler.addActionListener(this);

    gbComposer.setParentPanel(jpPrincipal);
    c.gridy = 0;
    c.anchor = GridBagConstraints.WEST;
    gbComposer.addComponentIntoGrid(jlFederationSigle, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(jtfFederatonSigle, c);
    c.gridy++;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlFederationName, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(jtfFederatonName, c);
    c.gridy++;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlCountry, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(ccbCountryFederation, c);
    c.gridy++;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlFederationNiveau, c);
    c.gridwidth = 2;
    gbComposer.addComponentIntoGrid(jtfFederationNiveau, c);
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    gbComposer.addComponentIntoGrid(jlFederationLocaleNiveau, c);
    c.gridy++;
    c.gridx = 1;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.NONE;
    gbComposer.addComponentIntoGrid(jlFederationNiveauInfo, c);
    c.gridy++;
    gbComposer.addComponentIntoGrid(jpTraduction, c);
    c.gridy++;
    gbComposer.addComponentIntoGrid(jlAddLocaleInfo, c);
    c.gridy++;
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 1;
    gbComposer.addComponentIntoGrid(jlAddLocale, c);
    gbComposer.addComponentIntoGrid(jcbAvailableLocale, c);
    gbComposer.addComponentIntoGrid(jbAddLocale, c);

    jpAction.setLayout(new FlowLayout(FlowLayout.RIGHT));
    jpAction.add(jbValider);
    jpAction.add(jbAnnuler);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jxhFederation, BorderLayout.NORTH);
    getContentPane().add(jpPrincipal, BorderLayout.CENTER);
    getContentPane().add(jpAction, BorderLayout.SOUTH);
  }