01: /*
02: * @(#)Alignable.java
03: *
04: * Copyright 2002 - 2004 JIDE Software. All rights reserved.
05: */
06: package com.jidesoft.swing;
07:
08: /**
09: * <code>Alignable</code> is an interface that can be implemented by any
10: * components to provide information such as how to set orientation and
11: * check whether a component supports vertical orientation or horizontal
12: * orientation.
13: * <p/>
14: * Some components support both vertical orientation and horizontal orientation.
15: * For example, an icon-only JideButton. It can be put on either a vertical toolbar
16: * or normal horizontal toolbar. However most components don't support both. For
17: * example, a combo box. It's hard to imagine a combobox putting on a vertical toolbar.
18: * <p/>
19: * By implementing this interface, a component can choose if it wants to support vertical
20: * orientation or horizontal orientation. However if a component which doesn't implement this
21: * interface is added to toolbar, by default, it will be treated as supportHorizontalOrientation()
22: * returning true and supportVerticalOrientation() returning false.
23: */
24: public interface Alignable {
25: /**
26: * Property name to indicate the orientation is changed.
27: */
28: public final static String PROPERTY_ORIENTATION = "orientation";
29:
30: /**
31: * Checks if the component support vertical orientation.
32: * doesn't consider the component orientation, it should return false.
33: *
34: * @return ture if it supports vertical orientation
35: */
36: boolean supportVerticalOrientation();
37:
38: /**
39: * Checks if the component support horizontal orientation.
40: *
41: * @return ture if it supports horizontal orientation
42: */
43: boolean supportHorizontalOrientation();
44:
45: /**
46: * Changes the orientation. If the component is a Swing component, the default implemenation is this.
47: * <br><code>JideSwingUtilities.setOrientationOf(this, orientation);<code>
48: *
49: * @param orientation the new orientation
50: */
51: void setOrientation(int orientation);
52:
53: /**
54: * Gets the orientation. If the component is a Swing component, the default implemenation is this.
55: * <br><code>return JideSwingUtilities.getOrientationOf(this);<code>
56: *
57: * @return orientation
58: */
59: int getOrientation();
60: }
|