KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > oddjob > designer > view > DesignerDetail


1 /*
2  * (c) Rob Gordon 2005
3  */

4 package org.oddjob.designer.view;
5
6 import java.awt.Component JavaDoc;
7 import java.util.Observable JavaDoc;
8 import java.util.Observer JavaDoc;
9
10 import javax.swing.JPanel JavaDoc;
11 import javax.swing.JScrollPane JavaDoc;
12
13 import org.oddjob.designer.model.DesignTreeNode;
14 import org.oddjob.designer.model.DesignerModel;
15
16 /**
17  *
18  */

19 public class DesignerDetail extends JScrollPane JavaDoc implements Observer JavaDoc {
20
21     /* (non-Javadoc)
22      * @see java.util.Observer#update(java.util.Observable, java.lang.Object)
23      */

24     public void update(Observable JavaDoc o, Object JavaDoc arg) {
25         DesignerModel model = (DesignerModel) o;
26         DesignTreeNode node = model.getCurrentSelection();
27         Component JavaDoc component = null;
28         if (node != null) {
29             component = node.getDetailView();
30         }
31         
32         if (component != null) {
33             setViewportView(component);
34         }
35         else {
36             setViewportView(new JPanel JavaDoc());
37         }
38     }
39     
40 }
41
Popular Tags