Removed the "masterkey thing"
We will use proxies from RealWorld to GodWorld
This commit is contained in:
@ -31,10 +31,8 @@ import java.awt.Window;
|
||||
import opensesim.world.AbstractAsset;
|
||||
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.gui.util.Json;
|
||||
import opensesim.world.World;
|
||||
import opensesim.world.WorldAdm;
|
||||
import opensesim.world.GodWorld;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
@ -43,7 +41,7 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class AssetEditorDialog extends EscDialog {
|
||||
|
||||
WorldAdm worldadm;
|
||||
GodWorld worldadm;
|
||||
|
||||
|
||||
/**
|
||||
@ -196,7 +194,7 @@ public class AssetEditorDialog extends EscDialog {
|
||||
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
static public boolean runDialog(Window parent, WorldAdm worldadm, JSONObject o, JSONObject old) {
|
||||
static public boolean runDialog(Window parent, GodWorld worldadm, JSONObject o, JSONObject old) {
|
||||
|
||||
AssetEditorDialog d = new AssetEditorDialog(parent);
|
||||
d.worldadm = worldadm;
|
||||
|
@ -40,8 +40,9 @@ import opensesim.gui.util.Json;
|
||||
import opensesim.gui.util.Json.Export;
|
||||
import opensesim.gui.util.Json.Import;
|
||||
import opensesim.util.SeSimException;
|
||||
import opensesim.world.World;
|
||||
import opensesim.world.WorldAdm;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.RealWorld;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
@ -228,7 +229,7 @@ public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
decimalsField.setValue(Integer.parseInt(d));
|
||||
}
|
||||
|
||||
@Export(World.JKEYS.ASSET_TYPE)
|
||||
@Export(GodWorld.JKEYS.ASSET_TYPE)
|
||||
public String getType() {
|
||||
int selected = assetTypesComboBox.getSelectedIndex();
|
||||
//return asset_types.get(selected).getName();
|
||||
@ -237,7 +238,7 @@ public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
|
||||
String type;
|
||||
|
||||
@Import(World.JKEYS.ASSET_TYPE)
|
||||
@Import(GodWorld.JKEYS.ASSET_TYPE)
|
||||
public void setType(String type) {
|
||||
this.type=type;
|
||||
|
||||
@ -249,7 +250,7 @@ public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
AbstractAsset a;
|
||||
|
||||
try {
|
||||
a = ac.getConstructor(World.class, JSONObject.class).newInstance(null, null);
|
||||
a = ac.getConstructor(RealWorld.class, JSONObject.class).newInstance(null, null);
|
||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
|
||||
Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return;
|
||||
@ -274,12 +275,12 @@ public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
|
||||
public boolean save(WorldAdm worldadm ){
|
||||
public boolean save(GodWorld worldadm ){
|
||||
JSONObject jo = Json.get(this);
|
||||
|
||||
System.out.printf("ASSETGETTER: %s\n",jo.toString(5));
|
||||
|
||||
if (jo.getString(World.JKEYS.ASSET_SYMBOL).length()==0){
|
||||
if (jo.getString(GodWorld.JKEYS.ASSET_SYMBOL).length()==0){
|
||||
javax.swing.JOptionPane.showMessageDialog(this, "Symbol must not be empty.",
|
||||
"Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
@ -287,7 +288,7 @@ public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
}
|
||||
|
||||
try {
|
||||
worldadm.world.createAsset(worldadm.masterKey, jo);
|
||||
worldadm.createAsset(jo);
|
||||
} catch (SeSimException ex) {
|
||||
javax.swing.JOptionPane.showMessageDialog(this, ex.getMessage(),
|
||||
"Error",
|
||||
|
@ -29,8 +29,7 @@ import java.awt.Window;
|
||||
import java.awt.event.MouseEvent;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.world.World;
|
||||
import opensesim.world.WorldAdm;
|
||||
import opensesim.world.GodWorld;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -40,7 +39,7 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class AssetListDialog extends EscDialog {
|
||||
|
||||
WorldAdm worldadm;
|
||||
GodWorld worldadm;
|
||||
|
||||
/**
|
||||
* Creates new form EditAssetsDialog
|
||||
@ -62,7 +61,7 @@ public class AssetListDialog extends EscDialog {
|
||||
this.assetListPanel.assetTable.addMouseListener(l);
|
||||
}
|
||||
|
||||
public AssetListDialog(WorldAdm worldadm, Window parent, boolean modal) {
|
||||
public AssetListDialog(GodWorld worldadm, Window parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
this.worldadm = worldadm;
|
||||
|
||||
@ -173,7 +172,7 @@ public class AssetListDialog extends EscDialog {
|
||||
return;
|
||||
}
|
||||
JSONObject o = new JSONObject();
|
||||
o.put(World.JKEYS.ASSET_TYPE, type);
|
||||
o.put(GodWorld.JKEYS.ASSET_TYPE, type);
|
||||
|
||||
AssetEditorDialog.runDialog(this, worldadm, o, null);
|
||||
assetListPanel.reload();
|
||||
@ -185,7 +184,7 @@ public class AssetListDialog extends EscDialog {
|
||||
private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneButtonActionPerformed
|
||||
dispose();
|
||||
|
||||
JSONObject o = worldadm.world.getJson();
|
||||
JSONObject o = worldadm.getJson();
|
||||
Globals.prefs.put("world", o.toString());
|
||||
}//GEN-LAST:event_doneButtonActionPerformed
|
||||
|
||||
@ -205,7 +204,7 @@ public class AssetListDialog extends EscDialog {
|
||||
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
|
||||
JSONObject o = assetListPanel.getSelectedObject();
|
||||
JSONObject ass = Globals.getAssets();
|
||||
ass.remove(o.getString(World.JKEYS.ASSET_SYMBOL));
|
||||
ass.remove(o.getString(GodWorld.JKEYS.ASSET_SYMBOL));
|
||||
Globals.putAssets(ass);
|
||||
assetListPanel.reload();
|
||||
}//GEN-LAST:event_deleteButtonActionPerformed
|
||||
|
@ -32,9 +32,9 @@ import java.util.logging.Logger;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
import opensesim.world.AbstractAsset;
|
||||
import opensesim.world.World;
|
||||
import opensesim.world.RealWorld;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.world.WorldAdm;
|
||||
import opensesim.world.GodWorld;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionList {
|
||||
|
||||
WorldAdm worldadm;
|
||||
GodWorld worldadm;
|
||||
|
||||
/**
|
||||
* Creates new form AssetList
|
||||
@ -63,7 +63,7 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
|
||||
assetTable.getColumnModel().getColumn(2).setPreferredWidth(80);
|
||||
}
|
||||
|
||||
public AssetListPanel(WorldAdm worldadm) {
|
||||
public AssetListPanel(GodWorld worldadm) {
|
||||
|
||||
this();
|
||||
this.worldadm = worldadm;
|
||||
@ -74,13 +74,13 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
|
||||
public JSONObject getSelectedObject() {
|
||||
int row = assetTable.getSelectedRow();
|
||||
String symbol = (String) assetTable.getValueAt(row, 0);
|
||||
return worldadm.world.getAssetBySymbol(symbol).getJson();
|
||||
return worldadm.getAssetBySymbol(symbol).getJson();
|
||||
}
|
||||
|
||||
final void reload() {
|
||||
|
||||
Collection<AbstractAsset> assets;
|
||||
assets = worldadm.world.getAssetCollection();
|
||||
assets = worldadm.getAssetCollection();
|
||||
DefaultTableModel m = (DefaultTableModel) assetTable.getModel();
|
||||
m.setRowCount(0);
|
||||
for (AbstractAsset asset : assets) {
|
||||
@ -94,7 +94,7 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
|
||||
String type_name;
|
||||
|
||||
try {
|
||||
type_name = a.getConstructor(World.class, JSONObject.class).newInstance(null, null).getTypeName();
|
||||
type_name = a.getConstructor(GodWorld.class, JSONObject.class).newInstance(null, null).getTypeName();
|
||||
|
||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
|
||||
Logger.getLogger(AssetListPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
@ -36,7 +36,8 @@ import javax.swing.DefaultComboBoxModel;
|
||||
import opensesim.world.AbstractAsset;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.world.World;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.RealWorld;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
@ -45,7 +46,8 @@ import org.json.JSONObject;
|
||||
*/
|
||||
public class SelectAssetTypeDialog extends EscDialog {
|
||||
|
||||
ArrayList<Class<AbstractAsset>>asset_types;
|
||||
ArrayList<Class<AbstractAsset>> asset_types;
|
||||
|
||||
/**
|
||||
* Creates new form SelectAssetTypeDialog
|
||||
*/
|
||||
@ -64,22 +66,16 @@ public class SelectAssetTypeDialog extends EscDialog {
|
||||
Class<AbstractAsset> asset_type = asset_types.get(i);
|
||||
System.out.printf("ACL: %s\n", asset_type.getName());
|
||||
|
||||
try {
|
||||
Constructor<AbstractAsset> c;
|
||||
c = asset_type.getConstructor(World.class,JSONObject.class);
|
||||
ait = c.newInstance(null,null);
|
||||
|
||||
//ait = asset_type.getConstructor<AbstractAsset>(World.class,JSONObject.class).
|
||||
vector.add(i, ait.getTypeName());
|
||||
} catch (InstantiationException | IllegalAccessException | ClassCastException ex) {
|
||||
Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
|
||||
Logger.getLogger(SelectAssetTypeDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
String tn = GodWorld.getTypeName(asset_type);
|
||||
if (tn == null) {
|
||||
continue;
|
||||
}
|
||||
vector.add(i, tn);
|
||||
|
||||
}
|
||||
return new DefaultComboBoxModel(vector.toArray());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
@ -151,7 +147,7 @@ public class SelectAssetTypeDialog extends EscDialog {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
String selected = null;
|
||||
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
int i = this.assetTypeComboBox.getSelectedIndex();
|
||||
selected = asset_types.get(i).getName();
|
||||
@ -162,15 +158,14 @@ public class SelectAssetTypeDialog extends EscDialog {
|
||||
dispose();
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
|
||||
public static String runDialog(Window parent){
|
||||
public static String runDialog(Window parent) {
|
||||
SelectAssetTypeDialog dialog;
|
||||
dialog = new SelectAssetTypeDialog(parent,true);
|
||||
dialog = new SelectAssetTypeDialog(parent, true);
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
dialog.setVisible(true);
|
||||
return dialog.selected;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
|
Reference in New Issue
Block a user