001: /*
002: * Copyright Javelin Software, All rights reserved.
003: */
004:
005: package com.javelin.swinglets;
006:
007: import java.util.*;
008: import java.io.*;
009:
010: import com.javelin.swinglets.plaf.*;
011:
012: /**
013: * SGridLayout is used to layout SComponents in a SContainer.
014: *
015: * @author Robin Sharp
016: */
017:
018: public class SGridLayout extends SLayoutManager {
019:
020: /**
021: * Construct a fully qualified SGridLayout, 2 columns, and n rows
022: */
023: public SGridLayout() {
024: }
025:
026: /**
027: * Construct a fully qualified SGridLayout, 2 columns, and n rows.
028: * Set the rows and columns to 0 to let the layout manager figure
029: * out the correct number of rows or columns.
030: */
031: public SGridLayout(int rows, int columns) {
032: setRows(rows);
033: setColumns(columns);
034: }
035:
036: /**
037: * Construct a fully qualified SGridLayout, 2 columns, and n rows.
038: * Set the rows and columns to 0 to let the layout manager figure
039: * out the correct number of rows or columns.
040: */
041: public SGridLayout(int rows, int columns, int gap) {
042: setRows(rows);
043: setColumns(columns);
044: setGap(gap);
045: }
046:
047: /**
048: * Returns the name of the L&F class that renders this layout.
049: */
050: public Class getUIClass() {
051: return SGridLayout.class;
052: }
053:
054: /**
055: * Adds a component and constraint to the manager. -- TO DO
056: */
057: public void addComponent(SComponent component, Object constraint) {
058: }
059:
060: /**
061: * Remove a component.
062: */
063: public void removeComponent(SComponent component) {
064: }
065:
066: /**
067: * Get the columns.
068: */
069: public int getColumns() {
070: return columns;
071: }
072:
073: /**
074: * Set the columns.
075: */
076: public void setColumns(int columns) {
077: if (columns < 0)
078: throw new IllegalArgumentException("Columns < 0");
079: this .columns = columns;
080: }
081:
082: /**
083: * Get the rows.
084: */
085: public int getRows() {
086: return rows;
087: }
088:
089: /**
090: * Get the rows.
091: */
092: public void setRows(int rows) {
093: if (rows < 0)
094: throw new IllegalArgumentException("Rows < 0");
095: this .rows = rows;
096: }
097:
098: /**
099: * Get the gap.
100: */
101: public int getGap() {
102: return gap;
103: }
104:
105: /**
106: * Set the gap.
107: */
108: public void setGap(int gap) {
109: if (gap < 0)
110: throw new IllegalArgumentException("gap < 0");
111: this .gap = gap;
112: }
113:
114: // PRIVATE /////////////////////////////////////////////////////////
115:
116: private int gap;
117: private int rows;
118: private int columns;
119:
120: }
|