Upgraded backend api with generics.
This commit is contained in:
parent
9a6227be5b
commit
1b3e65fa83
53 changed files with 282 additions and 256 deletions
|
|
@ -27,6 +27,7 @@ import java.awt.FlowLayout;
|
|||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JButton;
|
||||
|
|
@ -56,14 +57,14 @@ public class SwingVascEditDialog extends JPanel {
|
|||
private static final long serialVersionUID = 10L;
|
||||
private String headerText = null;
|
||||
private String headerTextValue = null;
|
||||
private Object result = null;
|
||||
private Object bean = null;
|
||||
private Serializable result = null;
|
||||
private Serializable bean = null;
|
||||
private VascEntry entry = null;
|
||||
private SwingVascFrontend swingFrontend = null;
|
||||
private SwingPanelIntegration panels = null;
|
||||
private JPanel editView = null;
|
||||
|
||||
public SwingVascEditDialog(SwingVascFrontend swingFrontend,JPanel editView,VascEntry entry,Object bean,String beanValue,SwingPanelIntegration panels) throws VascException {
|
||||
public SwingVascEditDialog(SwingVascFrontend swingFrontend,JPanel editView,VascEntry entry,Serializable bean,String beanValue,SwingPanelIntegration panels) throws VascException {
|
||||
super();
|
||||
this.headerText = "vasc.dialog.edit.message";
|
||||
this.headerTextValue = beanValue;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import java.awt.event.MouseEvent;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
|
@ -156,7 +157,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
public void renderEdit() throws VascFrontendException {
|
||||
logger.fine("Rending Edit View");
|
||||
try {
|
||||
Object rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Serializable rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
String beanValue = rowBean.toString();
|
||||
if (entry.getDisplayNameFieldId()!=null) {
|
||||
VascEntryField v = entry.getVascEntryFieldById(entry.getDisplayNameFieldId());
|
||||
|
|
@ -503,7 +504,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
if (rowIndex!=-1) {
|
||||
// temp; gets index by sorter
|
||||
//rowIndex = tableSorter.modelIndex(rowIndex);
|
||||
Object data = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex);
|
||||
Serializable data = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex);
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(data);
|
||||
} else {
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(null);
|
||||
|
|
|
|||
|
|
@ -45,19 +45,19 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-ldap</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-mongodb</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.forwardfire.vasc</groupId>
|
||||
<groupId>net.forwardfire.vasc.backend</groupId>
|
||||
<artifactId>vasc-backend-jdbc</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package net.forwardfire.vasc.frontend.swt;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
|
@ -440,7 +441,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Object data = e.item.getData();
|
||||
Serializable data = (Serializable) e.item.getData();
|
||||
logger.fine("Slecting data: "+data);
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.web.jsf;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -50,7 +51,7 @@ public abstract class AbstractJSFVascFacesControllerBase {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public List<Object> executeVascList(String entryId,Map<String,Object> para) {
|
||||
public List<Serializable> executeVascList(String entryId,Map<String,Object> para) {
|
||||
try {
|
||||
// plug all object
|
||||
VascEntryLocal entry = (VascEntryLocal)getVascController().getVascEntryController().getVascEntryById(entryId);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.web.jsf;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -78,10 +79,10 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
*/
|
||||
List<Object> data = entry.getVascFrontendController().getVascEntryState().getEntryDataList();
|
||||
List<Serializable> data = entry.getVascFrontendController().getVascEntryState().getEntryDataList();
|
||||
List<Object> result = new ArrayList<Object>(data.size());
|
||||
int index = 0;
|
||||
for (Object o:data) {
|
||||
for (Serializable o:data) {
|
||||
VascDataBackendBean b = new VascDataBackendBean(entry,o,index);
|
||||
result.add(b);
|
||||
index++;
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
VascEntry parent = entry.getVascFrontendController().getVascEntryState().getParent().getVascEntry();
|
||||
|
||||
RowVascAction action = parent.getRowActionById(actionIdString);
|
||||
Object parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
Serializable parentSelected = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
logger.fine("parentCustomRowaction do on: "+action+" parentSelection: "+parentSelected);
|
||||
try {
|
||||
action.doRowAction(parent,parentSelected);
|
||||
|
|
@ -401,7 +401,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
Boolean value = state.getMultiActionSelection().get(rowId);
|
||||
logger.fine("multiRow selected: "+rowId+" value: "+value);
|
||||
if (value!=null && value==true) {
|
||||
Object row = state.getEntryDataList().get(rowId);
|
||||
Serializable row = state.getEntryDataList().get(rowId);
|
||||
logger.finer("row: "+row);
|
||||
action.doRowAction(vascEntry, row);
|
||||
if (action.getId().equals(DeleteRowAction.ACTION_ID)) {
|
||||
|
|
@ -468,7 +468,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
VascEntry entry = getVascEntry();
|
||||
|
||||
// select record to edit
|
||||
Object rowObject = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
Serializable rowObject = entry.getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
comp.initGoto(entry.getVascFrontendController().getVascEntryState().getParent(),rowObject);
|
||||
}
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
VascEntryLink link = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getVascEntry().getVascEntryLinkById(linkId);
|
||||
comp.initGoto(link,comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent());
|
||||
|
||||
Object o = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
Serializable o = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataObject();
|
||||
int index = comp.getVascEntry().getVascFrontendController().getVascEntryState().getParent().getEntryDataList().indexOf(o);
|
||||
VascDataBackendBean selected = new VascDataBackendBean(entry,o,index);
|
||||
this.selected=selected;
|
||||
|
|
@ -668,17 +668,17 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
VascEntry entry = comp.getVascEntry();
|
||||
VascEntryState state = entry.getVascFrontendController().getVascEntryState();
|
||||
|
||||
List<Object> sels = new ArrayList<Object>(5);
|
||||
List<Serializable> sels = new ArrayList<Serializable>(5);
|
||||
for (Integer rowId:state.getMultiActionSelection().keySet()) {
|
||||
Boolean value = state.getMultiActionSelection().get(rowId);
|
||||
logger.fine("multiRow delete: "+rowId+" value: "+value);
|
||||
if (value!=null && value==true) {
|
||||
Object row = state.getEntryDataList().get(rowId);
|
||||
Serializable row = state.getEntryDataList().get(rowId);
|
||||
sels.add(row);
|
||||
}
|
||||
}
|
||||
if (sels.isEmpty()==false) {
|
||||
for (Object row:sels) {
|
||||
for (Serializable row:sels) {
|
||||
entry.getVascFrontendController().getVascEntryState().setEntryDataObject(row);
|
||||
entry.getVascFrontendController().getVascFrontendActions().deleteObject();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
package net.forwardfire.vasc.frontend.web.jsf;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
|
@ -72,7 +73,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
private VascEntryLink link = null;
|
||||
private VascEntryState linkState = null;
|
||||
private VascEntryState state = null;
|
||||
private Object stateEditId = null;
|
||||
private Serializable stateEditId = null;
|
||||
private Logger logger = null;
|
||||
private Boolean initClear = null;
|
||||
private String injectTableOptionOnChange = null;
|
||||
|
|
@ -182,7 +183,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
this.state=state;
|
||||
}
|
||||
|
||||
protected void initGoto(VascEntryState state,Object stateEditId) {
|
||||
protected void initGoto(VascEntryState state,Serializable stateEditId) {
|
||||
logger.fine("init goto "+state);
|
||||
this.state=state;
|
||||
this.stateEditId=stateEditId;
|
||||
|
|
@ -218,7 +219,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
}
|
||||
|
||||
if (stateEditId!=null) {
|
||||
Object rowObject = stateEditId;
|
||||
Serializable rowObject = stateEditId;
|
||||
|
||||
// setup for renderEdit() of frontend
|
||||
List<Object> list = new ArrayList<Object>(1);
|
||||
|
|
|
|||
|
|
@ -29,11 +29,8 @@ import net.forwardfire.vasc.backend.VascBackendException;
|
|||
import net.forwardfire.vasc.backend.VascEntryFieldValue;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.VascException;
|
||||
import net.forwardfire.vasc.frontend.VascFrontendDataSelector.EntryFieldSelectType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
|
@ -44,11 +41,11 @@ public class VascDataBackendBean implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 3881688974089760074L;
|
||||
private VascEntry entry = null;
|
||||
private Object record = null;
|
||||
private Serializable record = null;
|
||||
private boolean realValue = false;
|
||||
private int recordId = 0;
|
||||
|
||||
public VascDataBackendBean(VascEntry entry,Object record,int recordId) {
|
||||
public VascDataBackendBean(VascEntry entry,Serializable record,int recordId) {
|
||||
this.entry=entry;
|
||||
this.record=record;
|
||||
this.recordId=recordId;
|
||||
|
|
@ -102,7 +99,7 @@ public class VascDataBackendBean implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
public Object getRecord() {
|
||||
public Serializable getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue