001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.core.windows;
043:
044: import java.awt.Dimension;
045: import javax.swing.JSplitPane;
046: import org.netbeans.swing.tabcontrol.TabbedContainer;
047: import org.openide.util.Utilities;
048:
049: /**
050: * Constants in window system.
051: *
052: * @author Peter Zavadsky
053: */
054: public abstract class Constants {
055:
056: /** Constant that identifies state of editor area */
057: public static final int EDITOR_AREA_JOINED = 0;
058: public static final int EDITOR_AREA_SEPARATED = 1;
059:
060: /** Constant that identifies mode state. */
061: public static final int MODE_STATE_JOINED = 0;
062: public static final int MODE_STATE_SEPARATED = 1;
063:
064: /** Constant that identifies mode kind */
065: public static final int MODE_KIND_EDITOR = TabbedContainer.TYPE_EDITOR;
066: public static final int MODE_KIND_VIEW = TabbedContainer.TYPE_VIEW;
067: public static final int MODE_KIND_SLIDING = TabbedContainer.TYPE_SLIDING;
068:
069: /** Vertical orientation constant used in constraint. */
070: public static final int VERTICAL = JSplitPane.VERTICAL_SPLIT;
071: /** Horizontal orientation constant used in constraint. */
072: public static final int HORIZONTAL = JSplitPane.HORIZONTAL_SPLIT;
073:
074: /** Sides of attaching, used both for regular modes and sliding modes */
075: public static final String TOP = JSplitPane.TOP;
076: public static final String BOTTOM = JSplitPane.BOTTOM;
077: public static final String LEFT = JSplitPane.LEFT;
078: public static final String RIGHT = JSplitPane.RIGHT;
079:
080: public static final int DIVIDER_SIZE_VERTICAL = 4;
081: public static final int DIVIDER_SIZE_HORIZONTAL = 5;
082:
083: /** Sets size of drop area (when splitting mode and around area). */
084: public static final int DROP_AREA_SIZE = 20;
085:
086: /** How many pixels is necessary to drag to start the DnD. */
087: public static final int DRAG_GESTURE_START_DISTANCE = 10;
088: /** What time inmilliseconds is necessary to hold dragging mouse button for
089: & DnD to be started */
090: public static final int DRAG_GESTURE_START_TIME = 200;
091:
092: // DnD drop ratios.
093: /** How big portion of the original mode has to be taken (range from 0.0 to 1.0). */
094: public static final double DROP_TO_SIDE_RATIO = 0.25D;
095: /** How big portion should take the new mode from each one (between which is dropped) (range from 0.0 to 1.0). */
096: public static final double DROP_BETWEEN_RATIO = 1.0D / 3;
097: /** How big portion of entire area should take the dropped mode (range from 0.0 to 1.0). */
098: public static final double DROP_AROUND_RATIO = 0.25D;
099:
100: // XXX
101: /** Size of new separated mode when creting during DnD (separeted mode). */
102: public static final Dimension DROP_NEW_MODE_SIZE = new Dimension(
103: 300, 200);
104:
105: /** Name of client property (of Boolean type) which says whether the TopComponent is allowed
106: * to be docked anywhere (even crossing view-editor border). */
107: public static final String TOPCOMPONENT_ALLOW_DOCK_ANYWHERE = "TopComponentAllowDockAnywhere"; // NOI18N
108:
109: /** Client property to distinguish JWindows/JDialogs used as ui elements
110: * for separate modes - floating windows.
111: */
112: public static final String SEPARATE_WINDOW_PROPERTY = "SeparateWindow";
113:
114: // System properties (switches):
115: /** Allows user to move <code>TopComponent</code>S between document and view modes,
116: * which is restricted otherwise. */
117: public static final boolean SWITCH_MODE_ADD_NO_RESTRICT = Boolean
118: .getBoolean("netbeans.winsys.allow.dock.anywhere"); // NOI18N
119: /** Disables DnD of <code>TopComponent</code>S. */
120: public static final boolean SWITCH_DND_DISABLE = Boolean
121: .getBoolean("netbeans.winsys.disable_dnd"); // NOI18N
122: /** During DnD it provides nicer feedback (fading of possible drop), however performance is worsen in that case. */
123: public static final boolean SWITCH_DROP_INDICATION_FADE = Boolean
124: .getBoolean("netbeans.winsys.dndfade.on"); //NOI18N
125: /** Shows the status line at the end of menu bar instead of at the bottom of main window. */
126: public static final boolean SWITCH_STATUSLINE_IN_MENUBAR = Boolean
127: .getBoolean("netbeans.winsys.statusLine.in.menuBar"); // NOI18N
128:
129: /** Gets the image resource to be used in the empty editor area. */
130: public static final String SWITCH_IMAGE_SOURCE = System
131: .getProperty("netbeans.winsys.imageSource"); // NOI18N
132:
133: // XXX #37999
134: /** For view, do not show emty documents area, i.e. when no document is opened. */
135: public static final boolean SWITCH_HIDE_EMPTY_DOCUMENT_AREA = Boolean
136: .getBoolean("netbeans.winsys.hideEmptyDocArea"); // NOI18N
137:
138: //Issue 39166, OS-X will display a strange gray rectangle while dragging - they
139: //really require an image to be supplied. Leaving this off for other platforms pending
140: //HIE approval and performance impact evaluation - probably safe for Windows, probably
141: //a big performance hit on Linux. Appears that XP L&F will not display images even if
142: //supplied.
143: public static final boolean SWITCH_USE_DRAG_IMAGES = Boolean
144: .getBoolean("netbeans.winsys.dragimage")
145: || Utilities.isMac();
146:
147: /** Allowing complete removal of toolbars. */
148: public static final boolean NO_TOOLBARS = Boolean
149: .getBoolean("netbeans.winsys.no_toolbars"); // NOI18N
150:
151: /** File name whose InstanceCookie can contain custom menu bar component.*/
152: public static final String CUSTOM_MENU_BAR_PATH = System
153: .getProperty("netbeans.winsys.menu_bar.path"); // NOI18N
154:
155: /** File name whose InstanceCookie can contain custom status line component.*/
156: public static final String CUSTOM_STATUS_LINE_PATH = System
157: .getProperty("netbeans.winsys.status_line.path"); // NOI18N
158:
159: /** If set to true the help button will not be shown in the dialogs.*/
160: public static final boolean DO_NOT_SHOW_HELP_IN_DIALOGS = Boolean
161: .getBoolean("netbeans.winsys.no_help_in_dialogs"); // NOI18N
162:
163: /** True means automatic iconification/deiconification of all separate frames if main window is iconified/deiconified */
164: public static final boolean AUTO_ICONIFY = Boolean
165: .getBoolean("netbeans.winsys.auto_iconify"); // NOI18N
166:
167: private Constants() {
168: }
169: }
|