001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026: package javax.microedition.lcdui;
027:
028: /**
029: * Look and Feel interface used by Item.
030: * <p>
031: * See <a href="doc-files/naming.html">Naming Conventions</a>
032: * for information about method naming conventions.
033: */
034: interface ItemLF {
035:
036: /**
037: * Get the preferred width of this Item
038: *
039: * @param h tentative locked height
040: * @return the preferred width
041: */
042: int lGetPreferredWidth(int h);
043:
044: /**
045: * Get the preferred height of this Item
046: * @param w tentative locked width
047: * @return the preferred height
048: */
049: int lGetPreferredHeight(int w);
050:
051: /**
052: * Get the minimum width of this Item
053: *
054: * @return the minimum width
055: */
056: int lGetMinimumWidth();
057:
058: /**
059: * Get the minimum height of this Item
060: *
061: * @return the minimum height
062: */
063: int lGetMinimumHeight();
064:
065: /**
066: * Notifies L&F of a label change in the corresponding Item.
067: * @param label the new label string
068: */
069: void lSetLabel(String label);
070:
071: /**
072: * Notifies L&F of a layout change in the corresponding Item.
073: * @param layout the new layout descriptor
074: */
075: void lSetLayout(int layout);
076:
077: /**
078: * Notifies L&F of a command addition in the corresponding Item.
079: * @param cmd the newly added command
080: * @param i the index of the added command in the ChoiceGroup's
081: * commands[] array
082: */
083: void lAddCommand(Command cmd, int i);
084:
085: /**
086: * Notifies L&F of a command removal in the corresponding Item.
087: * @param cmd the newly removed command
088: * @param i the index of the removed command in the ChoiceGroup's
089: * commands[] array
090: */
091: void lRemoveCommand(Command cmd, int i);
092:
093: /**
094: * Notifies L&F of a preferred size change in the corresponding Item.
095: * @param width the value to which the width is locked, or
096: * <code>-1</code> if it is unlocked
097: * @param height the value to which the height is locked, or
098: * <code>-1</code> if it is unlocked
099: */
100: void lSetPreferredSize(int width, int height);
101:
102: /**
103: * Notifies L&F of the default command change in the corresponding Item.
104: * @param cmd the newly set default command
105: * @param i index of this new command in the ChoiceGroup's commands array
106: */
107: void lSetDefaultCommand(Command cmd, int i);
108:
109: /**
110: * Notify this itemLF that its owner screen has changed.
111: *
112: * @param oldOwner old owner screen before this change. New owner
113: * can be found in Item model.
114: */
115: public void lSetOwner(Screen oldOwner);
116:
117: /**
118: * Called to commit any pending user interaction for the current
119: * item before an abstract command is fired.
120: * Caller should hold LCDUILock around this call.
121: */
122: void lCommitPendingInteraction();
123:
124: /**
125: * Return whether the cached requested sizes are valid.
126: *
127: * @return <code>true</code> if the cached requested sizes are up to date.
128: * <code>false</code> if they have been invalidated.
129: */
130: boolean isRequestedSizesValid();
131: }
|