SplitterLayout is a layout manager that will layout a container holding
other components and SplitterBars.
Each component added to a container to be laid out using SplitterLayout
must provide a String containing a "weight" for the component. This
weight will be used to determine the initial spacing of all components
being laid out. The weight numbers are arbitrary integers. The
amount of space initially allocated for a component is
(wc/wt) * (size-insets-splitterSize)
where
- wc
- the weight number for the component
- wt
- the total weight of all visible components in the container
- size
- the space free to display the components
- insets
- space used by insets in the container
- splitterSize
- amount of space needed to display SplitterBars
If the container being laid out holds no SplitterBars, SplitterLayout
acts like a relational-weight layout manager. All components are always
laid out based on their proportionate weights.
If the container being laid out holds some SplitterBars, SplitterLayout
will initially size all non JSplitterBar components based on their weights.
Any succesive layouts are computed strictly on the locations of the
SplitterBars.
SplitterLayout can be oriented Horizontally or Vertically. Any SpliterBars
placed in the container will automatically be oriented.
If a JSplitterBar has been modified (adding components to it) you will
need to add JSplitterSpace components to it. See JSplitterBar for more
details.
Known Problems:
- If there are any SplitterBars contained in the container,
it is best to have them between every non-JSplitterBar.
Otherwise, once SplitterBars are moved, some components will
use their proportional size while others will use the
JSplitterBar positions. (Non-Splitterbars will check the next
component to see if it's a JSplitterBar. If it's not, it uses
its proportional size.) This may eventually be changed...
- Results of adding new SplitterBars to an existing (and user-
interacted) SplitterLayout-laid container might be a bit
unpredictable. The safest way to ensure the container is laid
out correctly would be to explicitly set all pre-existing
JSplitterBar positions to (0,0). This will cause the relational
layout algorithm to take effect.
Use this code at your own risk! MageLang Institute is not
responsible for any damage caused directly or indirctly through
use of this code.
SOFTWARE RIGHTS
MageLang support classes, version 1.0, MageLang Institute
We reserve no legal rights to this code--it is fully in the
public domain. An individual or company may do whatever
they wish with source code distributed with it, including
including the incorporation of it into commerical software.
However, this code cannot be sold as a standalone product.
We encourage users to develop software with this code. However,
we do ask that credit is given to us for developing it
By "credit", we mean that if you use these components or
incorporate any source code into one of your programs
(commercial product, research project, or otherwise) that
you acknowledge this fact somewhere in the documentation,
research report, etc... If you like these components and have
developed a nice tool with the output, please mention that
you developed it using these components. In addition, we ask that
the headers remain intact in our source code. As long as these
guidelines are kept, we expect to continue enhancing this
system and expect to make other tools available as they are
completed.
The MageLang Support Classes Gang:
version: MageLang Support Classes 1.0, MageLang Insitute, 1997 author: Scott Stanchfield, MageLang Institute See Also: JSplitterBar See Also: JSplitterSpace author: Jeri Lockhart - jeri.lockhart@sun.com author: Modified for use in the NbColumnView widget. author: When the user moves the splitter bar to the left, the column that is adjacent to the author: left maintains its minimum size. author: When the user moves the splitter bar to the right, the columns to the right of the author: splitter bar, maintain their widths. author: layoutComponent() - can be called when the components in the container author: do not yet have their bounds set. In this case, use the component's author: preferred size. JSplitterBar can set the bounds of the components author: when the user drags a splitter bar. If the bounds for a component author: are set, use this size. author: checkLayoutSize() - is called for both preferredLayoutSize() and author: minimumLayoutSize(). To calculate the width of the layout, uses the author: actual width of the component, if present, or uses the preferred width author: of the component. |