Moved all data objects to Serializable and some generics bits.
This commit is contained in:
parent
1b3e65fa83
commit
3bf185ad48
73 changed files with 228 additions and 181 deletions
|
|
@ -25,6 +25,7 @@ package net.forwardfire.vasc.frontend.swing;
|
|||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
|
|
@ -158,7 +159,7 @@ public class SwingActionPanel extends JPanel implements VascEntryFrontendEventLi
|
|||
return result;
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
|
||||
|
||||
init = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ package net.forwardfire.vasc.frontend.swing;
|
|||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JButton;
|
||||
|
|
@ -81,7 +82,7 @@ public class SwingPagerPanel extends JPanel implements VascEntryFrontendEventLis
|
|||
}
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
public void vascEvent(VascEntry entry, Serializable data) {
|
||||
|
||||
for(Component c:result.getComponents()) {
|
||||
if (c instanceof JButton) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ package net.forwardfire.vasc.frontend.swing;
|
|||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ public class SwingPanelFrame implements SwingPanelIntegration {
|
|||
|
||||
entry.getVascFrontendController().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
|
||||
private static final long serialVersionUID = -6801954395965101748L;
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
public void vascEvent(VascEntry entry, Serializable data) {
|
||||
if (data instanceof Exception) {
|
||||
Exception e = (Exception)data;
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swing;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
|
|
@ -56,7 +58,7 @@ public class SwingPanelTabbed implements SwingPanelIntegration {
|
|||
|
||||
entry.getVascFrontendController().addVascEntryFrontendEventListener(new VascEntryFrontendEventListener() {
|
||||
private static final long serialVersionUID = -6801954395965101748L;
|
||||
public void vascEvent(VascEntry entry, Object data) {
|
||||
public void vascEvent(VascEntry entry, Serializable data) {
|
||||
if (data instanceof Exception) {
|
||||
Exception e = (Exception)data;
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class SwingVascEditDialog extends JPanel {
|
|||
|
||||
// Set parameters
|
||||
try {
|
||||
Object selected = bean;
|
||||
Serializable selected = bean;
|
||||
for (String parameterName:vle.getEntryParameterFieldIdKeys()) {
|
||||
String fieldId = vle.getEntryParameterFieldId(parameterName);
|
||||
VascEntryField v = entry.getVascEntryFieldById(fieldId);
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ public class SwingVascFrontend extends AbstractVascFrontend {
|
|||
}
|
||||
|
||||
public void renderDelete() throws VascFrontendException {
|
||||
Object rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Serializable rowBean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
String beanValue = rowBean.toString();
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swing;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -47,7 +48,7 @@ public class SwingVascTableModel extends AbstractTableModel implements VascEntry
|
|||
entry.getVascFrontendController().addVascEntryFrontendEventListener(this);
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object o) {
|
||||
public void vascEvent(VascEntry entry,Serializable o) {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +80,7 @@ public class SwingVascTableModel extends AbstractTableModel implements VascEntry
|
|||
* @see javax.swing.entry.entryModel#getValueAt(int, int)
|
||||
*/
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex);
|
||||
Serializable bean = entry.getVascFrontendController().getVascEntryState().getEntryDataList().get(rowIndex);
|
||||
|
||||
// TODO: this is slowing....
|
||||
List<VascEntryField> list = new ArrayList<VascEntryField>();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swt;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
|
|
@ -125,7 +126,7 @@ public class SwtActionPanel implements VascEntryFrontendEventListener {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
|
||||
vascEvent = true;
|
||||
|
||||
long pageSize = entry.getVascFrontendController().getVascFrontendPageInfo().getPageSize();
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swt;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
|
|
@ -76,7 +77,7 @@ public class SwtPagerPanel implements VascEntryFrontendEventListener {
|
|||
return result;
|
||||
}
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swt;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
|
|
@ -125,7 +127,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
}
|
||||
String name = null;
|
||||
try {
|
||||
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Serializable bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
name = dis.getVascEntryFieldValue().getDisplayValue(dis.getBackendName(), bean);
|
||||
} catch (VascBackendException e) {
|
||||
throw new RuntimeException("Could not display value from "+entry.getId(),e);
|
||||
|
|
@ -156,7 +158,7 @@ public class SwtVascEditDialog extends Dialog {
|
|||
public void createBody(Composite body) throws VascException {
|
||||
body.setLayout(new GridLayout(2, true));
|
||||
body.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
Object bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
Serializable bean = entry.getVascFrontendController().getVascEntryState().getEntryDataObject();
|
||||
|
||||
entry.getVascFrontendController().clearFieldRenderObjects(); // only needed for swt use
|
||||
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.POST_READ};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry,Object data) {
|
||||
public void vascEvent(VascEntry entry,Serializable data) {
|
||||
tableViewer.refresh();
|
||||
table2.deselectAll();
|
||||
}
|
||||
|
|
@ -638,7 +638,7 @@ public class SwtVascFrontend extends AbstractVascFrontend {
|
|||
|
||||
//if (vtc.getVascColumnRenderer()==null) {
|
||||
try {
|
||||
return vtc.getVascEntryFieldValue().getDisplayValue(vtc.getBackendName(),bean);
|
||||
return vtc.getVascEntryFieldValue().getDisplayValue(vtc.getBackendName(),(Serializable) bean);
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.WARNING,"Error in get value: '"+vtc.getVascEntryFieldValue()+"' error: "+e.getMessage(),e);
|
||||
return "Err";
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swt.ui;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
|
|
@ -72,7 +74,7 @@ public class SwtText implements VascUIComponent {
|
|||
}
|
||||
|
||||
public void modifyText(ModifyEvent e) {
|
||||
Object value = text.getText();
|
||||
Serializable value = text.getText();
|
||||
try {
|
||||
model.setValue(value);
|
||||
} catch (VascException ve) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
package net.forwardfire.vasc.frontend.swt.ui;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import net.forwardfire.vasc.core.VascEntry;
|
||||
import net.forwardfire.vasc.core.VascEntryField;
|
||||
import net.forwardfire.vasc.core.ui.VascUIComponent;
|
||||
|
|
@ -96,7 +98,7 @@ public class SwtTextArea implements VascUIComponent {
|
|||
}
|
||||
|
||||
public void modifyText(ModifyEvent e) {
|
||||
Object value = text.getText();
|
||||
Serializable value = text.getText();
|
||||
try {
|
||||
model.setValue(value);
|
||||
} catch (VascException ve) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class JSFVascEntryEventListener implements VascEntryFrontendEventListener
|
|||
|
||||
|
||||
|
||||
public void vascEvent(VascEntry entry,Object dataNotUsed) {
|
||||
public void vascEvent(VascEntry entry,Serializable dataNotUsed) {
|
||||
/* moved to fillVascEntryFrontend
|
||||
try {
|
||||
for (VascEntryField field:entry.getVascEntryFields()) {
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ public class JSFVascEntrySupportBean implements Serializable {
|
|||
logger.fine("moveAction");
|
||||
String moveAction = getComponentType(event.getComponent());
|
||||
JSFVascUIComponent comp = JSFVascUIComponent.findVascParent(event.getComponent());
|
||||
Object selected = comp.getSupportBean().getSelectedTableRecord().getRecord();
|
||||
Serializable selected = comp.getSupportBean().getSelectedTableRecord().getRecord();
|
||||
if ("up".equals(moveAction)) {
|
||||
entry.getVascFrontendController().getVascFrontendActions().moveUpAction(selected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
|
||||
// Set parameters
|
||||
try {
|
||||
Object selected = getSupportBean().getSelected().getRecord();
|
||||
Serializable selected = getSupportBean().getSelected().getRecord();
|
||||
for (String parameterName:link.getEntryParameterFieldIdKeys()) {
|
||||
String fieldId = link.getEntryParameterFieldId(parameterName);
|
||||
VascEntryField v = getVascEntry().getVascEntryFieldById(fieldId);
|
||||
|
|
@ -361,7 +361,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
|
||||
for (String fieldId:link.getEntryCreateFieldValueKeys()) {
|
||||
String selectedfieldId = link.getEntryParameterFieldId(fieldId);
|
||||
Object selectedValue = selected;
|
||||
Serializable selectedValue = selected;
|
||||
if (selectedfieldId!=null) {
|
||||
VascEntryField v = getVascEntry().getVascEntryFieldById(selectedfieldId);
|
||||
selectedValue = v.getVascEntryFieldValue().getValue(v.getBackendName(), selected);
|
||||
|
|
@ -385,8 +385,8 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
class CreateEntryFieldValuesListener2 implements VascEntryFrontendEventListener {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String fieldId = null;
|
||||
private Object value = null;
|
||||
public CreateEntryFieldValuesListener2(String fieldId,Object value) {
|
||||
private Serializable value = null;
|
||||
public CreateEntryFieldValuesListener2(String fieldId,Serializable value) {
|
||||
if (fieldId==null) {
|
||||
throw new NullPointerException("fieldId may not be null");
|
||||
}
|
||||
|
|
@ -397,7 +397,7 @@ public class JSFVascUIComponent extends UIComponentBase {
|
|||
VascFrontendEventType[] result = {VascEntryFrontendEventListener.VascFrontendEventType.PRE_CREATE};
|
||||
return result;
|
||||
}
|
||||
public void vascEvent(VascEntry entry,Object data) {
|
||||
public void vascEvent(VascEntry entry,Serializable data) {
|
||||
VascEntryField field = entry.getVascEntryFieldById(fieldId);
|
||||
try {
|
||||
field.getVascEntryFieldValue().setValue(field.getBackendName(), data, value);
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ public class JSFVascUIComponentRenderer extends Renderer {
|
|||
}
|
||||
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
|
||||
try {
|
||||
model.setValue(event.getNewValue());
|
||||
model.setValue((Serializable)event.getNewValue());
|
||||
} catch (VascException e) {
|
||||
throw new AbortProcessingException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ public class VascDataBackendBean implements Serializable {
|
|||
private void setValue(int index,Object valueObject) {
|
||||
try {
|
||||
VascEntryField field = getFieldIdByIndex(entry,index);
|
||||
VascEntryFieldValue value = field.getVascEntryFieldValue();
|
||||
value.setValue(field.getBackendName(), record,valueObject);
|
||||
VascEntryFieldValue<Serializable> value = field.getVascEntryFieldValue();
|
||||
value.setValue(field.getBackendName(), record,(Serializable)valueObject); // TODO: rm cast
|
||||
} catch (VascBackendException e) {
|
||||
throw new RuntimeException("Could not set value on record.",e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue