001/*
002 * IzPack - Copyright 2001-2005 Julien Ponge, All Rights Reserved.
003 * 
004 * http://www.izforge.com/izpack/
005 * http://developer.berlios.de/projects/izpack/
006 * 
007 * Copyright 2002 Elmar Grom
008 * 
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *     http://www.apache.org/licenses/LICENSE-2.0
014 *     
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 */
021
022package com.izforge.izpack.gui;
023
024import java.awt.Component;
025
026/**
027 * The constraints class to use with <code>TwoColumnLayout</code>.
028 * 
029 * @see com.izforge.izpack.gui.TwoColumnLayout
030 * 
031 * @version 0.0.1 / 11/15/02
032 * @author Elmar Grom
033 */
034public class TwoColumnConstraints implements Cloneable
035{
036
037    // these numbers are arbitrary - this way, there's a lower chance
038    // of somebody using the number instead of the symbolic name
039    public static final int NORTH = 9;
040
041    public static final int WEST = 15;
042
043    public static final int WESTONLY = 16;
044
045    public static final int EAST = 26;
046
047    public static final int EASTONLY = 27;
048
049    public static final int BOTH = 29;
050
051    public static final int LEFT = 31;
052
053    public static final int CENTER = 35;
054
055    public static final int RIGHT = 47;
056
057    /**
058     * Indicates where to place the associated component. <code>NORTH</code> will place the
059     * component in the title margin. </code>WEST</code> will place the component in the left
060     * column and <code>EAST</code> will place it in the right column. If <code>BOTH</code> is
061     * used, the component will straddle both columns. <code>WESTONLY</code> and <code>EASTONLY</code>
062     * will place the element accordingly but make sure that nothing is placed in the opposite
063     * column.
064     */
065    public int position = WEST;
066
067    /**
068     * How to align the associated component, <code>LEFT</code>, <code>CENTER</code> or
069     * <code>RIGHT</code>. Note that this setting only taks effect in the component is placed in
070     * the title margin.
071     */
072    public int align = LEFT;
073
074    /** If set to true, the indent setting in the layout manager will be applied. */
075    public boolean indent = false;
076
077    /**
078     * If set to true the associated component will be allowed to stretch to the width of the entire
079     * avaiable space.
080     */
081    public boolean stretch = false;
082
083    /** for private use by the layout manager */
084    Component component = null;
085
086    /**
087     * Creates a copy of this two column constraint.
088     * 
089     * @return a copy of this <code>TwoColumnConstraints</code>
090     */
091    public Object clone()
092    {
093        TwoColumnConstraints newObject = new TwoColumnConstraints();
094
095        newObject.position = position;
096        newObject.align = align;
097        newObject.indent = indent;
098        newObject.stretch = stretch;
099        newObject.component = component;
100
101        return (newObject);
102    }
103}
104/*---------------------------------------------------------------------------*/