Removed dead code

This commit is contained in:
7u83 2018-12-05 17:58:49 +01:00
parent 5a30e4fde2
commit 84c6718c8e
5 changed files with 35 additions and 81 deletions

View File

@ -1,4 +1,4 @@
#Wed, 05 Dec 2018 17:40:04 +0100
#Wed, 05 Dec 2018 17:57:49 +0100
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -29,13 +29,13 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
<Component id="deleteButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="editButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="newButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<Component id="doneButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
@ -54,8 +54,8 @@
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="newButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="doneButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="deleteButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="editButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -64,12 +64,12 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Component class="javax.swing.JButton" name="doneButton">
<Properties>
<Property name="text" type="java.lang.String" value="Done"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="doneButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="newButton">
@ -81,12 +81,12 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Component class="javax.swing.JButton" name="deleteButton">
<Properties>
<Property name="text" type="java.lang.String" value="Delete"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="editButton">

View File

@ -91,9 +91,9 @@ public class AssetListDialog extends EscDialog {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
doneButton = new javax.swing.JButton();
newButton = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
deleteButton = new javax.swing.JButton();
editButton = new javax.swing.JButton();
assetListPanel = new opensesim.gui.AssetEditor.AssetListPanel(worldadm);
@ -101,10 +101,10 @@ public class AssetListDialog extends EscDialog {
setTitle("Edit Assets");
setModal(true);
jButton1.setText("Done");
jButton1.addActionListener(new java.awt.event.ActionListener() {
doneButton.setText("Done");
doneButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
doneButtonActionPerformed(evt);
}
});
@ -116,10 +116,10 @@ public class AssetListDialog extends EscDialog {
}
});
jButton3.setText("Delete");
jButton3.addActionListener(new java.awt.event.ActionListener() {
deleteButton.setText("Delete");
deleteButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
deleteButtonActionPerformed(evt);
}
});
@ -138,13 +138,13 @@ public class AssetListDialog extends EscDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton3)
.addComponent(deleteButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(editButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(newButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1))
.addComponent(doneButton))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(assetListPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
@ -158,8 +158,8 @@ public class AssetListDialog extends EscDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(newButton)
.addComponent(jButton1)
.addComponent(jButton3)
.addComponent(doneButton)
.addComponent(deleteButton)
.addComponent(editButton))
.addContainerGap())
);
@ -180,13 +180,13 @@ public class AssetListDialog extends EscDialog {
}//GEN-LAST:event_newButtonActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneButtonActionPerformed
dispose();
}//GEN-LAST:event_jButton1ActionPerformed
}//GEN-LAST:event_doneButtonActionPerformed
private void doEdit() {
JSONObject o = assetListPanel.getSelectedObject();
// AssetEditorDialog.runDialog(this, o, o);
AssetEditorDialog.runDialog(this, worldadm, o, o);
assetListPanel.reload();
}
@ -197,13 +197,13 @@ public class AssetListDialog extends EscDialog {
}//GEN-LAST:event_editButtonActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
JSONObject o = assetListPanel.getSelectedObject();
JSONObject ass = Globals.getAssets();
ass.remove(o.getString("symbol"));
ass.remove(o.getString(World.JKEYS.ASSET_SYMBOL));
Globals.putAssets(ass);
assetListPanel.reload();
}//GEN-LAST:event_jButton3ActionPerformed
}//GEN-LAST:event_deleteButtonActionPerformed
/**
* @param args the command line arguments
@ -250,9 +250,9 @@ public class AssetListDialog extends EscDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private opensesim.gui.AssetEditor.AssetListPanel assetListPanel;
private javax.swing.JButton deleteButton;
private javax.swing.JButton doneButton;
private javax.swing.JButton editButton;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
private javax.swing.JButton newButton;
// End of variables declaration//GEN-END:variables
}

View File

@ -45,8 +45,6 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
WorldAdm worldadm;
JSONObject json_set;
/**
* Creates new form AssetList
*/
@ -58,12 +56,6 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
return;
}
json_set = new JSONObject(Globals.prefs.get("myassets", "{"
+ "EUR:{name:Euro,decimals:8,type:opensesim.sesim.Assets.FurtureAsset}}"));
json_set = Globals.getAssets();
// reload();
assetTable.setRowSelectionAllowed(true);
assetTable.getColumnModel().getColumn(0).setPreferredWidth(30);
@ -82,45 +74,11 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
public JSONObject getSelectedObject() {
int row = assetTable.getSelectedRow();
String symbol = (String) assetTable.getValueAt(row, 0);
return json_set.getJSONObject(symbol);
return worldadm.world.getAssetBySymbol(symbol).getJson();
}
final void reload() {
/* json_set = Globals.getAssets();
DefaultTableModel m = (DefaultTableModel) assetTable.getModel();
m.setRowCount(0);
for (String symbol : json_set.keySet()) {
JSONObject o = json_set.optJSONObject(symbol);
if (o == null) {
continue;
}
Class <AbstractAsset> a = Globals.getClassByName(o.optString("type"));
String type_name;
try {
type_name=a.getConstructor(World.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);
continue;
}
m.addRow(new Object[]{
symbol,
o.opt("name"),
type_name
});
}*/
Collection<AbstractAsset> assets;
assets = worldadm.world.getAssetCollection();
DefaultTableModel m = (DefaultTableModel) assetTable.getModel();
@ -177,14 +135,6 @@ public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionLi
}
public void uppdate() {
DefaultTableModel m;
m = (DefaultTableModel) this.assetTable.getModel();
m.fireTableDataChanged();
}
/**
* 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

View File

@ -136,6 +136,10 @@ public class World {
public Collection<AbstractAsset> getAssetCollection() {
return Collections.unmodifiableCollection(assetsById);
}
public AbstractAsset getAssetBySymbol(String symbol){
return this.assetsBySymbol.get(symbol);
}
public Collection<AssetPair> getAssetPairsCollection() {
return Collections.unmodifiableCollection(assetPairs);