예제 #1
0
  /**
   * DOCUMENT ME!
   *
   * @param c DOCUMENT ME!
   */
  private void updateStyle(JTextComponent c) {
    SeaGlassContext context = getContext(c, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    updateSearchStyle(c, context, getPropertyPrefix());

    if (style != oldStyle) {
      updateStyle(c, context, getPropertyPrefix());

      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }

    context.dispose();

    context = getContext(c, SeaGlassRegion.SEARCH_FIELD_FIND_BUTTON, ENABLED);
    findStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, SeaGlassRegion.SEARCH_FIELD_CANCEL_BUTTON, ENABLED);
    cancelStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();
  }
예제 #2
0
    /**
     * @see
     *     javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
     *     java.lang.Object, boolean, boolean, int, int)
     */
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      if (!useTableColors && (isSelected || hasFocus)) {
        SeaGlassLookAndFeel.setSelectedUI(
            (SeaGlassLabelUI) SeaGlassLookAndFeel.getUIOfType(getUI(), SeaGlassLabelUI.class),
            isSelected,
            hasFocus,
            table.isEnabled(),
            false);
      } else {
        SeaGlassLookAndFeel.resetSelectedUI();
      }

      Component comp =
          super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
      // System.out.println("row = " + row + ", opaque = " + isOpaque());
      if (row % 2 == 0) {
        comp.setBackground(alternateColor);
        setBackground(alternateColor);
      } else {
        comp.setBackground(table.getBackground());
        setBackground(table.getBackground());
      }

      setIcon(null);
      Class columnClass = table.getColumnClass(column);

      configureValue(value, columnClass);

      return this;
    }
  private void updateStyle(JToolBar c) {
    SeaGlassContext context = getContext(c, Region.TOOL_BAR_CONTENT, null, ENABLED);
    contentStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.getComponent().setOpaque(false);
    context.dispose();

    context = getContext(c, Region.TOOL_BAR_DRAG_WINDOW, null, ENABLED);
    context.getComponent().setOpaque(false);
    dragWindowStyle = SeaGlassLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, ENABLED);
    context.getComponent().setOpaque(false);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);
    if (oldStyle != style) {
      handleIcon = style.getIcon(context, "ToolBar.handleIcon");
      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }
    context.dispose();
  }
 /**
  * This method gets called when a bound property is changed on the associated JTextComponent. This
  * is a hook which UI implementations may change to reflect how the UI displays bound properties
  * of JTextComponent subclasses. This is implemented to rebuild the ActionMap based upon an
  * EditorKit change.
  *
  * @param evt the property change event
  */
 @Override
 protected void propertyChange(PropertyChangeEvent evt) {
   if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) {
     updateStyle((JTextComponent) evt.getSource());
   }
   super.propertyChange(evt);
 }
예제 #5
0
  /** @see javax.swing.plaf.basic.BasicTextUI#update(java.awt.Graphics, javax.swing.JComponent) */
  public void update(Graphics g, JComponent c) {
    SeaGlassContext context = getContext(c);

    SeaGlassLookAndFeel.update(context, g);
    paintBackground(context, g, c);
    paint(context, g);
    context.dispose();
  }
예제 #6
0
  /** @see javax.swing.plaf.ComponentUI#update(java.awt.Graphics, javax.swing.JComponent) */
  public void update(Graphics g, JComponent c) {
    SeaGlassContext context = getContext(c);

    SeaGlassLookAndFeel.update(context, g);
    context.getPainter().paintTableBackground(context, g, 0, 0, c.getWidth(), c.getHeight());
    paint(context, g);
    context.dispose();
  }
 public void paintContent(SeaGlassContext context, Graphics g, Rectangle bounds) {
   SeaGlassLookAndFeel.updateSubregion(context, g, bounds);
   context
       .getPainter()
       .paintToolBarContentBackground(
           context, g, bounds.x, bounds.y, bounds.width, bounds.height, toolBar.getOrientation());
   context
       .getPainter()
       .paintToolBarContentBorder(
           context, g, bounds.x, bounds.y, bounds.width, bounds.height, toolBar.getOrientation());
 }
  @Override
  public void update(Graphics g, JComponent c) {
    SeaGlassContext context = getContext(c);

    SeaGlassLookAndFeel.update(context, g);
    context
        .getPainter()
        .paintToolBarBackground(
            context, g, 0, 0, c.getWidth(), c.getHeight(), toolBar.getOrientation());
    paint(context, g);
    context.dispose();
  }
