[svn r382] hacked jsf frontend working
This commit is contained in:
parent
37fdf22282
commit
9a605f177a
123 changed files with 7035 additions and 2418 deletions
|
|
@ -71,15 +71,14 @@ import com.idcanet.vasc.core.VascEntryField;
|
|||
import com.idcanet.vasc.core.VascFrontendData;
|
||||
import com.idcanet.vasc.core.actions.GlobalVascAction;
|
||||
import com.idcanet.vasc.core.actions.RowVascAction;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener;
|
||||
import com.idcanet.vasc.core.entry.VascEntryExporter;
|
||||
import com.idcanet.vasc.core.entry.VascEntryEventListener.VascEventType;
|
||||
import com.idcanet.vasc.core.ui.VascColumnValueModelListener;
|
||||
import com.idcanet.vasc.core.ui.VascUIComponent;
|
||||
import com.idcanet.vasc.core.ui.VascValueModel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingBoolean;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingButton;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingColorChooser;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingDate;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingLabel;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingList;
|
||||
import com.idcanet.vasc.frontends.swing.ui.SwingText;
|
||||
|
|
@ -140,15 +139,12 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
/**
|
||||
* @see com.idcanet.vasc.core.VascViewRenderer#renderEdit(com.idcanet.vasc.core.VascEntry, java.lang.Object)
|
||||
*/
|
||||
public void renderEdit(Object rowBean) throws Exception {
|
||||
public void renderEdit() throws Exception {
|
||||
logger.fine("Rending Edit View");
|
||||
|
||||
|
||||
|
||||
rowBean = entry.getVascFrontendData().getVascFrontendHelper().initEditObject(entry, rowBean);
|
||||
Object rowBean = entry.getVascFrontendData().getEntryDataObject();
|
||||
String beanValue = rowBean.toString();
|
||||
if (entry.getDisplayNameFieldId()!=null) {
|
||||
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
|
||||
Object vv = v.getVascEntryFieldValue().getValue(v, rowBean);
|
||||
|
|
@ -167,10 +163,12 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
if(result==null) {
|
||||
return;
|
||||
}
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry, result);
|
||||
entry.getVascFrontendData().setEntryDataObject(result);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().mergeObject(entry);
|
||||
}
|
||||
|
||||
public void renderDelete(Object rowBean) throws Exception {
|
||||
public void renderDelete() throws Exception {
|
||||
Object rowBean = entry.getVascFrontendData().getEntryDataObject();
|
||||
String beanValue = rowBean.toString();
|
||||
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
|
|
@ -190,10 +188,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
, null // Default button's label
|
||||
);
|
||||
if (response==JOptionPane.YES_OPTION) {
|
||||
entry.getVascFrontendData().getVascBackend().delete(rowBean);
|
||||
entry.getVascFrontendData().getEntryDataList().remove(rowBean);
|
||||
entry.getVascFrontendData().setEntryDataObject(null);
|
||||
//entry.getVascFrontendController().getVascFrontendHelper().fireVascEvent(VascEventListener.VascEventType.DATA_UPDATE, rowBean);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().deleteObject(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -260,11 +255,9 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
body.setLayout(new SpringLayout());
|
||||
int column = 0;
|
||||
for (VascEntryField c:entry.getVascEntryFields()) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().initEditObjectColumn(c, bean);
|
||||
if (c.getEdit()==false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//if (c.isEditReadOnly()==true) {
|
||||
|
||||
|
|
@ -299,9 +292,9 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
saveButton.setToolTipText(i18n("vasc.dialog.save.tooltip"));
|
||||
saveButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if(entry.getVascFrontendData().getVascFrontendHelper().setUIComponentsBeanErrors(entry, bean)) {
|
||||
return;
|
||||
}
|
||||
//if(entry.getVascFrontendData().getVascFrontendHelper().validateObject(entry, bean)) {
|
||||
// return;
|
||||
//}
|
||||
result = bean;
|
||||
setVisible(false);
|
||||
}
|
||||
|
|
@ -350,7 +343,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
try {
|
||||
exporter.doExport(out, entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, e);
|
||||
} finally {
|
||||
if (out!=null) {
|
||||
out.close();
|
||||
|
|
@ -394,22 +387,22 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
header.setBackground(Color.WHITE);
|
||||
header.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
|
||||
if(entry.getHeaderImage()!=null) {
|
||||
if(entry.getListImage()!=null) {
|
||||
JLabel l = new JLabel();
|
||||
// TODO: hack images working
|
||||
//l.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(entry.getHeaderImage())).getScaledInstance(32, 32, Image.SCALE_SMOOTH)));
|
||||
if (entry.getHeaderDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getHeaderDescription()));
|
||||
if (entry.getListDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getListDescription()));
|
||||
}
|
||||
header.add(l,BorderLayout.WEST);
|
||||
}
|
||||
|
||||
if(entry.getHeaderName()!=null) {
|
||||
JLabel l = new JLabel(i18n(entry.getHeaderName()));
|
||||
if(entry.getName()!=null) {
|
||||
JLabel l = new JLabel(i18n(entry.getName()));
|
||||
l.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
l.setFont(new Font(null,Font.BOLD, 18));
|
||||
if (entry.getHeaderDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getHeaderDescription()));
|
||||
if (entry.getListDescription()!=null) {
|
||||
l.setToolTipText(i18n(entry.getListDescription()));
|
||||
}
|
||||
header.add(l,BorderLayout.CENTER);
|
||||
}
|
||||
|
|
@ -419,7 +412,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
for (GlobalVascAction action:entry.getGlobalActions()) {
|
||||
JButton but = new JButton();
|
||||
but.setText(i18n(action.getName()));
|
||||
but.setToolTipText(i18n(action.getToolTip()));
|
||||
but.setToolTipText(i18n(action.getDescription()));
|
||||
but.addActionListener(new GlobalActionListener(action));
|
||||
but.setIcon(getImageIcon(action.getImage()));
|
||||
top.add(but);
|
||||
|
|
@ -444,15 +437,12 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
VascColumnModel model = new VascColumnModel();
|
||||
//TODO: entry.getVascEntryController().addEventListener(model);
|
||||
|
||||
JTable table = new JTable();
|
||||
//TODO: remove this extra model for sorting, AND fixup a real sorting stuff
|
||||
TableSorter tableSorter = new TableSorter();
|
||||
JTable table = new JTable();
|
||||
// this regs the listeners for the sorting
|
||||
tableSorter.setTableHeader(table.getTableHeader());
|
||||
tableSorter.setTableModel(model);
|
||||
//tableSorter.setTableHeader(table.getTableHeader());
|
||||
//tableSorter.setTableModel(model);
|
||||
|
||||
|
||||
table.setModel(tableSorter);
|
||||
table.setModel(model);
|
||||
table.getTableHeader().setReorderingAllowed(false);
|
||||
|
||||
// remove auto columns :(
|
||||
|
|
@ -481,7 +471,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
table.addColumn(t);
|
||||
counter++;
|
||||
}
|
||||
table.getSelectionModel().addListSelectionListener(new entrySectionListener(table,tableSorter));
|
||||
table.getSelectionModel().addListSelectionListener(new EntrySectionListener(table));
|
||||
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
|
||||
table.addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
|
|
@ -491,10 +481,10 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
// TODO: fix this
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit(o);
|
||||
// todo: fix
|
||||
entry.getVascFrontendData().getVascFrontend().renderEdit();
|
||||
} catch (Exception ee) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(ee, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry, ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -502,12 +492,10 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
JScrollPane scrollPane = new JScrollPane(table);
|
||||
parent2.add(scrollPane);
|
||||
}
|
||||
class entrySectionListener implements ListSelectionListener {
|
||||
class EntrySectionListener implements ListSelectionListener {
|
||||
JTable table;
|
||||
TableSorter tableSorter;
|
||||
entrySectionListener(JTable table,TableSorter tableSorter) {
|
||||
EntrySectionListener(JTable table) {
|
||||
this.table = table;
|
||||
this.tableSorter=tableSorter;
|
||||
}
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
if (e.getValueIsAdjusting()) {
|
||||
|
|
@ -516,7 +504,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
int rowIndex = table.getSelectedRow();
|
||||
if (rowIndex!=-1) {
|
||||
// temp; gets index by sorter
|
||||
rowIndex = tableSorter.modelIndex(rowIndex);
|
||||
//rowIndex = tableSorter.modelIndex(rowIndex);
|
||||
Object data = entry.getVascFrontendData().getEntryDataList().get(rowIndex);
|
||||
entry.getVascFrontendData().setEntryDataObject(data);
|
||||
} else {
|
||||
|
|
@ -558,7 +546,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
for(RowVascAction action:entry.getRowActions()) {
|
||||
JButton but = new JButton();
|
||||
but.setText(i18n(action.getName()));
|
||||
but.setToolTipText(i18n(action.getToolTip()));
|
||||
but.setToolTipText(i18n(action.getDescription()));
|
||||
but.setIcon(getImageIcon(action.getImage()));
|
||||
but.addActionListener(new RowActionListener(action));
|
||||
panel.add(but);
|
||||
|
|
@ -581,7 +569,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
try {
|
||||
action.doRowAction(entry, entry.getVascFrontendData().getEntryDataObject());
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -599,19 +587,21 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
try {
|
||||
action.doGlobalAction(entry);
|
||||
} catch (Exception e) {
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(e, entry);
|
||||
entry.getVascFrontendData().getVascFrontendHelper().handleException(entry,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VascColumnModel extends AbstractTableModel { //implements VascEventListener {
|
||||
class VascColumnModel extends AbstractTableModel implements VascEntryEventListener {
|
||||
private static final long serialVersionUID = 10L;
|
||||
|
||||
public void vascEvent(VascEventType e,Object o) {
|
||||
if (e==VascEventType.DATA_UPDATE) {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
public void vascEvent(VascEntry entry,VascEventType e,Object o) {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
public VascEntryEventListener clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.swing.entry.entryModel#getColumnCount()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue