|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectswingwt.awt.Component
swingwt.awt.Container
swingwtx.swing.JComponent
swingwtx.swing.JToolBar
This class is now not only fully 'swing-y', but also mirrors correctly to SWT. Also, this class's peer, JToolBar has the option to be contained within a CoolBar. Rob: Unfortunately, this class can never support embedded components the way that Swing does, so we can't use this as the "main" Toolbar implementation. Instead, this allows Swing functionality with actions to the platform toolbar, regular JToolBar will behave like Swing. Daniel: Au cantrare, my pessimistic friend! :) I have done what you say this class can never do. This class really is now fully swing-y and does support placing strange components within itself. The key to the hack is not having the JToolbar class control a ToolBar peer, but a Composite peer. Then we add ToolBar(s) and Composite(s) as needed to give the native look within the CoolBar or without the CoolBar if nessissary. You have to admit, this class has earned the right to be the default implementation. Perhaps we could do a JToolBarNonNative? ;) Rob: Very funny - I'll hack on this a bit and we'll use it as the main implmentation (you win!) Daniel: I made some minor changes to this class, adding the overloaded methods to add(JCheckBox) and add(JRadioButton) so as to enable the corresponding SWT widget functionality in SwingWT.
Nested Class Summary | |
class |
JToolBar.ToolBarUI
Temparary storage for the ToolBarUI class. |
Nested classes inherited from class swingwtx.swing.JComponent |
JComponent.InternalFrameSelectionListener |
Field Summary | |
protected boolean |
coolbar
|
protected org.eclipse.swt.widgets.Composite |
lastAdd
Last added component - used to determine when to use ToolBar/Composite |
protected int |
orientation
|
protected Container |
parent
|
protected org.eclipse.swt.widgets.Composite |
ppeer
|
protected boolean |
rollover
|
protected java.lang.String |
titleString
|
Fields inherited from class swingwtx.swing.JComponent |
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, opaque, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap |
Fields inherited from class swingwt.awt.Container |
composite, comps, containerListeners, layout, queuedValidateRequest |
Fields inherited from interface swingwtx.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface swingwt.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JToolBar()
|
|
JToolBar(int orientation)
|
|
JToolBar(java.lang.String titleString)
|
|
JToolBar(java.lang.String titleString,
int orientation)
|
Method Summary | |
JButton |
add(Action a)
What the heck is this method supposed to return? Rob: Create a protected constructor for JButton for this eventuality, and use it to create a wrapper for the ToolItem. |
Component |
add(Component c)
We can add a component through this method to the JToolBar and have it go side by side with the ToolItems. |
Component |
add(JButton b)
This handy overload will map JButtons to Actions for you - making your buttons look ace :) |
Component |
add(JCheckBox checkBox)
map to a SWT.CHECK style ToolItem .. |
Component |
add(JRadioButton radioButton)
map to a SWT.RADIO style ToolItem .. |
void |
addSeparator()
|
Component |
getComponentAtIndex(int index)
|
int |
getComponentIndex(Component c)
|
Insets |
getMargin()
|
int |
getOrientation()
|
JToolBar.ToolBarUI |
getUI()
|
void |
invalidate()
Overrides normal component invalidation as we are using an SWT layout. |
boolean |
isBorderPainted()
I have no clue which platforms support border painting and which don't. |
boolean |
isFloatable()
|
boolean |
isRollover()
|
void |
setBorderPainted(boolean b)
Controlled by the native widget. |
void |
setFloatable(boolean b)
I've dropped these. |
void |
setMargin(Insets insets)
Sorry, controlled by the native widgets. |
void |
setOrientation(int orientation)
|
void |
setRollover(boolean b)
WARNING: MacOS X by default doesn't use toolbar rollovers. |
void |
setSwingWTParent(Container parent)
Callback for when this JComponent is added to a container. |
void |
setUI(JToolBar.ToolBarUI ui)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.eclipse.swt.widgets.Composite lastAdd
protected int orientation
protected java.lang.String titleString
protected boolean coolbar
protected boolean rollover
protected Container parent
protected org.eclipse.swt.widgets.Composite ppeer
Constructor Detail |
public JToolBar()
public JToolBar(java.lang.String titleString)
public JToolBar(int orientation)
public JToolBar(java.lang.String titleString, int orientation)
Method Detail |
public int getOrientation()
public void setOrientation(int orientation)
orientation
- public boolean isRollover()
public void setRollover(boolean b)
b
- public Component getComponentAtIndex(int index)
index
-
public int getComponentIndex(Component c)
c
-
public Insets getMargin()
public void setMargin(Insets insets)
setMargin
in class JComponent
insets
- public void invalidate()
invalidate
in class Container
public JToolBar.ToolBarUI getUI()
public void setUI(JToolBar.ToolBarUI ui)
public void setBorderPainted(boolean b)
b
- public boolean isBorderPainted()
public boolean isFloatable()
public void setFloatable(boolean b)
public void addSeparator()
public void setSwingWTParent(Container parent) throws java.lang.Exception
JComponent
setSwingWTParent
in class JComponent
java.lang.Exception
public Component add(JButton b)
public Component add(JCheckBox checkBox)
checkBox
- public Component add(JRadioButton radioButton)
radioButton
- public Component add(Component c)
add
in class JComponent
public JButton add(Action a)
a
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |