00001 00058 package com.arcle.rmt.j2se.swing.vc.rqml; 00059 00060 import javax.swing.*; 00061 import java.awt.BorderLayout; 00062 import java.awt.Insets; 00063 import java.util.Observable; 00064 00065 import com.arcle.rmt.rqml.RQMLFirstClass; 00066 import com.arcle.rmt.rqml.Project; 00067 00077 public class ProjectAttributes3 extends FirstClassPanel { 00078 public ProjectAttributes3(RQMLFirstClass fc) { 00079 super(fc); 00080 setName("Product"); 00081 } 00082 00083 //------------------------------------------------------------------- 00084 // View implementations 00085 00086 00087 //------------------------------------------------------------------- 00088 protected void initChildren() { 00089 lbName = createLabel("Name"); 00090 lbDescription = createLabel("Description"); 00091 00092 edName = createTextField(); 00093 edDescription = createTextArea(); 00094 } 00095 00096 protected void layoutChildren() { 00097 JPanel p1, p2, p3; 00098 00099 setLayout(new BorderLayout()); 00100 00101 // top row 00102 p1 = new JPanel(); 00103 p1.setLayout(new BorderLayout()); 00104 p1.add(lbName, BorderLayout.WEST); 00105 p1.add(edName, BorderLayout.CENTER); 00106 add(p1, BorderLayout.NORTH); 00107 00108 p1 = new JPanel(); 00109 p1.setLayout(new BorderLayout()); 00110 p1.add(lbDescription, BorderLayout.NORTH); 00111 p1.add(createScrollPane(edDescription), BorderLayout.CENTER); 00112 add(p1, BorderLayout.CENTER); 00113 } 00114 00115 //------------------------------------------------------------------- 00116 00117 protected void loadData() { 00118 RQMLFirstClass elem = getElement(); 00119 if (elem instanceof Project) { 00120 Project prj = (Project) elem; 00121 edName.setText(prj.getProduct().getName().getString()); 00122 edDescription.setText(prj.getProduct().getDescription().getString()); 00123 } 00124 } 00125 00126 protected void saveData() { 00127 RQMLFirstClass elem = getElement(); 00128 if (elem instanceof Project) { 00129 Project prj = (Project) elem; 00130 prj.getProduct().getName().setString(edName.getText()); 00131 prj.getProduct().getDescription().setString(edDescription.getText()); 00132 } 00133 } 00134 00135 //------------------------------------------------------------------- 00136 // Member Variables 00137 00138 private JLabel lbName; 00139 private JLabel lbDescription; 00140 00141 private JTextField edName; 00142 private JTextArea edDescription; 00143 }