001: //The Salmon Open Framework for Internet Applications (SOFIA)
002: //Copyright (C) 1999 - 2002, Salmon LLC
003: //
004: //This program is free software; you can redistribute it and/or
005: //modify it under the terms of the GNU General Public License version 2
006: //as published by the Free Software Foundation;
007: //
008: //This program is distributed in the hope that it will be useful,
009: //but WITHOUT ANY WARRANTY; without even the implied warranty of
010: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: //GNU General Public License for more details.
012: //
013: //You should have received a copy of the GNU General Public License
014: //along with this program; if not, write to the Free Software
015: //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
016: //
017: //For more information please visit http://www.salmonllc.com
018:
019: package com.salmonllc.examples.example16;
020:
021: import com.salmonllc.html.*;
022:
023: /**
024: * Concrete implementation of the Customize Skin Controller, used for web based skins
025: */
026: public class CustomizeSwingSkinController extends
027: CustomizeSkinController {
028:
029: public com.salmonllc.jsp.JspLink _showPrimary;
030: public com.salmonllc.jsp.JspLink _showText;
031:
032: public com.salmonllc.html.HtmlSubmitButton _applyPrimary;
033: public com.salmonllc.html.HtmlSubmitButton _applyText;
034:
035: public com.salmonllc.jsp.JspTableRow _primary;
036: public com.salmonllc.jsp.JspTableRow _text;
037:
038: /**
039: * Set up the page
040: */
041: public void initialize() {
042: //set up defaults for the page
043: super .initialize();
044: setSwing(true, "primary");
045:
046: //Now set up each property
047:
048: //Primary and secondarys
049: int row = 0;
050: HtmlTable tab = new HtmlTable("primaryProperties", this );
051: replaceComponent("propertiesPrimary", tab);
052: row = addProperty(tab, row,
053: "Primary Color 1 (Scroll Bar Highlights)", "primary1",
054: TYPE_COLOR, true);
055: row = addProperty(tab, row,
056: "Primary Color 2 (Scroll Bar Background)", "primary2",
057: TYPE_COLOR, true);
058: row = addProperty(tab, row,
059: "Primary Color 3 (Selected Text Background)",
060: "primary3", TYPE_COLOR, true);
061: row = addProperty(tab, row,
062: "Secondary Color 1 (Button Borders)", "secondary1",
063: TYPE_COLOR, true);
064: row = addProperty(tab, row, "Secondary Color 2 (Table Lines)",
065: "secondary2", TYPE_COLOR, true);
066: row = addProperty(tab, row,
067: "Secondary Color 3 (Panel Background)", "secondary3",
068: TYPE_COLOR, false);
069: _applyPrimary.addSubmitListener(this );
070: _showPrimary.addSubmitListener(this );
071:
072: //Text
073: row = 0;
074: tab = new HtmlTable("textProperties", this );
075: replaceComponent("propertiesText", tab);
076: row = addProperty(tab, row, "Enabled Button Text Color",
077: "controlTextColor", TYPE_COLOR, true);
078: row = addProperty(tab, row, "Disabled Button Text Color",
079: "controlDisabled", TYPE_COLOR, true);
080: row = addProperty(tab, row, "Enabled Text Edit Text Color",
081: "userTextColor", TYPE_COLOR, true);
082: row = addProperty(tab, row, "Disabled Text Edit Text Color",
083: "inactiveSystemTextColor", TYPE_COLOR, true);
084: row = addProperty(tab, row, "Label Color", "systemTextColor",
085: TYPE_COLOR, true);
086: row = addProperty(tab, row, "Font for Buttons and Labels",
087: "controlTextFont", TYPE_FONT, true);
088: row = addProperty(tab, row, "Font for Text Edit and Table",
089: "userTextFont", TYPE_FONT, true);
090:
091: _applyText.addSubmitListener(this );
092: _showText.addSubmitListener(this );
093:
094: }
095:
096: /**
097: *display a particular screen when the user clicks a link
098: */
099: protected void showTab(String name) {
100: _primary.setVisible(false);
101: _text.setVisible(false);
102: if (name.startsWith("show"))
103: name = Character.toLowerCase(name.charAt(4))
104: + name.substring(5);
105: getComponent(name).setVisible(true);
106: }
107: }
|