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: import com.salmonllc.properties.*;
023:
024: /**
025: * Concrete implementation of the Customize Skin Controller, used for web based skins
026: */
027: public class CustomizeWebSkinController extends CustomizeSkinController {
028: public com.salmonllc.html.HtmlSubmitButton _applyBorderBox;
029: public com.salmonllc.html.HtmlSubmitButton _applyButton;
030: public com.salmonllc.html.HtmlSubmitButton _applyCalendar;
031: public com.salmonllc.html.HtmlSubmitButton _applyDataGrid;
032: public com.salmonllc.html.HtmlSubmitButton _applyDisplayBox;
033: public com.salmonllc.html.HtmlSubmitButton _applyFont;
034: public com.salmonllc.html.HtmlSubmitButton _applyNavBar;
035: public com.salmonllc.html.HtmlSubmitButton _applyPage;
036:
037: public com.salmonllc.jsp.JspTableRow _borderBox;
038: public com.salmonllc.jsp.JspTableRow _button;
039: public com.salmonllc.jsp.JspTableRow _calendar;
040: public com.salmonllc.jsp.JspTableRow _datagrid;
041: public com.salmonllc.jsp.JspTableRow _displayBox;
042: public com.salmonllc.jsp.JspTableRow _font;
043: public com.salmonllc.jsp.JspTableRow _navbar;
044: public com.salmonllc.jsp.JspTableRow _page;
045:
046: public com.salmonllc.jsp.JspLink _showBorderBox;
047: public com.salmonllc.jsp.JspLink _showButton;
048: public com.salmonllc.jsp.JspLink _showCalendar;
049: public com.salmonllc.jsp.JspLink _showDatagrid;
050: public com.salmonllc.jsp.JspLink _showFont;
051: public com.salmonllc.jsp.JspLink _showDisplayBox;
052: public com.salmonllc.jsp.JspLink _showNavbar;
053: public com.salmonllc.jsp.JspLink _showPage;
054:
055: public com.salmonllc.sql.DataStore _datasource1;
056:
057: /**
058: * Set up the page
059: */
060: public void initialize() {
061: //set up defaults for the page
062: super .initialize();
063: setSwing(false, "page");
064:
065: //Now set up each property
066:
067: //Page Properties
068: int row = 0;
069: HtmlTable tab = new HtmlTable("pageProperties", this );
070: replaceComponent("propertiesPage", tab);
071: row = addProperty(tab, row, "Background Color",
072: Props.PAGE_BACKGROUND_COLOR, TYPE_COLOR, true);
073: row = addProperty(tab, row, "Link Color",
074: Props.PAGE_LINK_COLOR, TYPE_COLOR, true);
075: row = addProperty(tab, row, "Visited Link Color",
076: Props.PAGE_VISITED_LINK_COLOR, TYPE_COLOR, true);
077: row = addProperty(tab, row, "Active Link Color",
078: Props.PAGE_ACTIVE_LINK_COLOR, TYPE_COLOR, false);
079: _applyPage.addSubmitListener(this );
080: _showPage.addSubmitListener(this );
081:
082: //Fonts Properties
083: row = 0;
084: tab = new HtmlTable("fonts", this );
085: replaceComponent("propertiesFont", tab);
086: row = addProperty(tab, row, "Page Heading",
087: Props.FONT_PAGE_HEADING, TYPE_FONT, true);
088: row = addProperty(tab, row, "Section Heading",
089: Props.FONT_SECTION_HEADING, TYPE_FONT, true);
090: row = addProperty(tab, row, "Emphasis", Props.FONT_EMPHASIS,
091: TYPE_FONT, true);
092: row = addProperty(tab, row, "Error Message", Props.FONT_ERROR,
093: TYPE_FONT, true);
094: row = addProperty(tab, row, "Default", Props.FONT_DEFAULT,
095: TYPE_FONT, true);
096: row = addProperty(tab, row, "Standard Link", Props.FONT_LINK,
097: TYPE_FONT, true);
098: row = addProperty(tab, row, "Large Link",
099: Props.FONT_LARGE_LINK, TYPE_FONT, true);
100: row = addProperty(tab, row, "Small", Props.FONT_SMALL,
101: TYPE_FONT, false);
102: _applyFont.addSubmitListener(this );
103: _showFont.addSubmitListener(this );
104:
105: //Display Box Properties
106: row = 0;
107: tab = new HtmlTable("displayBoxProperties", this );
108: replaceComponent("propertiesDisplayBox", tab);
109: row = addProperty(tab, row, "Background Color",
110: Props.DISPLAY_BOX_BACKGROUND_COLOR, TYPE_COLOR, true);
111: row = addProperty(tab, row, "Heading Background Color",
112: Props.DISPLAY_BOX_HEADING_BACKGROUND_COLOR, TYPE_COLOR,
113: true);
114: row = addProperty(tab, row, "Heading Font",
115: Props.FONT_DISPLAY_BOX_HEADING, TYPE_FONT, true);
116: row = addProperty(tab, row, "Border Width",
117: Props.DISPLAY_BOX_BORDER, TYPE_INT, false);
118: row = addProperty(tab, row, "Cell Spacing",
119: Props.DISPLAY_BOX_CELLSPACING, TYPE_INT, false);
120: row = addProperty(tab, row, "Cell Padding",
121: Props.DISPLAY_BOX_CELLPADDING, TYPE_INT, false);
122: _applyDisplayBox.addSubmitListener(this );
123: _showDisplayBox.addSubmitListener(this );
124:
125: //border box properties
126: row = 0;
127: tab = new HtmlTable("borderBoxProperties", this );
128: replaceComponent("propertiesBorderBox", tab);
129: row = addProperty(tab, row, "Background Color",
130: Props.BOX_BG_COLOR, TYPE_COLOR, true);
131: row = addProperty(tab, row, "Line Color", Props.BOX_LINE_COLOR,
132: TYPE_COLOR, true);
133: row = addProperty(tab, row, "Line Width", Props.BOX_LINE_WIDTH,
134: TYPE_INT, false);
135: row = addProperty(tab, row, "Margin Width", Props.BOX_MARGIN,
136: TYPE_INT, false);
137: _applyBorderBox.addSubmitListener(this );
138: _showBorderBox.addSubmitListener(this );
139:
140: //data table properties
141: row = 0;
142: tab = new HtmlTable("datatableProperties", this );
143: replaceComponent("propertiesDataGrid", tab);
144: row = addProperty(tab, row, "Background Color",
145: Props.DATA_TABLE_BACKGROUND_COLOR, TYPE_COLOR, true);
146: row = addProperty(tab, row, "Heading Background Color",
147: Props.DATA_TABLE_HEADING_BACKGROUND_COLOR, TYPE_COLOR,
148: true);
149: row = addProperty(tab, row, "Heading Font",
150: Props.FONT_TABLE_HEADING, TYPE_FONT, true);
151: row = addProperty(tab, row, "Row Stripe Color 1",
152: Props.DATA_TABLE_ROW_BACKGROUND_COLOR_1, TYPE_COLOR,
153: true);
154: row = addProperty(tab, row, "Row Stripe Color 2",
155: Props.DATA_TABLE_ROW_BACKGROUND_COLOR_2, TYPE_COLOR,
156: true);
157: row = addProperty(tab, row, "Border Width",
158: Props.DATA_TABLE_BORDER, TYPE_INT, false);
159: row = addProperty(tab, row, "Cell Spacing",
160: Props.DATA_TABLE_CELLSPACING, TYPE_INT, false);
161: row = addProperty(tab, row, "Cell Padding",
162: Props.DATA_TABLE_CELLPADDING, TYPE_INT, false);
163: for (int i = 0; i < 2; i++) {
164: _datasource1.insertRow();
165: try {
166: _datasource1.setString("b1", "Sample Column 1");
167: _datasource1.setString("b2", "Sample Column 2");
168: } catch (Exception ex) {
169: }
170: }
171: _applyDataGrid.addSubmitListener(this );
172: _showDatagrid.addSubmitListener(this );
173:
174: //calendar properties
175: row = 0;
176: tab = new HtmlTable("calendarProperties", this );
177: replaceComponent("propertiesCalendar", tab);
178: row = addProperty(tab, row, "Heading Background Color",
179: Props.CAL_HEADING_BACKGROUND_COLOR, TYPE_COLOR, true);
180: row = addProperty(tab, row, "Heading Foreground Color",
181: Props.CAL_HEADING_FOREGROUND_COLOR, TYPE_COLOR, true);
182: row = addProperty(tab, row, "Week Background Color",
183: Props.CAL_WEEK_BACKGROUND_COLOR, TYPE_COLOR, true);
184: row = addProperty(tab, row, "Week Foreground Color",
185: Props.CAL_WEEK_FOREGROUND_COLOR, TYPE_COLOR, true);
186: row = addProperty(tab, row, "Day Background Color",
187: Props.CAL_DAY_BACKGROUND_COLOR, TYPE_COLOR, true);
188: row = addProperty(tab, row, "Day Foreground Color",
189: Props.CAL_DAY_FOREGROUND_NORMAL, TYPE_COLOR, true);
190: row = addProperty(tab, row, "Day Foreground Color (dif month)",
191: Props.CAL_DAY_FOREGROUND_DEEMPHISIS, TYPE_COLOR, true);
192: row = addProperty(tab, row, "Day Foreground Color (today)",
193: Props.CAL_DAY_FOREGROUND_CURRENT, TYPE_COLOR, true);
194: row = addProperty(tab, row, "Large Font Size",
195: Props.CAL_FONT_LARGE, TYPE_INT, false);
196: row = addProperty(tab, row, "Small Font Size",
197: Props.CAL_FONT_SMALL, TYPE_INT, false);
198: _applyCalendar.addSubmitListener(this );
199: _showCalendar.addSubmitListener(this );
200:
201: //navbar properties
202: row = 0;
203: tab = new HtmlTable("navbarProperties", this );
204: replaceComponent("propertiesNavBar", tab);
205: row = addProperty(tab, row, "Background Color",
206: Props.NAVBAR_BG_COLOR, TYPE_COLOR, true);
207: row = addProperty(tab, row, "Group Background Color",
208: Props.NAVBAR_GROUP_CELL_BG_COLOR, TYPE_COLOR, true);
209: row = addProperty(tab, row, "Item Background Color",
210: Props.NAVBAR_CELL_BG_COLOR, TYPE_COLOR, true);
211: row = addProperty(tab, row, "Popup Background Color",
212: Props.NAVBAR_SUBMENU_BG_COLOR, TYPE_COLOR, true);
213: row = addProperty(tab, row, "Embeded Popup Background Color",
214: Props.NAVBAR_SHOW_POPUP_BG_COLOR, TYPE_COLOR, true);
215: row = addProperty(tab, row, "Selected Background Color",
216: Props.NAVBAR_SELECTED_BG_COLOR, TYPE_COLOR, true);
217: row = addProperty(tab, row, "Group Link Font",
218: Props.NAVBAR_GROUP_HREF_STYLE, TYPE_STYLE_FONT, true);
219: row = addProperty(tab, row, "Group Hover Font",
220: Props.NAVBAR_GROUP_HOVER_STYLE, TYPE_STYLE_FONT, true);
221: row = addProperty(tab, row, "Link Font",
222: Props.NAVBAR_HREF_STYLE, TYPE_STYLE_FONT, true);
223: row = addProperty(tab, row, "Hover Font",
224: Props.NAVBAR_HOVER_STYLE, TYPE_STYLE_FONT, true);
225: row = addProperty(tab, row, "Text Font",
226: Props.NAVBAR_TEXT_STYLE, TYPE_STYLE_FONT, true);
227: row = addProperty(tab, row, "Selected Font",
228: Props.NAVBAR_SELECTED_STYLE, TYPE_STYLE_FONT, true);
229: row = addProperty(tab, row, "Selected and Hover Font",
230: Props.NAVBAR_SELECTED_HOVER_STYLE, TYPE_STYLE_FONT,
231: false);
232: _applyNavBar.addSubmitListener(this );
233: _showNavbar.addSubmitListener(this );
234:
235: //button properties
236: row = 0;
237: tab = new HtmlTable("buttonProperties", this );
238: replaceComponent("propertiesButton", tab);
239: row = addProperty(tab, row, "Background Color",
240: Props.BUTTON_BG_COLOR, TYPE_COLOR, true);
241: row = addProperty(tab, row, "Font", Props.BUTTON_FONT_STYLE,
242: TYPE_STYLE_FONT, false);
243: _applyButton.addSubmitListener(this );
244: _showButton.addSubmitListener(this );
245: }
246:
247: /**
248: *display a particular screen when the user clicks a link
249: */
250: protected void showTab(String name) {
251: _borderBox.setVisible(false);
252: _button.setVisible(false);
253: _calendar.setVisible(false);
254: _datagrid.setVisible(false);
255: _displayBox.setVisible(false);
256: _font.setVisible(false);
257: _navbar.setVisible(false);
258: _page.setVisible(false);
259: if (name.startsWith("show"))
260: name = Character.toLowerCase(name.charAt(4))
261: + name.substring(5);
262: getComponent(name).setVisible(true);
263: }
264: }
|