| 1 |
// Copyright 2003, FreeHEP. |
| 2 |
package org.freehep.graphicsio.exportchooser; |
| 3 |
|
| 4 |
import java.awt.Component; |
| 5 |
import java.util.Properties; |
| 6 |
|
| 7 |
import javax.swing.BorderFactory; |
| 8 |
import javax.swing.JPanel; |
| 9 |
|
| 10 |
import org.freehep.graphicsbase.swing.layout.TableLayout; |
| 11 |
|
| 12 |
/** |
| 13 |
* |
| 14 |
* @author Mark Donszelmann |
| 15 |
* @version $Id: freehep-graphicsio/src/main/java/org/freehep/graphicsio/exportchooser/OptionPanel.java 5641ca92a537 2005/11/26 00:15:35 duns $ |
| 16 |
*/ |
| 17 |
public class OptionPanel extends JPanel implements Options { |
| 18 |
public OptionPanel() { |
| 19 |
this(null); |
| 20 |
} |
| 21 |
|
| 22 |
public OptionPanel(String title) { |
| 23 |
super(new TableLayout()); |
| 24 |
if (title != null) |
| 25 |
setBorder(BorderFactory.createTitledBorder(BorderFactory |
| 26 |
.createEtchedBorder(), title)); |
| 27 |
} |
| 28 |
|
| 29 |
public void setEnabled(boolean enable) { |
| 30 |
for (int i = 0; i < getComponentCount(); i++) { |
| 31 |
Component c = getComponent(i); |
| 32 |
c.setEnabled(enable); |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
public boolean applyChangedOptions(Properties options) { |
| 37 |
boolean changed = false; |
| 38 |
for (int i = 0; i < getComponentCount(); i++) { |
| 39 |
Component c = getComponent(i); |
| 40 |
if (c instanceof Options) { |
| 41 |
boolean changedThis = ((Options) c) |
| 42 |
.applyChangedOptions(options); |
| 43 |
changed = changed || changedThis; |
| 44 |
} |
| 45 |
} |
| 46 |
return changed; |
| 47 |
} |
| 48 |
} |