📄 item.java
字号:
public abstract class Item extends Object{ /** * A J2ME Polish constant defining a transparent/invisible color. * TRANSPARENT has the value -1. */ public static final int TRANSPARENT = -1; /** * A J2ME Polish constant defining a vertical orientation. * VERTICAL has the value 0. */ public static final int VERTICAL = 0; /** * A J2ME Polish constant defining a horizontal orientation. * HORIZONTAL has the value 1. */ public static final int HORIZONTAL = 1; /** * A layout directive indicating that this <code>Item</code> * should follow the default layout policy of its container. * * <P>Value <code>0</code> is assigned to <code>LAYOUT_DEFAULT</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_DEFAULT = 0; /** * A layout directive indicating that this <code>Item</code> should have a * left-aligned layout. * * <P>Value <code>1</code> is assigned to <code>LAYOUT_LEFT</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_LEFT = 1; /** * A layout directive indicating that this <code>Item</code> should have a * right-aligned layout. * * <P>Value <code>2</code> is assigned to <code>LAYOUT_RIGHT</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_RIGHT = 2; /** * A layout directive indicating that this <code>Item</code> should have a * horizontally centered layout. * * <P>Value <code>3</code> is assigned to <code>LAYOUT_CENTER</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_CENTER = 3; /** * A layout directive indicating that this <code>Item</code> should have a * top-aligned layout. * * <P>Value <code>0x10</code> is assigned to <code>LAYOUT_TOP</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_TOP = 0x10; /** * A layout directive indicating that this <code>Item</code> should have a * bottom-aligned layout. * * <P>Value <code>0x20</code> is assigned to <code>LAYOUT_BOTTOM</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_BOTTOM = 0x20; /** * A layout directive indicating that this <code>Item</code> should have a * vertically centered layout. * * <P>Value <code>0x30</code> is assigned to * <code>LAYOUT_VCENTER</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_VCENTER = 0x30; /** * A layout directive indicating that this <code>Item</code> * should be placed at the beginning of a new line or row. * * <P>Value <code>0x100</code> is assigned to * <code>LAYOUT_NEWLINE_BEFORE</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_NEWLINE_BEFORE = 0x100; /** * A layout directive indicating that this <code>Item</code> * should the last on its line or row, and that the next * <code>Item</code> (if any) in the container * should be placed on a new line or row. * * <P>Value <code>0x200</code> is assigned to * <code>LAYOUT_NEWLINE_AFTER</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_NEWLINE_AFTER = 0x200; /** * A layout directive indicating that this <code>Item's</code> * width may be reduced to its minimum width. * * <P>Value <code>0x400</code> is assigned to <code>LAYOUT_SHRINK</code></P> * * * @since MIDP 2.0 */ public static final int LAYOUT_SHRINK = 0x400; /** * A layout directive indicating that this <code>Item's</code> * width may be increased to fill available space. * * <P>Value <code>0x800</code> is assigned to <code>LAYOUT_EXPAND</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_EXPAND = 0x800; /** * A layout directive indicating that this <code>Item's</code> * height may be reduced to its minimum height. * * <P>Value <code>0x1000</code> is assigned to * <code>LAYOUT_VSHRINK</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_VSHRINK = 0x1000; /** * A layout directive indicating that this <code>Item's</code> * height may be increased to fill available space. * * <P>Value <code>0x2000</code> is assigned to * <code>LAYOUT_VEXPAND</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_VEXPAND = 0x2000; /** * A layout directive indicating that new MIDP 2.0 layout * rules are in effect for this <code>Item</code>. If this * bit is clear, indicates that MIDP 1.0 layout behavior * applies to this <code>Item</code>. * * <P>Value <code>0x4000</code> is assigned to * <code>LAYOUT_2</code>.</P> * * * @since MIDP 2.0 */ public static final int LAYOUT_2 = 0x4000; /** * An appearance mode value indicating that the <code>Item</code> is to have * a normal appearance. * * <P>Value <code>0</code> is assigned to <code>PLAIN</code>.</P> * * * @since MIDP 2.0 */ public static final int PLAIN = 0; /** * An appearance mode value indicating that the <code>Item</code> * is to appear as a hyperlink. * <P>Value <code>1</code> is assigned to <code>HYPERLINK</code>.</P> * * * @since MIDP 2.0 */ public static final int HYPERLINK = 1; /** * An appearance mode value indicating that the <code>Item</code> * is to appear as a button. * <P>Value <code>2</code> is assigned to <code>BUTTON</code>.</P> * * @since MIDP 2.0 */ public static final int BUTTON = 2; /** * A J2ME Polish appearance mode value indicating that the <code>Item</code> * accepts input from the user. * <P>Value <code>3</code> is assigned to <code>INTERACTIVE</code>.</P> */ public static final int INTERACTIVE = 3; protected int layout; protected ItemCommandListener itemCommandListener; protected Command defaultCommand; protected int preferredWidth; protected int preferredHeight; protected int minimumWidth; protected int minimumHeight; //#ifdef polish.css.max-width protected int maximumWidth; //#endif //#ifdef polish.css.max-height protected int maximumHeight; //#endif protected boolean isInitialised; public Background background; protected Border border; protected Style style; public int itemWidth; public int itemHeight; protected int paddingLeft; protected int paddingTop; protected int paddingRight; protected int paddingBottom; protected int paddingVertical; protected int paddingHorizontal; protected int marginLeft; protected int marginTop; protected int marginRight; protected int marginBottom; /** The width of this item's content **/ protected int contentWidth; /** The height of this item's content **/ protected int contentHeight; protected int borderWidth; protected int backgroundWidth; protected int backgroundHeight; /** The appearance mode of this item, either PLAIN or one of the interactive modes BUTTON, HYPERLINK or INTERACTIVE. */ public int appearanceMode; /** * The screen to which this item belongs to. */ protected Screen screen; //#ifdef polish.useDynamicStyles /** * The appropriate CSS selector of this item. * This is either the style's name or a selector * depending on the state of this item. A StringItem * can have the selector "p", "a" or "button", for example. * This variable can only be used, when the proprocessing variable * "polish.useDynamicStyles" is defined. */ protected String cssSelector; //#endif /** * Determines whether the style has be dynamically assigned already. */ protected boolean isStyleInitialised; /** * The parent of this item. */ protected Item parent; protected ArrayList commands; protected boolean isLayoutCenter; protected boolean isLayoutExpand; protected boolean isLayoutRight; // the current positions of this item: protected int xLeftPos; protected int yTopPos; protected int xRightPos; protected int yBottomPos; // the current positions of this item's content: protected int contentX; protected int contentY; // the current positions of an internal element relative to the content origin // which should be visible: /** * The internal x position of this item's content. * When it is equal -9999 this item's internal position is not known. * The internal position is useful for items that have a large content which * needs to be scrolled, e.g. containers. */ protected int internalX = -9999; /** The internal y position of this item's content. */ protected int internalY; /** The internal width of this item's content. */ protected int internalWidth; /** The internal height of this item's content. */ protected int internalHeight; public boolean isFocused; //#ifdef polish.css.before private String beforeUrl; private int beforeWidth; private int beforeHeight; private Image beforeImage; //#endif //#ifdef polish.css.after private String afterUrl; private int afterWidth; private int afterHeight; private Image afterImage; //#endif // label settings: protected Style labelStyle = StyleSheet.labelStyle; protected StringItem label; private boolean useSingleRow; //#if polish.blackberry public Field _bbField; public boolean _bbFieldAdded; //#endif protected Style focusedStyle; //#if polish.css.colspan protected int colSpan = 1; //#endif //#if polish.css.rowspan protected int rowSpan; //#endif //#if polish.css.include-label protected boolean includeLabel; //#endif /** The vertical offset for the background, can be used for smoother scrolling, for example */ protected int backgroundYOffset; protected Item() { this( null, LAYOUT_DEFAULT, PLAIN, null ); } protected Item( Style style ) { this( null, LAYOUT_DEFAULT, PLAIN, style ); } protected Item( String label, int layout) { this( label, layout, PLAIN, null ); } /** * Creates a new Item. * * @param label the label of this item * @param layout the layout of this item * @param appearanceMode the mode of this item, either Item.PLAIN, Item.BUTTON or Item.HYPERLINK
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -