01: /**
02: * LibreSource
03: * Copyright (C) 2004-2008 Artenum SARL / INRIA
04: * http://www.libresource.org - contact@artenum.com
05: *
06: * This file is part of the LibreSource software,
07: * which can be used and distributed under license conditions.
08: * The license conditions are provided in the LICENSE.TXT file
09: * at the root path of the packaging that enclose this file.
10: * More information can be found at
11: * - http://dev.libresource.org/home/license
12: *
13: * Initial authors :
14: *
15: * Guillaume Bort / INRIA
16: * Francois Charoy / Universite Nancy 2
17: * Julien Forest / Artenum
18: * Claude Godart / Universite Henry Poincare
19: * Florent Jouille / INRIA
20: * Sebastien Jourdain / INRIA / Artenum
21: * Yves Lerumeur / Artenum
22: * Pascal Molli / Universite Henry Poincare
23: * Gerald Oster / INRIA
24: * Mariarosa Penzi / Artenum
25: * Gerard Sookahet / Artenum
26: * Raphael Tani / INRIA
27: *
28: * Contributors :
29: *
30: * Stephane Bagnier / Artenum
31: * Amadou Dia / Artenum-IUP Blois
32: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33: */package org.libresource.so6.core.ui;
34:
35: import org.libresource.so6.core.ui.util.Wizard;
36: import org.libresource.so6.core.ui.util.WizardComponent;
37:
38: import java.awt.BorderLayout;
39: import java.awt.Color;
40: import java.awt.Component;
41:
42: import java.util.ArrayList;
43: import java.util.Iterator;
44:
45: import javax.swing.BorderFactory;
46: import javax.swing.BoxLayout;
47: import javax.swing.JPanel;
48: import javax.swing.border.LineBorder;
49:
50: /**
51: * @author smack
52: */
53: public class MultipleView extends JPanel implements WizardComponent {
54: private Wizard wizard;
55: private JPanel content;
56: private ArrayList views;
57:
58: public MultipleView(String title_) {
59: super (new BorderLayout());
60: content = new JPanel();
61:
62: BoxLayout layout = new BoxLayout(content, BoxLayout.Y_AXIS);
63: content.setLayout(layout);
64: add(content, BorderLayout.CENTER);
65: views = new ArrayList();
66: setBorder(BorderFactory.createTitledBorder(LineBorder
67: .createGrayLineBorder(), title_));
68: }
69:
70: public void addView(WizardComponent view) {
71: views.add(view);
72: content.add((Component) view);
73: }
74:
75: public void setStyle(Color back, Color forground) {
76: setBackground(back);
77:
78: for (Iterator i = views.iterator(); i.hasNext();) {
79: ((WizardComponent) i.next()).setStyle(back, forground);
80: }
81: }
82:
83: public void setWizard(Wizard wizard) {
84: this .wizard = wizard;
85: }
86:
87: public Wizard getWizard() {
88: return wizard;
89: }
90: }
|