SynthToolBarUIpublic class SynthToolBarUI extends BasicToolBarUI implements SynthUI, PropertyChangeListenerA Synth L&F implementation of ToolBarUI. This implementation
is a "combined" view/controller.
|
Fields Summary |
---|
protected Icon | handleIcon | protected Rectangle | contentRect | private SynthStyle | style | private SynthStyle | contentStyle | private SynthStyle | dragWindowStyle |
Methods Summary |
---|
protected java.awt.LayoutManager | createLayout()
return new SynthToolBarLayoutManager();
| public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)
return new SynthToolBarUI();
| private int | getComponentState(javax.swing.JComponent c)
return SynthLookAndFeel.getComponentState(c);
| private int | getComponentState(javax.swing.JComponent c, javax.swing.plaf.synth.Region region)
return SynthLookAndFeel.getComponentState(c);
| public javax.swing.plaf.synth.SynthContext | getContext(javax.swing.JComponent c)
return getContext(c, getComponentState(c));
| private javax.swing.plaf.synth.SynthContext | getContext(javax.swing.JComponent c, int state)
return SynthContext.getContext(SynthContext.class, c,
SynthLookAndFeel.getRegion(c), style, state);
| private javax.swing.plaf.synth.SynthContext | getContext(javax.swing.JComponent c, javax.swing.plaf.synth.Region region)
return getContext(c, region, getComponentState(c, region));
| private javax.swing.plaf.synth.SynthContext | getContext(javax.swing.JComponent c, javax.swing.plaf.synth.Region region, int state)
return SynthContext.getContext(SynthContext.class, c, region,
dragWindowStyle, state);
| private javax.swing.plaf.synth.Region | getRegion(javax.swing.JComponent c)
return SynthLookAndFeel.getRegion(c);
| protected void | installComponents()
| protected void | installDefaults()
toolBar.setLayout(createLayout());
updateStyle(toolBar);
| protected void | installListeners()
super.installListeners();
toolBar.addPropertyChangeListener(this);
| public void | paint(java.awt.Graphics g, javax.swing.JComponent c)
SynthContext context = getContext(c);
paint(context, g);
context.dispose();
| protected void | paint(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g)
if (handleIcon != null && toolBar.isFloatable()) {
int startX = toolBar.getComponentOrientation().isLeftToRight() ?
0 : toolBar.getWidth() -
SynthIcon.getIconWidth(handleIcon, context);
SynthIcon.paintIcon(handleIcon, context, g, startX, 0,
SynthIcon.getIconWidth(handleIcon, context),
SynthIcon.getIconHeight(handleIcon, context));
}
SynthContext subcontext = getContext(toolBar, Region.TOOL_BAR_CONTENT);
paintContent(subcontext, g, contentRect);
subcontext.dispose();
| public void | paintBorder(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, int x, int y, int w, int h)
context.getPainter().paintToolBarBorder(context, g, x, y, w, h,
toolBar.getOrientation());
| public void | paintContent(javax.swing.plaf.synth.SynthContext context, java.awt.Graphics g, java.awt.Rectangle bounds)
SynthLookAndFeel.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());
| protected void | paintDragWindow(java.awt.Graphics g)
int w = dragWindow.getWidth();
int h = dragWindow.getHeight();
SynthContext context = getContext(toolBar,Region.TOOL_BAR_DRAG_WINDOW);
SynthLookAndFeel.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();
| public void | propertyChange(java.beans.PropertyChangeEvent e)
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JToolBar)e.getSource());
}
| protected void | setBorderToNonRollover(java.awt.Component c)
| protected void | setBorderToNormal(java.awt.Component c)
| protected void | setBorderToRollover(java.awt.Component c)
| protected void | uninstallComponents()
| protected void | uninstallDefaults()
SynthContext context = getContext(toolBar, ENABLED);
style.uninstallDefaults(context);
context.dispose();
style = null;
handleIcon = null;
context = getContext(toolBar, Region.TOOL_BAR_CONTENT, ENABLED);
contentStyle.uninstallDefaults(context);
context.dispose();
contentStyle = null;
context = getContext(toolBar, Region.TOOL_BAR_DRAG_WINDOW, ENABLED);
dragWindowStyle.uninstallDefaults(context);
context.dispose();
dragWindowStyle = null;
toolBar.setLayout(null);
| protected void | uninstallListeners()
super.uninstallListeners();
toolBar.removePropertyChangeListener(this);
| public void | update(java.awt.Graphics g, javax.swing.JComponent c)
SynthContext context = getContext(c);
SynthLookAndFeel.update(context, g);
context.getPainter().paintToolBarBackground(context,
g, 0, 0, c.getWidth(), c.getHeight(),
toolBar.getOrientation());
paint(context, g);
context.dispose();
| private void | updateStyle(javax.swing.JToolBar c)
SynthContext context = getContext(c, ENABLED);
SynthStyle oldStyle = style;
style = SynthLookAndFeel.updateStyle(context, this);
if (oldStyle != style) {
handleIcon =
style.getIcon(context, "ToolBar.handleIcon");
if (oldStyle != null) {
uninstallKeyboardActions();
installKeyboardActions();
}
}
context.dispose();
context = getContext(c, Region.TOOL_BAR_CONTENT, ENABLED);
contentStyle = SynthLookAndFeel.updateStyle(context, this);
context.dispose();
context = getContext(c, Region.TOOL_BAR_DRAG_WINDOW, ENABLED);
dragWindowStyle = SynthLookAndFeel.updateStyle(context, this);
context.dispose();
|
|