Package com.iizix.swt
Class CustomSashForm
- All Implemented Interfaces:
Drawable
- Direct Known Subclasses:
TablePanel
A SashForm that allows hide/restore controls on sash. It only works with one sash (two children). It doesn't make sense for the arrows when there is more than one sash. Things get confusing for a restore position.
Nested Class Summary
Nested ClassesField Summary
FieldsModifier and TypeFieldDescriptionprotected final ApplicationUIprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected Colorprotected Colorprotected com.iizix.swt.CustomSashForm.SashInfoprotected List<CustomSashForm.ICustomSashFormListener> protected static final intprotected static final intprotected static final intprotected static final intprotected booleanstatic final intCustom style bits.static final intCustom style bits.static final intCustom style bits.static final intCustom style bits.protected booleanprotected booleanprotected boolean[]protected static final intprotected static final intprotected static final intprotected static final intprotected static final intFields inherited from class org.eclipse.swt.custom.SashForm
SASH_WIDTHConstructor Summary
ConstructorsConstructorDescriptionCustomSashForm(Composite parent, int style) Constructor for CustomSashForm.CustomSashForm(Composite parent, int style, int customStyle) Constructor taking a custom style too.Method Summary
Modifier and TypeMethodDescriptionvoidAdds a custom sashform listener.protected voiddownHideClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) protected voiddownRestoreClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) protected voidprotected voiddrawDownHideArrow(GC gc, int x, int y) protected voiddrawDownRestoreArrow(GC gc, int x, int y) protected voiddrawLeftHideArrow(GC gc, int x, int y) protected voiddrawLeftRestoreArrow(GC gc, int x, int y) protected voiddrawRightHideArrow(GC gc, int x, int y) protected voiddrawRightRestoreArrow(GC gc, int x, int y) protected voiddrawSashBorder(GC gc, Sash sash, boolean leftBorder) protected voiddrawUpHideArrow(GC gc, int x, int y) protected voiddrawUpRestoreArrow(GC gc, int x, int y) protected voidprotected voidgetNewSashArray(com.iizix.swt.CustomSashForm.SashInfo sashInfo, int[] addArrowTypes, int[] drawArrowTypes) intprotected SashgetSash()Point[]int[]Get heights for save.voidhideDown()Call to set to hide downvoidhideLeft()Call to set to hide leftvoidCall to set to hide rightvoidhideUp()Call to set to hide upbooleanReturns if the first sash part is visible.protected booleanisFocusAncestorA(Control control) booleanReturns thenoHideDownsetting for vertical CustomSashForm.booleanReturns thenoHideLeftsetting for horizontal CustomSashForm.booleanReturns thenoHideRightsetting for horizontal CustomSashForm.booleanReturns thenoHideUpsetting for vertical CustomSashForm.booleanReturns if the second sash part is visible.voidlayout(boolean changed) protected voidvoidRemoves the custom sashform listener.booleanMakes the first sash visible if it is not.voidsetNoHideDown(boolean bHide) Sets thenoHideDownsetting for vertical CustomSashForm.voidsetNoHideLeft(boolean bHide) Sets thenoHideLeftsetting for horizontal CustomSashForm.voidsetNoHideRight(boolean bHide) Sets thenoHideRightsetting for horizontal CustomSashForm.voidsetNoHideUp(boolean bHide) Sets thenoHideUpsetting for vertical CustomSashForm.voidsetRestoreWeight(int weight) voidsetSashBorders(boolean[] sashBorders) Set the need sash borders for the controls.booleanMakes the first sash visible if it is not.voidsetWeights(int... rc) protected voidupHideClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) protected voidupRestoreClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) Methods inherited from class org.eclipse.swt.custom.SashForm
getMaximizedControl, getOrientation, getSashWidth, getStyle, getWeights, setBackground, setForeground, setLayout, setMaximizedControl, setOrientation, setSashWidth, setToolTipTextMethods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, redraw, setBackgroundMode, setFocus, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsModeMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setDataMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
Field Details
NO_HIDE_LEFT
public static final int NO_HIDE_LEFTCustom style bits. They set whether hide to one side of the other is not permitted. For example, if NO_HIDE_UP, then there will be only one arrow. When not hidden, it will point down (and will do a hide down), and when hidden down, it will point up (and will do a restore to the previous weight). There won't be a hide to the top arrow.- See Also:
NO_HIDE_UP
public static final int NO_HIDE_UPCustom style bits. They set whether hide to one side of the other is not permitted. For example, if NO_HIDE_UP, then there will be only one arrow. When not hidden, it will point down (and will do a hide down), and when hidden down, it will point up (and will do a restore to the previous weight). There won't be a hide to the top arrow.- See Also:
NO_HIDE_RIGHT
public static final int NO_HIDE_RIGHTCustom style bits. They set whether hide to one side of the other is not permitted. For example, if NO_HIDE_UP, then there will be only one arrow. When not hidden, it will point down (and will do a hide down), and when hidden down, it will point up (and will do a restore to the previous weight). There won't be a hide to the top arrow.- See Also:
NO_HIDE_DOWN
public static final int NO_HIDE_DOWNCustom style bits. They set whether hide to one side of the other is not permitted. For example, if NO_HIDE_UP, then there will be only one arrow. When not hidden, it will point down (and will do a hide down), and when hidden down, it will point up (and will do a restore to the previous weight). There won't be a hide to the top arrow.- See Also:
appUI
currentSashInfo
protected com.iizix.swt.CustomSashForm.SashInfo currentSashInfoinMouseClick
protected boolean inMouseClicksashBorders
protected boolean[] sashBordersnoHideUp
protected boolean noHideUpnoHideDown
protected boolean noHideDowncustomSashFormListeners
UP_RESTORE_ARROW
protected static final int UP_RESTORE_ARROW- See Also:
UP_HIDE_ARROW
protected static final int UP_HIDE_ARROW- See Also:
DOWN_RESTORE_ARROW
protected static final int DOWN_RESTORE_ARROW- See Also:
DOWN_HIDE_ARROW
protected static final int DOWN_HIDE_ARROW- See Also:
HIDE_ARROWS
protected static final int HIDE_ARROWS- See Also:
ARROW_TYPE_INDEX
protected static final int ARROW_TYPE_INDEX- See Also:
ARROW_DRAWN_INDEX
protected static final int ARROW_DRAWN_INDEX- See Also:
X_INDEX
protected static final int X_INDEX- See Also:
Y_INDEX
protected static final int Y_INDEX- See Also:
WIDTH_INDEX
protected static final int WIDTH_INDEX- See Also:
HEIGHT_INDEX
protected static final int HEIGHT_INDEX- See Also:
ARROW_WIDTH
protected static final int ARROW_WIDTH- See Also:
ARROW_HEIGHT
protected static final int ARROW_HEIGHT- See Also:
ARROW_MARGIN
protected static final int ARROW_MARGIN- See Also:
arrowColor
borderColor
Constructor Details
CustomSashForm
Constructor for CustomSashForm.- Parameters:
parent-style-
CustomSashForm
Constructor taking a custom style too. Or in the Custom style bits defined above (e.g. NO_HIDE_RIGHT,...)
Method Details
isNoHideUp
public boolean isNoHideUp()Returns thenoHideUpsetting for vertical CustomSashForm.- Returns:
- The no-hide-up flag.
isNoHideDown
public boolean isNoHideDown()Returns thenoHideDownsetting for vertical CustomSashForm.- Returns:
- The no-hide-down flag.
isNoHideLeft
public boolean isNoHideLeft()Returns thenoHideLeftsetting for horizontal CustomSashForm.- Returns:
- The no-hide-left flag.
isNoHideRight
public boolean isNoHideRight()Returns thenoHideRightsetting for horizontal CustomSashForm.- Returns:
- The no-hide-right flag.
setNoHideUp
public void setNoHideUp(boolean bHide) Sets thenoHideUpsetting for vertical CustomSashForm.- Parameters:
bHide-
setNoHideDown
public void setNoHideDown(boolean bHide) Sets thenoHideDownsetting for vertical CustomSashForm.- Parameters:
bHide-
setNoHideLeft
public void setNoHideLeft(boolean bHide) Sets thenoHideLeftsetting for horizontal CustomSashForm.- Parameters:
bHide-
setNoHideRight
public void setNoHideRight(boolean bHide) Sets thenoHideRightsetting for horizontal CustomSashForm.- Parameters:
bHide-
hideUp
public void hideUp()Call to set to hide uphideLeft
public void hideLeft()Call to set to hide lefthideDown
public void hideDown()Call to set to hide downhideRight
public void hideRight()Call to set to hide rightsetSashBorders
public void setSashBorders(boolean[] sashBorders) Set the need sash borders for the controls.layout
public void layout(boolean changed) recomputeSashInfo
protected void recomputeSashInfo()upRestoreClicked
protected void upRestoreClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) upHideClicked
protected void upHideClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) downRestoreClicked
protected void downRestoreClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) isFirstSashVisible
public boolean isFirstSashVisible()Returns if the first sash part is visible.isSecondSashVisible
public boolean isSecondSashVisible()Returns if the second sash part is visible.setFirstSashVisible
public boolean setFirstSashVisible()Makes the first sash visible if it is not.- Returns:
- true for success, false for no change.
setSecondSashVisible
public boolean setSecondSashVisible()Makes the first sash visible if it is not.- Returns:
- true for success, false for no change.
downHideClicked
protected void downHideClicked(com.iizix.swt.CustomSashForm.SashInfo sashinfo) isFocusAncestorA
getNewSashArray
protected void getNewSashArray(com.iizix.swt.CustomSashForm.SashInfo sashInfo, int[] addArrowTypes, int[] drawArrowTypes) drawSashBorder
drawArrow
drawUpRestoreArrow
drawUpHideArrow
drawDownRestoreArrow
drawDownHideArrow
drawLeftRestoreArrow
drawLeftHideArrow
drawRightRestoreArrow
drawRightHideArrow
getRestoreWeight
public int getRestoreWeight()getSash
setRestoreWeight
public void setRestoreWeight(int weight) getSavedSizes
addCustomSashFormListener
Adds a custom sashform listener. This listener will be removed when this control is disposed.- Parameters:
listener-- Since:
- 1.2.0
removeCustomSashFormListener
Removes the custom sashform listener.- Parameters:
listener-- Since:
- 1.2.0
fireDividerMoved
protected void fireDividerMoved()setWeights
public void setWeights(int... rc) - Overrides:
setWeightsin classSashForm
getWeightsForSave
public int[] getWeightsForSave()Get heights for save. Negative value indicates it's been hidden.