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 implementation of <code>Spacer</code>.
030: */
031: class SpacerLFImpl extends ItemLFImpl implements SpacerLF {
032:
033: /**
034: * Creates Look & Feel object for <code>Spacer</code>.
035: *
036: * @param spacer the model object
037: */
038: SpacerLFImpl(Spacer spacer) {
039: super (spacer);
040: sp = spacer;
041:
042: // Initialize the cached requested size
043: lSetRequestedSizes(sp.width, sp.height, sp.width, sp.height);
044: }
045:
046: /**
047: * Notifies look & feel of a minimum size change in the
048: * <code>Spacer</code>.
049: *
050: * @param minWidth the new minimum width
051: * @param minHeight the new minimum height
052: */
053: public void lSetMinimumSize(int minWidth, int minHeight) {
054: lRequestInvalidate(true, true);
055: // Set requested sizes AFTER the invalidate request above
056: lSetRequestedSizes(sp.width, sp.height, sp.width, sp.height);
057: }
058:
059: /**
060: * Calculate minimum and preferred width and height of this item and
061: * store the result in instance variables:
062: * minimumWidth, minimumHeight, preferredWidth and preferredHeight.
063: *
064: * Override the version in <code>ItemLFImpl</code> to do nothing.
065: */
066: void lGetRequestedSizes() {
067: // Since the cached sizes are always kept up to date.
068: // Nothing needs to be done here.
069:
070: // ASSERT (isRequestedSizesValid() == true)
071: }
072:
073: /**
074: * Called by event delivery to notify an <code>ItemLF</code> in current
075: * <code>FormLF</code> of a change in its peer state.
076: *
077: * Do nothing and returns <code>false</code> since there is no state
078: * to change.
079: *
080: * @param hint not used
081: *
082: * @return always <code>false</code>
083: */
084: boolean uCallPeerStateChanged(int hint) {
085: return false; // Unexpected call
086: }
087:
088: /**
089: * Create native resource of this <code>Item</code>.
090: *
091: * @param ownerId owner screen's native resource id
092: */
093: void createNativeResource(int ownerId) {
094: }
095:
096: /**
097: * <code>Spacer</code> associated with this look & feel.
098: */
099: Spacer sp;
100: }
|