Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / javax / swing / plaf / synth / Region.java
blob25d1a11d5e797a6bbd6105b8b74e6132cc0fccbe
1 /* Region.java -- Describes a region within a component
2 Copyright (C) 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing.plaf.synth;
41 /**
42 * Describes a region of a component or the complete component.
44 * @author Roman Kennke (kennke@aicas.com)
46 * @since 1.5
48 public class Region
51 // FIXME: What should ui be for the non-component regions that have
52 // subregion==false?
54 /**
55 * Specifies an arrow button region.
57 public static final Region ARROW_BUTTON =
58 new Region("ArrowButton", null, false);
60 /**
61 * Specifies the region of a standard button.
63 public static final Region BUTTON =
64 new Region("Button", "ButtonUI", false);
66 /**
67 * Specifies the region of a check box.
69 public static final Region CHECK_BOX =
70 new Region("CheckBox", "CheckBoxUI", false);
72 /**
73 * Specifies the region of a check box menu item.
75 public static final Region CHECK_BOX_MENU_ITEM =
76 new Region("CheckBoxMenuItem", "CheckBoxMenuItemUI", false);
78 /**
79 * Specifies the region of a colorchooser.
81 public static final Region COLOR_CHOOSER =
82 new Region("ColorChooser", "ColorChooserUI", false);
84 /**
85 * Specifies the region of a combo box.
87 public static final Region COMBO_BOX =
88 new Region("ComboBox", "ComboBoxUI", false);
90 /**
91 * Specifies the region of a desktop pane.
93 public static final Region DESKTOP_PANE =
94 new Region("DesktopPane", "DesktopPaneUI", false);
96 /**
97 * Specifies the region of a desktop icon.
99 public static final Region DESKTOP_ICON =
100 new Region("DesktopIcon", "DesktopIconUI", false);
103 * Specifies the region of an editor pane.
105 public static final Region EDITOR_PANE =
106 new Region("EditorPane", "EditorPaneUI", false);
109 * Specifies the region of a file chooser.
111 public static final Region FILE_CHOOSER =
112 new Region("FileChooser", "FileChooserUI", false);
115 * Specifies the region of a formatted text field.
117 public static final Region FORMATTED_TEXT_FIELD =
118 new Region("FormattedTextField", "FormattedTextFieldUI", false);
121 * Specifies the region of an internal frame.
123 public static final Region INTERNAL_FRAME =
124 new Region("InternalFrame", "InternalFrameUI", false);
127 * Specifies the region of the title pane of an internal frame.
129 public static final Region INTERNAL_FRAME_TITLE_PANE =
130 new Region("InternalFrameTitlePane", "InternalFrameTitlePaneUI", false);
133 * Specifies the region of a label.
135 public static final Region LABEL =
136 new Region("Label", "LabelUI", false);
139 * Specifies the region of a list.
141 public static final Region LIST =
142 new Region("List", "ListUI", false);
145 * Specifies the region of a menu.
147 public static final Region MENU =
148 new Region("Menu", "MenuUI", false);
151 * Specifies the region of a menu bar.
153 public static final Region MENU_BAR =
154 new Region("MenuBar", "MenuBarUI", false);
157 * Specifies the region of a menu item.
159 public static final Region MENU_ITEM =
160 new Region("MenuItem", "MenuItemUI", false);
163 * Specifies the region of a menu item accelerator. This is a subregion
164 * of menu item.
166 public static final Region MENU_ITEM_ACCELERATOR =
167 new Region("MenuItemAccelerator", null, true);
170 * Specifies the region of an option pane.
172 public static final Region OPTION_PANE =
173 new Region("OptionPane", "OptionPaneUI", false);
176 * Specifies the region of a panel.
178 public static final Region PANEL =
179 new Region("Panel", "PanelUI", false);
182 * Specifies the region of a password field.
184 public static final Region PASSWORD_FIELD =
185 new Region("PasswordField", "PasswordFieldUI", false);
188 * Specifies the region of a popup menu.
190 public static final Region POPUP_MENU =
191 new Region("PopupMenu", "PopupMenuUI", false);
194 * Specifies the region of a popup menu separator.
196 public static final Region POPUP_MENU_SEPARATOR =
197 new Region("PopupMenuSeparator", null, false);
200 * Specifies the region of a progress bar.
202 public static final Region PROGRESS_BAR =
203 new Region("ProgressBar", "ProgressBarUI", false);
206 * Specifies the region of a radio button.
208 public static final Region RADIO_BUTTON =
209 new Region("RadioButton", "RadioButtonUI", false);
212 * Specifies the region of a radio button menu item.
214 public static final Region RADIO_BUTTON_MENU_ITEM =
215 new Region("RadioButtonMenuItem", "RadioButtonMenuItemUI", false);
218 * Specifies the region of a root pane.
220 public static final Region ROOT_PANE =
221 new Region("RootPane", "RootPaneUI", false);
224 * Specifies the region of a scroll bar.
226 public static final Region SCROLL_BAR =
227 new Region("ScrollBar", "ScrollBarUI", false);
230 * Specifies the region of a scroll bar track. This is a subregion of
231 * scroll bars.
233 public static final Region SCROLL_BAR_TRACK =
234 new Region("ScrollBarTrack", null, true);
237 * Specifies the region of a scroll bar thumb. This is a subregion of
238 * scroll bars.
240 public static final Region SCROLL_BAR_THUMB =
241 new Region("ScrollBarThumb", null, true);
244 * Specifies the region of a scroll pane.
246 public static final Region SCROLL_PANE =
247 new Region("ScrollPane", "ScrollPaneUI", false);
250 * Specifies the region of a separator.
252 public static final Region SEPARATOR =
253 new Region("Separator", "SeparatorUI", false);
256 * Specifies the region of a slider.
258 public static final Region SLIDER =
259 new Region("Slider", "SliderUI", false);
262 * Specifies the region of a slider track. This is a subregion of a slider.
264 public static final Region SLIDER_TRACK =
265 new Region("SliderTrack", null, true);
268 * Specifies the region of a slider thumb. This is a subregion of a slider.
270 public static final Region SLIDER_THUMB =
271 new Region("SliderThumb", null, true);
274 * Specifies the region of a spinner.
276 public static final Region SPINNER =
277 new Region("Spinner", "SpinnerUI", false);
280 * Specifies the region of a split pane.
282 public static final Region SPLIT_PANE =
283 new Region("SplitPane", "SplitPaneUI", false);
286 * Specifies the region of a split pane divider. This is a subregion of
287 * a split pane.
289 public static final Region SPLIT_PANE_DIVIDER =
290 new Region("SplitPaneDivider", null, true);
293 * Specifies the region of a tabbed pane.
295 public static final Region TABBED_PANE =
296 new Region("TabbedPane", "TabbedPaneUI", false);
299 * This specifies the region of a tab of a tabbed pane. This is a subregion
300 * of a tabbed pane.
302 public static final Region TABBED_PANE_TAB =
303 new Region("TabbedPaneTab", null, true);
306 * This specifies the region underneath the tabs of a tabbed pane. This is a
307 * subregion of a tabbed pane.
309 public static final Region TABBED_PANE_TAB_AREA =
310 new Region("TabbedPaneTabArea", null, true);
313 * This specifies the region for the content of a tabbed pane. This is a
314 * subregion of a tabbed pane.
316 public static final Region TABBED_PANE_CONTENT =
317 new Region("TabbedPaneContent", null, true);
320 * Specifies the region of a table.
322 public static final Region TABLE =
323 new Region("Table", "TableUI", false);
326 * Specifies the region of a table header.
328 public static final Region TABLE_HEADER =
329 new Region("TableHeader", "TableHeaderUI", false);
332 * Specifies the region of a text area.
334 public static final Region TEXT_AREA =
335 new Region("TextArea", "TextAreaUI", false);
338 * Specifies the region of a text field.
340 public static final Region TEXT_FIELD =
341 new Region("TextField", "TextFieldUI", false);
344 * Specifies the region of a text pane.
346 public static final Region TEXT_PANE =
347 new Region("TextPane", "TextPaneUI", false);
350 * Specifies the region of a toggle button.
352 public static final Region TOGGLE_BUTTON =
353 new Region("ToggleButton", "ToggleButtonUI", false);
356 * Specifies the region of a tool bar.
358 public static final Region TOOL_BAR =
359 new Region("ToolBar", "ToolBarUI", false);
362 * Specifies the content region of a tool bar. This is a subregion of a tool
363 * bar.
365 public static final Region TOOL_BAR_CONTENT =
366 new Region("ToolBarContent", null, true);
369 * Specifies the drag window region of a tool bar. This is a subregion of a
370 * tool bar.
372 public static final Region TOOL_BAR_DRAG_WINDOW =
373 new Region("ToolBarDragWindow", null, false);
376 * Specifies the region of a tool tip.
378 public static final Region TOOL_TIP =
379 new Region("ToolTip", "ToolTipUI", false);
382 * Specifies the region of a separator of a tool bar. This is a subregion of
383 * a tool bar.
385 public static final Region TOOL_BAR_SEPARATOR =
386 new Region("ToolBarSeparator", null, false);
389 * Specifies the region of a tree.
391 public static final Region TREE =
392 new Region("Tree", "TreeUI", false);
395 * Specifies the region of a tree cell. This is a subregion of a tree.
397 public static final Region TREE_CELL =
398 new Region("TreeCell", null, true);
401 * Specifies the region of a viewport.
403 public static final Region VIEWPORT =
404 new Region("Viewport", "ViewportUI", false);
408 * The UI class id for the region. This is package private because this will
409 * be used by other classes in that package.
411 String ui;
414 * The name of the region.
416 private String name;
419 * If this region is a subregion or not.
421 private boolean subregion;
424 * Creates a new <code>Region</code> with the specified name and ui ID.
425 * The <code>ui</code> must be the same what
426 * {@link javax.swing.JComponent#getUIClassID()} returns for toplevel regions. For
427 * subregions this should be <code>null</code>.
429 * @param name the name of the region
430 * @param ui the UI class ID of the region or <code>null</code> for
431 * subregions
432 * @param subregion <code>true</code> if this region is a subregion,
433 * <code>false</code> otherwise
435 protected Region(String name, String ui, boolean subregion)
437 this.name = name;
438 this.ui = ui;
439 this.subregion = subregion;
443 * Returns <code>true</code> if this region describes a subregion of a
444 * component, <code>false</code> if it describes a component region itself.
446 * @return <code>true</code> if this region describes a subregion of a
447 * component, <code>false</code> if it describes a component region
448 * itself
450 public boolean isSubregion()
452 return subregion;
456 * Returns the name of the region.
458 * @return the name of the region
460 public String getName()
462 return name;
466 * Returns the name of the region.
468 * @return the name of the region
470 public String toString()
472 return name;