diff --git a/lib/idcanet-x4o-bin.jar b/lib/idcanet-x4o-bin.jar index a3f6509..1a5c7aa 100644 Binary files a/lib/idcanet-x4o-bin.jar and b/lib/idcanet-x4o-bin.jar differ diff --git a/src/com/idcanet/vasc/core/column/VascColumnValue.java b/src/com/idcanet/vasc/core/column/VascColumnValue.java index e2ebf55..c943733 100644 --- a/src/com/idcanet/vasc/core/column/VascColumnValue.java +++ b/src/com/idcanet/vasc/core/column/VascColumnValue.java @@ -26,6 +26,9 @@ package com.idcanet.vasc.core.column; +import com.idcanet.x4o.element.ElementParameterException; +import com.idcanet.x4o.element.ElementParameterNotFoundException; + /** * * @author Willem Cazander @@ -33,7 +36,7 @@ package com.idcanet.vasc.core.column; */ public interface VascColumnValue { - public Object getValue(VascTableColumn column,Object record) throws Exception; + public Object getValue(VascTableColumn column,Object record) throws ElementParameterException,ElementParameterNotFoundException; - public void setValue(VascTableColumn column,Object record,Object value) throws Exception; + public void setValue(VascTableColumn column,Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException; } \ No newline at end of file diff --git a/src/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java b/src/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java index a0de417..db0cdd0 100644 --- a/src/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java +++ b/src/com/idcanet/vasc/core/ui/VascColumnValueModelListener.java @@ -27,6 +27,8 @@ package com.idcanet.vasc.core.ui; import com.idcanet.vasc.core.column.VascTableColumn; +import com.idcanet.x4o.element.ElementParameterException; +import com.idcanet.x4o.element.ElementParameterNotFoundException; /** @@ -46,7 +48,7 @@ public class VascColumnValueModelListener implements VascValueModelListener { setBean(bean); } - public void valueUpdate(VascValueModel model) throws Exception { + public void valueUpdate(VascValueModel model) throws ElementParameterException,ElementParameterNotFoundException { vascTableColumn.getVascColumnValue().setValue(vascTableColumn, bean, model.getValue()); } diff --git a/src/com/idcanet/vasc/core/ui/VascValueModel.java b/src/com/idcanet/vasc/core/ui/VascValueModel.java index ff52121..5d13e9a 100644 --- a/src/com/idcanet/vasc/core/ui/VascValueModel.java +++ b/src/com/idcanet/vasc/core/ui/VascValueModel.java @@ -30,6 +30,8 @@ import java.util.ArrayList; import java.util.List; import com.idcanet.vasc.core.VascTable; +import com.idcanet.x4o.element.ElementParameterException; +import com.idcanet.x4o.element.ElementParameterNotFoundException; /** @@ -41,24 +43,20 @@ public class VascValueModel { private Object value = null; private List listeners = null; - private VascTable table = null; + //private VascTable table = null; public VascValueModel(VascTable table) { listeners = new ArrayList(2); - this.table=table; + //this.table=table; } public Object getValue() { return value; } - public void setValue(Object value) { + public void setValue(Object value) throws ElementParameterException,ElementParameterNotFoundException { this.value = value; - try { - fireListeners(); - } catch (Exception e) { - table.getVascTableController().handleException(e, table); - } + fireListeners(); } public void addListener(VascValueModelListener l) { @@ -67,7 +65,7 @@ public class VascValueModel { public void removeListener(VascValueModelListener l) { listeners.remove(l); } - private void fireListeners() throws Exception { + private void fireListeners() throws ElementParameterException,ElementParameterNotFoundException { for (VascValueModelListener l:listeners) { l.valueUpdate(this); } diff --git a/src/com/idcanet/vasc/core/ui/VascValueModelListener.java b/src/com/idcanet/vasc/core/ui/VascValueModelListener.java index 9daa6ca..ac81210 100644 --- a/src/com/idcanet/vasc/core/ui/VascValueModelListener.java +++ b/src/com/idcanet/vasc/core/ui/VascValueModelListener.java @@ -28,6 +28,9 @@ package com.idcanet.vasc.core.ui; import java.util.EventListener; +import com.idcanet.x4o.element.ElementParameterException; +import com.idcanet.x4o.element.ElementParameterNotFoundException; + /** * @@ -36,5 +39,5 @@ import java.util.EventListener; */ public interface VascValueModelListener extends EventListener { - public void valueUpdate(VascValueModel model) throws Exception; + public void valueUpdate(VascValueModel model) throws ElementParameterException,ElementParameterNotFoundException; } \ No newline at end of file diff --git a/src/com/idcanet/vasc/impl/column/BeanPropertyVascColumnValue.java b/src/com/idcanet/vasc/impl/column/BeanPropertyVascColumnValue.java index 13223b7..e3aeaa8 100644 --- a/src/com/idcanet/vasc/impl/column/BeanPropertyVascColumnValue.java +++ b/src/com/idcanet/vasc/impl/column/BeanPropertyVascColumnValue.java @@ -28,6 +28,8 @@ package com.idcanet.vasc.impl.column; import com.idcanet.vasc.core.column.VascColumnValue; import com.idcanet.vasc.core.column.VascTableColumn; +import com.idcanet.x4o.element.ElementParameterException; +import com.idcanet.x4o.element.ElementParameterNotFoundException; import com.idcanet.x4o.impl.DefaultElementParameterHelper; /** @@ -52,7 +54,7 @@ public class BeanPropertyVascColumnValue implements VascColumnValue { /** * @see com.idcanet.vasc.core.column.VascColumnValue#getValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object) */ - public Object getValue(VascTableColumn column,Object record) throws Exception { + public Object getValue(VascTableColumn column,Object record) throws ElementParameterException,ElementParameterNotFoundException { if(getProperty()==null) { return null; } @@ -65,7 +67,7 @@ public class BeanPropertyVascColumnValue implements VascColumnValue { /** * @see com.idcanet.vasc.core.column.VascColumnValue#setValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object) */ - public void setValue(VascTableColumn column, Object record,Object value) throws Exception { + public void setValue(VascTableColumn column, Object record,Object value) throws ElementParameterException,ElementParameterNotFoundException { if(getProperty()==null) { return; } diff --git a/src/com/idcanet/vasc/impl/column/NullVascColumnValue.java b/src/com/idcanet/vasc/impl/column/NullVascColumnValue.java index 40d9964..7e90569 100644 --- a/src/com/idcanet/vasc/impl/column/NullVascColumnValue.java +++ b/src/com/idcanet/vasc/impl/column/NullVascColumnValue.java @@ -28,6 +28,8 @@ package com.idcanet.vasc.impl.column; import com.idcanet.vasc.core.column.VascColumnValue; import com.idcanet.vasc.core.column.VascTableColumn; +import com.idcanet.x4o.element.ElementParameterException; +import com.idcanet.x4o.element.ElementParameterNotFoundException; /** * @@ -39,14 +41,14 @@ public class NullVascColumnValue implements VascColumnValue { /** * @see com.idcanet.vasc.core.column.VascColumnValue#getValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object) */ - public Object getValue(VascTableColumn column, Object record) throws Exception { + public Object getValue(VascTableColumn column, Object record) throws ElementParameterException,ElementParameterNotFoundException { return null; } /** * @see com.idcanet.vasc.core.column.VascColumnValue#setValue(com.idcanet.vasc.core.column.VascTableColumn, java.lang.Object, java.lang.Object) */ - public void setValue(VascTableColumn column, Object record, Object value) throws Exception { + public void setValue(VascTableColumn column, Object record, Object value) throws ElementParameterException,ElementParameterNotFoundException { } diff --git a/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java b/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java index 5aa51b2..452b8e7 100644 --- a/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java +++ b/src/com/idcanet/vasc/impl/swing/SwingVascViewRenderer.java @@ -494,6 +494,7 @@ public class SwingVascViewRenderer implements VascViewRenderer { return; } try { + // TODO: fix this table.getVascViewRenderer().renderEdit(o); } catch (Exception ee) { table.getVascTableController().handleException(ee, table); diff --git a/src/com/idcanet/vasc/impl/swing/ui/SwingColorChooser.java b/src/com/idcanet/vasc/impl/swing/ui/SwingColorChooser.java index 39722b9..a107594 100644 --- a/src/com/idcanet/vasc/impl/swing/ui/SwingColorChooser.java +++ b/src/com/idcanet/vasc/impl/swing/ui/SwingColorChooser.java @@ -58,7 +58,7 @@ public class SwingColorChooser extends AbstractVascUIComponent { JButton colorButton = new JButton("Color"); orgBackgroundColor = colorButton.getBackground(); ((JComponent)gui).add(colorButton); - colorButton.addActionListener(new SelectActionListener3(model,org.getHexSwingEncoding())); + colorButton.addActionListener(new SelectActionListener3(model,org.getHexSwingEncoding(),table)); return colorButton; } @@ -91,9 +91,11 @@ class SelectActionListener3 implements ActionListener { private VascValueModel model; private boolean hexEncoding = false; - public SelectActionListener3(VascValueModel model,boolean hexEncoding) { + private VascTable table = null; + public SelectActionListener3(VascValueModel model,boolean hexEncoding,VascTable table) { this.model=model; this.hexEncoding=hexEncoding; + this.table=table; } /** @@ -106,7 +108,11 @@ class SelectActionListener3 implements ActionListener { cur = Color.YELLOW; } Color newColor = JColorChooser.showDialog(null,"Choose a color...",cur); - model.setValue(newColor); + try { + model.setValue(newColor); + } catch (Exception ee) { + table.getVascTableController().handleException(ee, table); + } } else { String cur = (String)model.getValue(); Color c = Color.YELLOW; @@ -118,7 +124,7 @@ class SelectActionListener3 implements ActionListener { String newColorString = "#"+Integer.toHexString( newColor.getRGB() & 0x00ffffff ); model.setValue(newColorString); } catch (Exception ee) { - + table.getVascTableController().handleException(ee, table); } } } diff --git a/src/com/idcanet/vasc/impl/swing/ui/SwingDate.java b/src/com/idcanet/vasc/impl/swing/ui/SwingDate.java index 43ab3fc..d9cc6df 100644 --- a/src/com/idcanet/vasc/impl/swing/ui/SwingDate.java +++ b/src/com/idcanet/vasc/impl/swing/ui/SwingDate.java @@ -55,7 +55,7 @@ public class SwingDate extends AbstractVascUIComponent { orgBackgroundColor = datePicker.getBackground(); datePicker.setDate((Date)model.getValue()); ((JComponent)gui).add(datePicker); - datePicker.addActionListener(new SelectActionListener2(model)); + datePicker.addActionListener(new SelectActionListener2(model,table)); return datePicker; } @@ -87,8 +87,10 @@ public class SwingDate extends AbstractVascUIComponent { class SelectActionListener2 implements ActionListener { private VascValueModel model; - public SelectActionListener2(VascValueModel model) { + private VascTable table = null; + public SelectActionListener2(VascValueModel model,VascTable table) { this.model=model; + this.table=table; } /** @@ -96,6 +98,10 @@ class SelectActionListener2 implements ActionListener { */ public void actionPerformed(ActionEvent e) { Date value = ((DatePicker)e.getSource()).getDate(); - model.setValue(value); + try { + model.setValue(value); + } catch (Exception ee) { + table.getVascTableController().handleException(ee, table); + } } } \ No newline at end of file diff --git a/src/com/idcanet/vasc/impl/swing/ui/SwingList.java b/src/com/idcanet/vasc/impl/swing/ui/SwingList.java index 2a09a5e..ca5d095 100644 --- a/src/com/idcanet/vasc/impl/swing/ui/SwingList.java +++ b/src/com/idcanet/vasc/impl/swing/ui/SwingList.java @@ -54,7 +54,7 @@ public class SwingList extends AbstractVascUIComponent { private JComboBox comboBox = null; private Color orgBackgroundColor = null; - public Object createComponent(VascTable table,final VascValueModel model,Object gui) throws Exception { + public Object createComponent(final VascTable table,final VascValueModel model,Object gui) throws Exception { VascList l = (VascList)getWrapper(); if (l.getVascSelectItemModel()==null) { comboBox = new JComboBox(); @@ -67,7 +67,11 @@ public class SwingList extends AbstractVascUIComponent { comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VascSelectItem i = (VascSelectItem)((JComboBox)e.getSource()).getSelectedItem(); - model.setValue(i.getValue()); + try { + model.setValue(i.getValue()); + } catch (Exception ee) { + table.getVascTableController().handleException(ee, table); + } } }); diff --git a/src/com/idcanet/vasc/impl/swing/ui/SwingTextField.java b/src/com/idcanet/vasc/impl/swing/ui/SwingTextField.java index 57a6d8b..b76f03c 100644 --- a/src/com/idcanet/vasc/impl/swing/ui/SwingTextField.java +++ b/src/com/idcanet/vasc/impl/swing/ui/SwingTextField.java @@ -53,7 +53,7 @@ public class SwingTextField extends AbstractVascUIComponent { orgBackgroundColor = textField.getBackground(); textField.setText(""+model.getValue()); ((JComponent)gui).add(textField); - textField.getDocument().addDocumentListener(new TextListener(model,table)); + textField.getDocument().addDocumentListener(new TextListener(model,table,this)); return textField; } @@ -86,11 +86,13 @@ public class SwingTextField extends AbstractVascUIComponent { class TextListener implements DocumentListener { private VascValueModel model = null; - private VascTable table = null; + //private VascTable table = null; + private SwingTextField textField = null; - public TextListener(VascValueModel model,VascTable table) { + public TextListener(VascValueModel model,VascTable table,SwingTextField textField) { this.model=model; - this.table=table; + //this.table=table; + this.textField=textField; } /** @@ -118,8 +120,10 @@ class TextListener implements DocumentListener { try { String value = event.getDocument().getText(0, event.getDocument().getLength()); model.setValue(value); + textField.setErrorText(null); } catch (Exception ee) { - table.getVascTableController().handleException(ee, table); + textField.setErrorText(ee.getLocalizedMessage()); + //table.getVascTableController().handleException(ee, table); } } } \ No newline at end of file diff --git a/src/com/idcanet/vasc/impl/swing/ui/SwingToggle.java b/src/com/idcanet/vasc/impl/swing/ui/SwingToggle.java index cf46f0d..3c27653 100644 --- a/src/com/idcanet/vasc/impl/swing/ui/SwingToggle.java +++ b/src/com/idcanet/vasc/impl/swing/ui/SwingToggle.java @@ -54,7 +54,7 @@ public class SwingToggle extends AbstractVascUIComponent { orgBackgroundColor = checkBox.getBackground(); checkBox.setSelected((Boolean)model.getValue()); ((JComponent)gui).add(checkBox); - checkBox.addActionListener(new SelectActionListener(model)); + checkBox.addActionListener(new SelectActionListener(model,table)); return checkBox; } @@ -86,8 +86,10 @@ public class SwingToggle extends AbstractVascUIComponent { class SelectActionListener implements ActionListener { private VascValueModel model; - public SelectActionListener(VascValueModel model) { + private VascTable table = null; + public SelectActionListener(VascValueModel model,VascTable table) { this.model=model; + this.table=table; } /** @@ -95,6 +97,10 @@ class SelectActionListener implements ActionListener { */ public void actionPerformed(ActionEvent e) { boolean value = ((JCheckBox)e.getSource()).isSelected(); - model.setValue(value); + try { + model.setValue(value); + } catch (Exception ee) { + table.getVascTableController().handleException(ee, table); + } } } \ No newline at end of file