[svn r271] removed small bug
This commit is contained in:
parent
56c4fad429
commit
48fbf1d48d
|
@ -177,7 +177,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
private Object result = null;
|
||||
private Object bean = null;
|
||||
|
||||
public SwingEditDialog(JComponent parent,VascTable table,Object bean,String title,String headerText) {
|
||||
public SwingEditDialog(JComponent parent,VascTable table,Object bean,String title,String headerText) throws Exception {
|
||||
super();
|
||||
this.headerText = headerText;
|
||||
this.title = title;
|
||||
|
@ -230,7 +230,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
header.add(l);
|
||||
}
|
||||
|
||||
public void createBody(JPanel body) {
|
||||
public void createBody(JPanel body) throws Exception {
|
||||
body.setLayout(new SpringLayout());
|
||||
for(VascTableColumn c:table.getTableColumns()) {
|
||||
JLabel l = new JLabel();
|
||||
|
@ -242,27 +242,23 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
}
|
||||
body.add(l);
|
||||
|
||||
try {
|
||||
table.getVascTableController().initEditObjectColumn(c, bean);
|
||||
|
||||
if(c.getVascUIComponent()==null) {
|
||||
JLabel valueLabel = new JLabel();
|
||||
valueLabel.setText(""+c.getVascColumnValue().getValue(c, bean));
|
||||
c.setColumnEditor(valueLabel);
|
||||
body.add(valueLabel);
|
||||
} else {
|
||||
//c.setColumnEditor(c.getVascColumnEditor().createColumnEditor(c,bean,body));
|
||||
VascUIComponent comp = c.getVascUIComponent();
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(c.getVascColumnValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
comp.createComponent(table, model, body);
|
||||
c.setColumnEditor(comp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error making column editor: '"+c.getVascColumnValue()+"' error: "+e.getMessage(),e);
|
||||
}
|
||||
}
|
||||
table.getVascTableController().initEditObjectColumn(c, bean);
|
||||
|
||||
if(c.getVascUIComponent()==null) {
|
||||
JLabel valueLabel = new JLabel();
|
||||
valueLabel.setText(""+c.getVascColumnValue().getValue(c, bean));
|
||||
c.setColumnEditor(valueLabel);
|
||||
body.add(valueLabel);
|
||||
} else {
|
||||
//c.setColumnEditor(c.getVascColumnEditor().createColumnEditor(c,bean,body));
|
||||
VascUIComponent comp = c.getVascUIComponent();
|
||||
VascValueModel model = new VascValueModel();
|
||||
model.setValue(c.getVascColumnValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
comp.createComponent(table, model, body);
|
||||
c.setColumnEditor(comp);
|
||||
}
|
||||
}
|
||||
//JComponent, rows, cols, initX, initY ,xPad, yPad
|
||||
SpringUtilities.makeCompactGrid(body, table.getTableColumns().size(),2, 6,6, 6,6);
|
||||
|
||||
|
|
|
@ -58,14 +58,18 @@ public class SwingList extends AbstractVascUIComponent {
|
|||
public Object createComponent(VascTable table,final VascValueModel model,Object gui) throws Exception {
|
||||
|
||||
VascList l = (VascList)getWrapper();
|
||||
final JComboBox def = new JComboBox(l.getVascSelectItemModel().getVascSelectItems().toArray());
|
||||
JComboBox def;
|
||||
if (l.getVascSelectItemModel()==null) {
|
||||
def = new JComboBox();
|
||||
} else {
|
||||
def = new JComboBox(l.getVascSelectItemModel().getVascSelectItems().toArray());
|
||||
}
|
||||
((JComponent)gui).add(def);
|
||||
|
||||
def.setRenderer(new MyCellRenderer());
|
||||
def.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
VascSelectItem i = (VascSelectItem)def.getSelectedItem();
|
||||
System.out.println("Setting value: "+i.getLabel()+" value: "+i.getValue());
|
||||
VascSelectItem i = (VascSelectItem)((JComboBox)e.getSource()).getSelectedItem();
|
||||
model.setValue(i.getValue());
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue