[svn r289] implemented annotation validators, and removed all info logging
This commit is contained in:
parent
78a76fa12e
commit
fdd0af9597
16 changed files with 380 additions and 109 deletions
|
|
@ -39,7 +39,6 @@ import java.io.FileOutputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
|
|
@ -126,7 +125,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
public ImageIcon getImageIcon(String imageResource) {
|
||||
/// TODO hack beter
|
||||
String key = table.getVascTextValue().getTextValue(imageResource);
|
||||
//logger.info("KEY======================="+key);
|
||||
//logger.fine("KEY======================="+key);
|
||||
|
||||
if (key.indexOf("META-INF")>0 | key.indexOf("resource")>0) {
|
||||
return SwingImageHelper.getImageIcon(key);
|
||||
|
|
@ -141,10 +140,21 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
* @see com.idcanet.vasc.core.VascViewRenderer#renderEdit(com.idcanet.vasc.core.VascTable, java.lang.Object)
|
||||
*/
|
||||
public void renderEdit(Object rowBean) throws Exception {
|
||||
logger.info("Rending Edit View");
|
||||
logger.fine("Rending Edit View");
|
||||
table.getVascTableController().initEditObject(table, rowBean);
|
||||
|
||||
SwingEditDialog dialog = new SwingEditDialog(parent,table,rowBean,"Vasc Edit","Edit");
|
||||
String beanValue = rowBean.toString();
|
||||
if (table.getUIIdentifierVascTableColomn()!=null) {
|
||||
Object vv = table.getUIIdentifierVascTableColomn().getVascColumnValue().getValue(table.getUIIdentifierVascTableColomn(), rowBean);
|
||||
if (vv==null) {
|
||||
beanValue="";
|
||||
} else {
|
||||
beanValue=""+vv;
|
||||
}
|
||||
if (beanValue.length()>30) {
|
||||
beanValue=beanValue.substring(0, 30);
|
||||
}
|
||||
}
|
||||
SwingEditDialog dialog = new SwingEditDialog(parent,table,rowBean,table.getVascTextValue().getTextValue("vasc.dialog.edit.title"),table.getVascTextValue().getTextValue("vasc.dialog.edit.message",beanValue));
|
||||
Object result = dialog.openDialog();
|
||||
logger.finest("OPEN closed : "+result);
|
||||
if(result==null) {
|
||||
|
|
@ -163,10 +173,17 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
}
|
||||
|
||||
public void renderDelete(Object rowBean) throws Exception {
|
||||
String beanValue = rowBean.toString();
|
||||
if (table.getUIIdentifierVascTableColomn()!=null) {
|
||||
beanValue = ""+table.getUIIdentifierVascTableColomn().getVascColumnValue().getValue(table.getUIIdentifierVascTableColomn(), rowBean);
|
||||
if (beanValue.length()>30) {
|
||||
beanValue=beanValue.substring(0, 30);
|
||||
}
|
||||
}
|
||||
int response = JOptionPane.showOptionDialog(
|
||||
parent // Center in window.
|
||||
, "Delete "+rowBean // Message
|
||||
, "Delete" // Title in titlebar
|
||||
, table.getVascTextValue().getTextValue("vasc.dialog.delete.message",beanValue) // Message
|
||||
, table.getVascTextValue().getTextValue("vasc.dialog.delete.title") // Title in titlebar
|
||||
, JOptionPane.YES_NO_OPTION // Option type
|
||||
, JOptionPane.PLAIN_MESSAGE // messageType
|
||||
, null // Icon (none)
|
||||
|
|
@ -184,18 +201,16 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
|
||||
class SwingEditDialog extends JDialog {
|
||||
|
||||
private static final long serialVersionUID = 10L;
|
||||
private String headerText = null;
|
||||
private String title = null;
|
||||
private Object result = null;
|
||||
private Object bean = null;
|
||||
|
||||
public SwingEditDialog(JComponent parent,VascTable table,Object bean,String title,String headerText) throws Exception {
|
||||
super();
|
||||
this.headerText = headerText;
|
||||
this.title = title;
|
||||
this.bean = bean;
|
||||
|
||||
|
||||
setTitle(table.getVascTextValue().getTextValue(title));
|
||||
setModal(true);
|
||||
|
||||
|
|
@ -276,7 +291,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
body.add(valueLabel);
|
||||
} else {
|
||||
VascUIComponent comp = c.getVascUIComponent();
|
||||
VascValueModel model = new VascValueModel();
|
||||
VascValueModel model = new VascValueModel(table);
|
||||
model.setValue(c.getVascColumnValue().getValue(c, bean));
|
||||
model.addListener(new VascColumnValueModelListener(c,bean));
|
||||
comp.createComponent(table, model, body);
|
||||
|
|
@ -295,9 +310,9 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
saveButton.setToolTipText(table.getVascTextValue().getTextValue("vasc.dialog.save.tooltip"));
|
||||
saveButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
//if(hasRecordError()) {
|
||||
// return;
|
||||
//}
|
||||
if(table.getVascTableController().setUIComponentsBeanErrors(table, bean)) {
|
||||
return;
|
||||
}
|
||||
result = bean;
|
||||
setVisible(false);
|
||||
}
|
||||
|
|
@ -347,8 +362,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
try {
|
||||
exporter.doExport(out, table);
|
||||
} catch (Exception e) {
|
||||
//MessageDialog.openError(Display.getCurrent().getActiveShell(),crudTable.i18n("crud.event.export.error.title"),crudTable.i18n("crud.event.export.error.message"));
|
||||
logger.log(Level.WARNING,"Error: "+e.getMessage(),e);
|
||||
table.getVascTableController().handleException(e, table);
|
||||
} finally {
|
||||
if (out!=null) {
|
||||
out.close();
|
||||
|
|
@ -427,7 +441,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
JPanel optionPanel = new JPanel();
|
||||
//top.setBackground(Color.GREEN);
|
||||
for(VascUserOption option:table.getUserOptions()) {
|
||||
Object obj = option.createUserOptionRenderer(table);
|
||||
option.createUserOptionRenderer(table);
|
||||
}
|
||||
|
||||
//top.add(header,BorderLayout.NORTH);
|
||||
|
|
@ -489,6 +503,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
}
|
||||
}
|
||||
class JComponentTableCellRenderer extends DefaultTableCellRenderer {
|
||||
private static final long serialVersionUID = 10L;
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) {
|
||||
VascTableColumn c = (VascTableColumn)value;
|
||||
setText(c.getVascTable().getVascTextValue().getTextValue(c.getName()));
|
||||
|
|
@ -508,7 +523,6 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
setFont(header.getFont());
|
||||
}
|
||||
}
|
||||
//setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
|
||||
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
|
||||
return this;
|
||||
}
|
||||
|
|
@ -540,7 +554,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
logger.info("Row Action");
|
||||
logger.fine("Row Action");
|
||||
try {
|
||||
action.doRowAction(table, table.getSelectedObject());
|
||||
} catch (Exception e) {
|
||||
|
|
@ -558,7 +572,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
}
|
||||
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
logger.info("Global Action");
|
||||
logger.fine("Global Action");
|
||||
try {
|
||||
action.doGlobalAction(table);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -568,6 +582,7 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
}
|
||||
|
||||
class VascColumnModel extends AbstractTableModel implements VascEventListener {
|
||||
private static final long serialVersionUID = 10L;
|
||||
|
||||
public void vascEvent(VascEventType e,Object o) {
|
||||
if (e==VascEventType.DATA_UPDATE) {
|
||||
|
|
@ -623,7 +638,6 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
return ""+vtc.getVascColumnValue().getValue(vtc,bean);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "Error";
|
||||
}
|
||||
}
|
||||
|
|
@ -637,15 +651,6 @@ public class SwingVascViewRenderer implements VascViewRenderer {
|
|||
*/
|
||||
|
||||
class SpringUtilities {
|
||||
/**
|
||||
* A debugging utility that prints to stdout the component's minimum,
|
||||
* preferred, and maximum sizes.
|
||||
*/
|
||||
public static void printSizes(Component c) {
|
||||
System.out.println("minimumSize = " + c.getMinimumSize());
|
||||
System.out.println("preferredSize = " + c.getPreferredSize());
|
||||
System.out.println("maximumSize = " + c.getMaximumSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Aligns the first <code>rows</code>*<code>cols</code> components of
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue