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 java.awt.*;
034:
035: import javax.swing.border.*;
036:
037: import de.ug2t.unifiedGui.*;
038: import de.ug2t.unifiedGui.interfaces.*;
039:
040: public final class HoSwingBorder extends HoSwingContainer implements
041: IUnBorder {
042: private TitledBorder pem_swingObj = null;
043: private Color pem_color = Color.black;
044: private int pem_boStyle = IUnComponent.LINE_BORDER;
045: private int pem_size = 1;
046: private boolean pem_scroll = false;
047:
048: public HoSwingBorder(String xName, boolean xNoLayout,
049: IUnApplication xAppl) throws Exception {
050: super (xName, xAppl);
051:
052: if (xNoLayout) {
053: this .pdm_layout = null;
054: pdm_mainPanel.setLayout(null);
055: pdm_mainPanel.setMinimumSize(new Dimension(800, 600));
056: pdm_mainPanel.setMaximumSize(new Dimension(1024, 768));
057: pdm_mainPanel.setPreferredSize(new Dimension(1000, 680));
058: pdm_mainPane.setViewportView(pdm_mainPanel);
059: }
060: ;
061:
062: this .pem_swingObj = new TitledBorder(new LineBorder(
063: this .pem_color, this .pem_size), xName);
064:
065: this .pdm_mainPane.setBorder(this .pem_swingObj);
066: this .pcmf_setLocalValue(xName);
067:
068: ((HoSwingClient) xAppl).pcmf_addKeyDispatcher(this );
069:
070: return;
071: };
072:
073: public void pcmf_setFont(UnFontDescriptor xFont) {
074: Font l_font = Font.getFont(xFont.pcmf_getFontFullSpec(),
075: new Font(null, xFont.pcmf_getFontStyle(), xFont
076: .pcmf_getFontSize()));
077: this .pem_swingObj.setTitleFont(l_font);
078: super .pcmf_setFont(xFont);
079: return;
080: }
081:
082: public void pcmf_setFgColor(String xCol) {
083: super .pcmf_setFgColor(xCol);
084: this .pem_swingObj.setTitleColor(HoSwingComponent
085: .pcmf_createColor(this .pcmf_getFgColor()));
086: }
087:
088: public void pcmf_setBorderLine(int xBorder) {
089: this .pem_size = xBorder;
090: this .pcmf_setBoStyle(this .pem_boStyle);
091: };
092:
093: public void pcmf_setBoColor(String xColor) {
094: this .pem_color = HoSwingComponent.pcmf_createColor(xColor);
095: this .pcmf_setBoStyle(this .pem_boStyle);
096: };
097:
098: public void pcmf_setBoStyle(int xStyle) {
099: switch (xStyle) {
100: case IUnComponent.LINE_BORDER:
101: this .pem_swingObj = new TitledBorder(new LineBorder(
102: this .pem_color, this .pem_size), this .pcmf_getName());
103: break;
104: case IUnComponent.INSETS_BORDER:
105: this .pem_swingObj = new TitledBorder(new BevelBorder(
106: BevelBorder.LOWERED, this .pem_color, this .pem_color
107: .darker().darker()), this .pcmf_getName());
108: break;
109: case IUnComponent.OUTSETS_BORDER:
110: this .pem_swingObj = new TitledBorder(new BevelBorder(
111: BevelBorder.RAISED, this .pem_color, this .pem_color
112: .darker().darker()), this .pcmf_getName());
113: break;
114: default:
115: this .pem_swingObj = new TitledBorder(new LineBorder(
116: this .pem_color, 0), this .pcmf_getName());
117:
118: this .pem_boStyle = xStyle;
119: }
120:
121: this .pem_swingObj.setTitleColor(HoSwingComponent
122: .pcmf_createColor(this .pcmf_getFgColor()));
123:
124: if (this .pem_scroll) {
125: this .pdm_mainPanel.setBorder(null);
126: this .pdm_mainPane.setBorder(this .pem_swingObj);
127: } else {
128:
129: this .pdm_mainPane.setBorder(null);
130: this .pdm_mainPanel.setBorder(this .pem_swingObj);
131: }
132: }
133:
134: public void pcmf_setClass(String xClass) {
135: return;
136: };
137:
138: public void pcmf_setScroll(boolean xScroll) {
139: this .pem_scroll = xScroll;
140:
141: if (xScroll == true) {
142: super.pdm_realSwingCmp = this.pdm_mainPane;
143: this.pdm_mainPane.setViewportView(this.pdm_mainPanel);
144: this.pdm_mainPanel.setBorder(null);
145: this.pdm_mainPane.setBorder(this.pem_swingObj);
146: } else {
147: super.pdm_realSwingCmp = this.pdm_mainPanel;
148: this.pdm_mainPane.setViewportView(null);
149: this.pdm_mainPane.setBorder(null);
150: this.pdm_mainPanel.setBorder(this.pem_swingObj);
151: }
152: };
153: }
|