JSONObject deserialization cann call methods now
Currently the only supported parameter is String
This commit is contained in:
@ -192,51 +192,16 @@ public class AssetEditorDialog extends EscDialog {
|
||||
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
static public boolean runDialog(Window parent, JSONObject o) {
|
||||
//JSONObject jo = new org.json.JSONObject(parent, new String[]{"getMyName"});
|
||||
//System.out.printf("PARENT: %s", jo.toString());
|
||||
// JSONObject.
|
||||
|
||||
|
||||
|
||||
static public boolean runDialog(Window parent, JSONObject o, JSONObject all) {
|
||||
|
||||
AssetEditorDialog d = new AssetEditorDialog(parent);
|
||||
Json.put(d.assetEditorPanel, o);
|
||||
if (o!=null)
|
||||
Json.put(d.assetEditorPanel, o);
|
||||
|
||||
d.setLocationRelativeTo(parent);
|
||||
d.setVisible(true);
|
||||
d.dispose();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
d.assetEditorPanel.symField.setText("Hallo");
|
||||
//d.assetEditorPanel.symField.setText("Herr");
|
||||
JSONObject jo = Json.get(d.assetEditorPanel);
|
||||
|
||||
System.out.printf("Resulting JSONN %s\n", jo.toString(5));
|
||||
|
||||
//Class aClass = d.assetEditorPanel.getClass().getDeclaredFields();
|
||||
|
||||
Field[] fields = d.assetEditorPanel.getClass().getFields();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (Field f : fields) {
|
||||
|
||||
Export ex = f.getAnnotation(Export.class);
|
||||
System.out.printf("Fieldname: %s\n",f.getName());
|
||||
|
||||
|
||||
|
||||
if (ex == null){
|
||||
continue;
|
||||
}
|
||||
|
||||
System.out.printf("EX: %s\n", ex.getClass().getName());
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,11 @@ public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
@Export
|
||||
public String hallo = "hello";
|
||||
|
||||
@Import("type")
|
||||
public void putType(String type){
|
||||
System.out.printf("Here we have a type: %s\n", type);
|
||||
}
|
||||
|
||||
public JDialog dialog;
|
||||
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class AssetListDialog extends EscDialog {
|
||||
private void doEdit() {
|
||||
JSONObject o = assetListPanel.getSelectedObject();
|
||||
System.out.printf("JON: %s",o.toString(4));
|
||||
AssetEditorDialog.runDialog(this, o);
|
||||
AssetEditorDialog.runDialog(this, o,null);
|
||||
}
|
||||
|
||||
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
|
||||
|
@ -52,7 +52,7 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
|
||||
return;
|
||||
}
|
||||
|
||||
json_set = new JSONObject(Globals.prefs.get("myassets", "{EUR:{name:Euro,decimals:8}}"));
|
||||
json_set = new JSONObject(Globals.prefs.get("myassets", "{EUR:{name:Euro,decimals:8,type:Curreny}}"));
|
||||
reload();
|
||||
|
||||
assetTable.setRowSelectionAllowed(true);
|
||||
@ -102,7 +102,8 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
|
||||
m.addRow(new Object[]{
|
||||
o.opt("id"),
|
||||
symbol,
|
||||
o.opt("name")
|
||||
o.opt("name"),
|
||||
o.opt("type")
|
||||
});
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user