|
From: <cpm...@us...> - 2011-01-30 03:01:31
|
Revision: 14477
http://pcgen.svn.sourceforge.net/pcgen/?rev=14477&view=rev
Author: cpmeister
Date: 2011-01-30 03:01:20 +0000 (Sun, 30 Jan 2011)
Log Message:
-----------
equipset now updates quantity of items in tree
Modified Paths:
--------------
sandbox/cdomui/code/src/java/pcgen/core/facade/EquipmentSetFacade.java
sandbox/cdomui/code/src/java/pcgen/gui2/facade/EquipmentSetFacadeImpl.java
sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java
sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/UnequippedList.java
Modified: sandbox/cdomui/code/src/java/pcgen/core/facade/EquipmentSetFacade.java
===================================================================
--- sandbox/cdomui/code/src/java/pcgen/core/facade/EquipmentSetFacade.java 2011-01-29 18:16:37 UTC (rev 14476)
+++ sandbox/cdomui/code/src/java/pcgen/core/facade/EquipmentSetFacade.java 2011-01-30 03:01:20 UTC (rev 14477)
@@ -21,6 +21,8 @@
package pcgen.core.facade;
import java.util.Arrays;
+import java.util.EventListener;
+import java.util.EventObject;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.ObjectUtils;
import pcgen.core.facade.util.ListFacade;
@@ -70,18 +72,24 @@
public void removeEquipmentTreeListener(EquipmentTreeListener listener);
- public static interface EquipmentTreeListener
+ public static interface EquipmentTreeListener extends EventListener
{
public void quantityChanged(EquipmentTreeEvent e);
}
- public static class EquipmentTreeEvent
+ public static class EquipmentTreeEvent extends EventObject
{
private EquipPath path;
+ public EquipmentTreeEvent(Object source, EquipPath path)
+ {
+ super(source);
+ this.path = path;
+ }
+
public EquipPath getPath()
{
return path;
@@ -148,9 +156,9 @@
@Override
public String toString()
{
- if(path.length > 0)
+ if (path.length > 0)
{
- return path[path.length-1].toString();
+ return path[path.length - 1].toString();
}
return root.toString();
}
Modified: sandbox/cdomui/code/src/java/pcgen/gui2/facade/EquipmentSetFacadeImpl.java
===================================================================
--- sandbox/cdomui/code/src/java/pcgen/gui2/facade/EquipmentSetFacadeImpl.java 2011-01-29 18:16:37 UTC (rev 14476)
+++ sandbox/cdomui/code/src/java/pcgen/gui2/facade/EquipmentSetFacadeImpl.java 2011-01-30 03:01:20 UTC (rev 14477)
@@ -255,6 +255,7 @@
.getEquipSetByIdPath(((EquipPathImpl) existing)
.getIdPath());
es.setQty(es.getQty() + quantity);
+ fireQuantityChanged(existing);
return;
}
}
@@ -331,6 +332,7 @@
else
{
eSet.setQty((float) newQty);
+ fireQuantityChanged(path);
}
}
@@ -504,6 +506,19 @@
return getName();
}
+ private void fireQuantityChanged(EquipPath path)
+ {
+ EquipmentTreeEvent event = null;
+ for (EquipmentTreeListener equipmentTreeListener : listeners)
+ {
+ if (event == null)
+ {
+ event = new EquipmentTreeEvent(this, path);
+ }
+ equipmentTreeListener.quantityChanged(event);
+ }
+ }
+
/**
* The Class <code>EquipPathImpl</code> extends EquipPath to allow syncing
* of the path back to the character. The idPath is added which is the
Modified: sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java
===================================================================
--- sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java 2011-01-29 18:16:37 UTC (rev 14476)
+++ sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/EquipmentTreeTableModel.java 2011-01-30 03:01:20 UTC (rev 14477)
@@ -100,6 +100,7 @@
this.datacolumns = getDataColumns();
this.equipSet = equipSet;
this.character = character;
+ equipSet.addEquipmentTreeListener(this);
//equipSet.getPaths().addListListener(equipListener);
selectedView = this;
setDataModel(equipSet.getPaths());
@@ -131,7 +132,7 @@
{
dataMap.put(e.getPath(), getData(e.getPath()));
viewMap.clear();
- setSelectedTreeView(this);
+ this.nodeChanged(root);
}
public String getViewName()
Modified: sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/UnequippedList.java
===================================================================
--- sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/UnequippedList.java 2011-01-29 18:16:37 UTC (rev 14476)
+++ sandbox/cdomui/code/src/java/pcgen/gui2/tabs/equip/UnequippedList.java 2011-01-30 03:01:20 UTC (rev 14477)
@@ -1,3 +1,23 @@
+/*
+ * UnequippedList.java
+ * Copyright 2011 Connor Petty <cpm...@us...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Created on Jan 25, 2011, 3:26:08 PM
+ */
package pcgen.gui2.tabs.equip;
import java.util.ArrayList;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|