예제 #9
0
  /**
   * DOCUMENT ME!
   *
   * @param c DOCUMENT ME!
   * @param region DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  private int getComponentState(JComponent c, Region region) {
    if (region == SeaGlassRegion.SEARCH_FIELD_CANCEL_BUTTON && c.isEnabled()) {
      if (((JTextComponent) c).getText().length() == 0) {
        return DISABLED;
      } else if (isCancelArmed) {
        return PRESSED;
      }

      return ENABLED;
    }

    return SeaGlassLookAndFeel.getComponentState(c);
  }
 @Override
 protected void paintDragWindow(Graphics g) {
   int w = dragWindow.getWidth();
   int h = dragWindow.getHeight();
   SeaGlassContext context = getContext(toolBar, Region.TOOL_BAR_DRAG_WINDOW, dragWindowStyle);
   SeaGlassLookAndFeel.updateSubregion(context, g, new Rectangle(0, 0, w, h));
   context
       .getPainter()
       .paintToolBarDragWindowBackground(context, g, 0, 0, w, h, dragWindow.getOrientation());
   context
       .getPainter()
       .paintToolBarDragWindowBorder(context, g, 0, 0, w, h, dragWindow.getOrientation());
   context.dispose();
 }
  private void updateStyle(JTextComponent comp) {
    SeaGlassContext context = getContext(comp, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    if (style != oldStyle) {
      SeaGlassTextFieldUI.updateStyle(comp, context, getPropertyPrefix());

      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }
    context.dispose();
  }
예제 #12
0
  /**
   * DOCUMENT ME!
   *
   * @param g DOCUMENT ME!
   * @param c DOCUMENT ME!
   * @param region DOCUMENT ME!
   */
  protected void paintSearchButton(Graphics g, JTextComponent c, Region region) {
    Rectangle bounds;

    if (region == SeaGlassRegion.SEARCH_FIELD_FIND_BUTTON) {
      bounds = getFindButtonBounds();
    } else {
      bounds = getCancelButtonBounds();
    }

    SeaGlassContext subcontext = getContext(c, region);

    SeaGlassLookAndFeel.updateSubregion(subcontext, g, bounds);

    SeaGlassSynthPainterImpl painter = (SeaGlassSynthPainterImpl) subcontext.getPainter();

    painter.paintSearchButtonForeground(
        subcontext, g, bounds.x, bounds.y, bounds.width, bounds.height);

    subcontext.dispose();
  }
 private SeaGlassContext getContext(JComponent c, int state) {
   return SeaGlassContext.getContext(
       SeaGlassContext.class, c, SeaGlassLookAndFeel.getRegion(c), style, state);
 }
 private int getComponentState(JComponent c) {
   return SeaGlassLookAndFeel.getComponentState(c);
 }
 public void propertyChange(PropertyChangeEvent e) {
   if (SeaGlassLookAndFeel.shouldUpdateStyle(e)) {
     updateStyle((JToolBar) e.getSource());
   }
 }
예제 #16
0
  /**
   * DOCUMENT ME!
   *
   * @param c DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  private int getComponentState(JComponent c) {
    int state = SeaGlassLookAndFeel.getComponentState(c);

    return state;
  }
예제 #17
0
 /** @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */
 public void propertyChange(PropertyChangeEvent event) {
   if (SeaGlassLookAndFeel.shouldUpdateStyle(event)) {
     updateStyle((JTable) event.getSource());
   }
 }
예제 #18
0
 /** @see javax.swing.JComponent#paint(java.awt.Graphics) */
 public void paint(Graphics g) {
   super.paint(g);
   SeaGlassLookAndFeel.resetSelectedUI();
 }
예제 #19
0
  /**
   * Update the style.
   *
   * @param c the component.
   */
  private void updateStyle(JTable c) {
    SeaGlassContext context = getContext(c, ENABLED);
    SynthStyle oldStyle = style;

    style = SeaGlassLookAndFeel.updateStyle(context, this);

    selectionActiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionActiveBottom");
    selectionInactiveBottomBorderColor = UIManager.getColor("seaGlassTableSelectionInactiveBottom");
    transparentColor = UIManager.getColor("seaGlassTransparent");

    if (style != oldStyle) {
      table.remove(rendererPane);
      rendererPane = createCustomCellRendererPane();
      table.add(rendererPane);

      context.setComponentState(ENABLED | SELECTED);

      Color sbg = table.getSelectionBackground();

      if (sbg == null || sbg instanceof UIResource) {
        table.setSelectionBackground(style.getColor(context, ColorType.TEXT_BACKGROUND));
      }

      Color sfg = table.getSelectionForeground();

      if (sfg == null || sfg instanceof UIResource) {
        table.setSelectionForeground(style.getColor(context, ColorType.TEXT_FOREGROUND));
      }

      context.setComponentState(ENABLED);

      Color gridColor = table.getGridColor();

      if (gridColor == null || gridColor instanceof UIResource) {
        gridColor = (Color) style.get(context, "Table.gridColor");
        if (gridColor == null) {
          gridColor = style.getColor(context, ColorType.FOREGROUND);
        }

        table.setGridColor(gridColor);
      }

      useTableColors = style.getBoolean(context, "Table.rendererUseTableColors", true);
      useUIBorder = style.getBoolean(context, "Table.rendererUseUIBorder", true);

      Object rowHeight = style.get(context, "Table.rowHeight");

      if (rowHeight != null) {
        LookAndFeel.installProperty(table, "rowHeight", rowHeight);
      }

      boolean showGrid = style.getBoolean(context, "Table.showGrid", true);

      if (!showGrid) {
        table.setShowGrid(false);
      }

      Dimension d = table.getIntercellSpacing();
      // if (d == null || d instanceof UIResource) {
      if (d != null) {
        d = (Dimension) style.get(context, "Table.intercellSpacing");
      }

      alternateColor = (Color) style.get(context, "Table.alternateRowColor");
      if (d != null) {
        table.setIntercellSpacing(d);
      }

      table.setOpaque(false);

      if (alternateColor != null) {
        table.setShowHorizontalLines(false);
      }

      // Make header column extend the width of the viewport (if there is
      // a viewport).
      table.getTableHeader().setBorder(createTableHeaderEmptyColumnPainter(table));
      setViewPortListeners(table);

      if (oldStyle != null) {
        uninstallKeyboardActions();
        installKeyboardActions();
      }
    }

    context.dispose();
  }