001: /*
002: * Copyright (C) 2004 NNL Technology AB
003: * Visit www.infonode.net for information about InfoNode(R)
004: * products and how to contact NNL Technology AB.
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
019: * MA 02111-1307, USA.
020: */
021:
022: // $Id: PropertiesUtil.java,v 1.16 2005/12/04 13:46:05 jesper Exp $
023: package net.infonode.docking.util;
024:
025: import net.infonode.docking.properties.RootWindowProperties;
026: import net.infonode.tabbedpanel.TabAreaVisiblePolicy;
027: import net.infonode.tabbedpanel.TabLayoutPolicy;
028: import net.infonode.util.Direction;
029:
030: /**
031: * Utility functions for manipulating properties.
032: *
033: * @author johan
034: * @since IDW 1.4.0
035: */
036: public class PropertiesUtil {
037: private PropertiesUtil() {
038: }
039:
040: /**
041: * <p>
042: * Creates and returns a new {@link RootWindowProperties} object that is meant to be
043: * added as super object on another {@link RootWindowProperties} object, for example
044: * a theme's {@link RootWindowProperties}.
045: * </p>
046: *
047: * <p>
048: * The created properties object will have title bar style properties set, see
049: * {@link #setTitleBarStyle(RootWindowProperties)}.
050: * </p>
051: *
052: * @return created properties object
053: */
054: public static RootWindowProperties createTitleBarStyleRootWindowProperties() {
055: RootWindowProperties titleBarStyleProperties = new RootWindowProperties();
056: setupTitleBarStyleProperties(titleBarStyleProperties);
057: return titleBarStyleProperties;
058: }
059:
060: /**
061: * <p>
062: * Sets title bar style in the given root window properties object.
063: * </p>
064: *
065: * <p>
066: * This function sets properties in the give {@link RootWindowProperties} object:
067: * </p>
068: * <ul>
069: * <li>View title bars are made visible at the top of a view.</li>
070: * <li>Tab area is oriented below the content area.</li>
071: * <li>No tab buttons are visible (except custom buttons).</li>
072: * <li>No tab window buttons except scroll buttons, drop down list button
073: * and custom buttons.</li>
074: * <li>Hide the entire tab area when a tab window contains a view as the
075: * only child.</li>
076: * </ul>
077: *
078: * <p>
079: * <strong>Note:</strong> It will modify properties values in the object
080: * without checking if it was already set i.e. overwriting the previous
081: * value.
082: * </p>
083: *
084: * @param rootProps {@link RootWindowProperties} object to modify
085: */
086: public static void setTitleBarStyle(RootWindowProperties rootProps) {
087: setupTitleBarStyleProperties(rootProps);
088: }
089:
090: private static void setupTitleBarStyleProperties(
091: RootWindowProperties titleBarStyleProperties) {
092: titleBarStyleProperties.getViewProperties()
093: .getViewTitleBarProperties().setVisible(true);
094: titleBarStyleProperties.getTabWindowProperties()
095: .getTabbedPanelProperties().setTabAreaOrientation(
096: Direction.DOWN).setTabLayoutPolicy(
097: TabLayoutPolicy.SCROLLING);
098: titleBarStyleProperties.getTabWindowProperties()
099: .getTabbedPanelProperties().getTabAreaProperties()
100: .setTabAreaVisiblePolicy(
101: TabAreaVisiblePolicy.MORE_THAN_ONE_TAB);
102:
103: titleBarStyleProperties.getTabWindowProperties()
104: .getTabProperties().getHighlightedButtonProperties()
105: .getMinimizeButtonProperties().setVisible(false);
106: titleBarStyleProperties.getTabWindowProperties()
107: .getTabProperties().getHighlightedButtonProperties()
108: .getRestoreButtonProperties().setVisible(false);
109: titleBarStyleProperties.getTabWindowProperties()
110: .getTabProperties().getHighlightedButtonProperties()
111: .getCloseButtonProperties().setVisible(false);
112: titleBarStyleProperties.getTabWindowProperties()
113: .getTabProperties().getHighlightedButtonProperties()
114: .getUndockButtonProperties().setVisible(false);
115: titleBarStyleProperties.getTabWindowProperties()
116: .getTabProperties().getHighlightedButtonProperties()
117: .getDockButtonProperties().setVisible(false);
118:
119: titleBarStyleProperties.getTabWindowProperties()
120: .getCloseButtonProperties().setVisible(false);
121: titleBarStyleProperties.getTabWindowProperties()
122: .getMaximizeButtonProperties().setVisible(false);
123: titleBarStyleProperties.getTabWindowProperties()
124: .getMinimizeButtonProperties().setVisible(false);
125: titleBarStyleProperties.getTabWindowProperties()
126: .getUndockButtonProperties().setVisible(false);
127: titleBarStyleProperties.getTabWindowProperties()
128: .getDockButtonProperties().setVisible(false);
129: titleBarStyleProperties.getTabWindowProperties()
130: .getRestoreButtonProperties().setVisible(false);
131:
132: titleBarStyleProperties.getWindowBarProperties()
133: .getTabWindowProperties().getTabProperties()
134: .getHighlightedButtonProperties()
135: .getMinimizeButtonProperties().setVisible(true);
136: titleBarStyleProperties.getWindowBarProperties()
137: .getTabWindowProperties().getTabProperties()
138: .getHighlightedButtonProperties()
139: .getRestoreButtonProperties().setVisible(true);
140: titleBarStyleProperties.getWindowBarProperties()
141: .getTabWindowProperties().getTabProperties()
142: .getHighlightedButtonProperties()
143: .getCloseButtonProperties().setVisible(true);
144: titleBarStyleProperties.getWindowBarProperties()
145: .getTabWindowProperties().getTabProperties()
146: .getHighlightedButtonProperties()
147: .getUndockButtonProperties().setVisible(true);
148: titleBarStyleProperties.getWindowBarProperties()
149: .getTabWindowProperties().getTabProperties()
150: .getHighlightedButtonProperties()
151: .getDockButtonProperties().setVisible(true);
152:
153: titleBarStyleProperties.getWindowBarProperties()
154: .getTabWindowProperties().getTabbedPanelProperties()
155: .setTabLayoutPolicy(TabLayoutPolicy.SCROLLING);
156: }
157: }
|