001: // @@
002: // @@
003: /*
004: * Wi.Ser Framework
005: *
006: * LGPL Version: 1.8.1, 20-September-2007
007: * Copyright (C) 2005-2006 Dirk von der Weiden <dvdw@imail.de>
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library located in LGPL.txt in the
021: * license directory; if not, write to the
022: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
023: * Boston, MA 02111-1307, USA.
024: *
025: * If this agreement does not cover your requirements, please contact us
026: * via email to get detailed information about the commercial license
027: * or our service offerings!
028: *
029: */
030: // @@
031: package de.ug2t.channel.ho.client.swing;
032:
033: import javax.swing.*;
034:
035: import de.ug2t.kernel.*;
036: import de.ug2t.unifiedGui.interfaces.*;
037: import de.ug2t.unifiedGui.views.*;
038:
039: public final class HoSwingLabel extends HoSwingComponent implements
040: IUnLabel {
041: private JLabel pem_swingObj = null;
042: private HoSwingImage pem_icon = null;
043:
044: public HoSwingLabel(String xName, String xValue,
045: IUnApplication xAppl) throws Exception {
046: super (xName, xAppl);
047:
048: this .pem_swingObj = new JLabel(xValue);
049: ((JComponent) this .pem_swingObj).setOpaque(true);
050:
051: this .pdm_realSwingCmp = this .pem_swingObj;
052: ((HoSwingClient) xAppl).pcmf_addKeyDispatcher(this );
053:
054: return;
055: };
056:
057: public void pcmf_setValue(Object xValue) {
058: if (xValue instanceof IKeViewable) {
059: Object l_view = ((IKeViewable) xValue).pcmf_getView();
060: if (l_view instanceof UnIconValueView)
061: ((UnIconValueView) l_view).pcmf_applyStdView(this );
062: } else if (this .pcmf_getValue() instanceof IKeViewable) {
063: Object l_view = ((IKeViewable) this .pcmf_getValue())
064: .pcmf_getView();
065: if (l_view instanceof UnIconValueView)
066: ((UnIconValueView) l_view).pcmf_restStdView(this );
067: }
068:
069: this .pcmf_setLocalValue(xValue);
070: this .pem_swingObj.setText(this .pcmf_getValue().toString());
071:
072: return;
073: };
074:
075: private int pem_talign = IUnInputField.TEXT_ALIGN_WEST;
076:
077: public void pcmf_setTextAlign(int xAlign) {
078: if (IUnInputField.TEXT_ALIGN_EAST == xAlign)
079: this .pem_swingObj
080: .setHorizontalAlignment(SwingConstants.RIGHT);
081: else if (IUnInputField.TEXT_ALIGN_CENTER == xAlign)
082: this .pem_swingObj
083: .setHorizontalAlignment(SwingConstants.CENTER);
084: else
085: this .pem_swingObj
086: .setHorizontalAlignment(SwingConstants.LEFT);
087:
088: this .pem_talign = xAlign;
089: }
090:
091: public int pcmf_getTextAlign() {
092: return (this .pem_talign);
093: }
094:
095: public void pcmf_setIcon(IUnImage xIcon) {
096: pem_icon = (HoSwingImage) xIcon;
097: this .pem_swingObj.setIcon(((JLabel) pem_icon
098: .pcmf_getRealSwingObj()).getIcon());
099: }
100:
101: public IUnImage pcmf_getIcon() {
102: return (pem_icon);
103: };
104:
105: public void pcmf_forceInline(boolean xInline) {
106: return;
107: }
108:
109: public boolean pcmf_isInlineForced() {
110: return (true);
111: }
112:
113: public void pcmf_setDynamic(boolean xDyn) {
114: return;
115: }
116:
117: public boolean pcmf_isDynamic() {
118: return (false);
119: }
120: }
|