|
From: <jde...@us...> - 2010-06-30 11:25:17
|
Revision: 12388
http://pcgen.svn.sourceforge.net/pcgen/?rev=12388&view=rev
Author: jdempsey
Date: 2010-06-30 11:25:10 +0000 (Wed, 30 Jun 2010)
Log Message:
-----------
Fix bug: Template Editor: Errors in console on save
Issue#: CODE-145
Modified Paths:
--------------
branches/5.16.x/pcgen/code/src/java/pcgen/gui/editor/EditorMainForm.java
Modified: branches/5.16.x/pcgen/code/src/java/pcgen/gui/editor/EditorMainForm.java
===================================================================
--- branches/5.16.x/pcgen/code/src/java/pcgen/gui/editor/EditorMainForm.java 2010-06-30 11:24:22 UTC (rev 12387)
+++ branches/5.16.x/pcgen/code/src/java/pcgen/gui/editor/EditorMainForm.java 2010-06-30 11:25:10 UTC (rev 12388)
@@ -875,9 +875,12 @@
PCTemplate thisPCTemplate = (PCTemplate) thisPObject;
thisPCTemplate.removeListFor(ListKey.MOVEMENT);
- Movement cmv = Movement.getMovementFrom(pnlMovement.getMoveValues());
- cmv.setMoveRatesFlag(pnlMovement.getMoveRateType());
- thisPCTemplate.addToListFor(ListKey.MOVEMENT, cmv);
+ if (pnlMovement.getMoveValues().length() > 0)
+ {
+ Movement cmv = Movement.getMovementFrom(pnlMovement.getMoveValues());
+ cmv.setMoveRatesFlag(pnlMovement.getMoveRateType());
+ thisPCTemplate.addToListFor(ListKey.MOVEMENT, cmv);
+ }
thisPCTemplate.removeAllFromList(Vision.VISIONLIST);
List<Vision> tplVisionList = pnlVision.getVision();
@@ -917,32 +920,44 @@
// Save favoured classes
//
sel = pnlClasses.getSelectedList();
- aString = EditUtil.delimitArray(sel, '|');
- context.unconditionallyProcess(thisPCTemplate, "FAVOREDCLASS", aString);
+ if (sel.length > 0)
+ {
+ aString = EditUtil.delimitArray(sel, '|');
+ context.unconditionallyProcess(thisPCTemplate, "FAVOREDCLASS", aString);
+ }
//
// Save choice of auto languages
//
sel = pnlLanguages.getSelectedList2();
- aString = EditUtil.delimitArray(sel, '|');
- context.unconditionallyProcess(thisPCTemplate, "CHOOSE", "LANGAUTO|"
- + aString);
+ if (sel.length > 0)
+ {
+ aString = EditUtil.delimitArray(sel, '|');
+ context.unconditionallyProcess(thisPCTemplate, "CHOOSE", "LANGAUTO|"
+ + aString);
+ }
//
// Save feats
//
thisPCTemplate.removeListFor(ListKey.FEAT_TOKEN_LIST);
sel = pnlFeats.getSelectedList();
- aString = EditUtil.delimitArray(sel, '|');
- context.unconditionallyProcess(thisPCTemplate, "FEAT", aString);
+ if (sel.length > 0)
+ {
+ aString = EditUtil.delimitArray(sel, '|');
+ context.unconditionallyProcess(thisPCTemplate, "FEAT", aString);
+ }
//
// Save bonus languages
//
thisPCTemplate.removeAllFromList(Language.STARTING_LIST);
sel = pnlBonusLang.getSelectedList();
- aString = EditUtil.delimitArray(sel, ',');
- context.unconditionallyProcess(thisPCTemplate, "LANGBONUS", aString);
+ if (sel.length > 0)
+ {
+ aString = EditUtil.delimitArray(sel, ',');
+ context.unconditionallyProcess(thisPCTemplate, "LANGBONUS", aString);
+ }
//
// Save level and hit dice abilities
@@ -1030,8 +1045,11 @@
}
selList.append((String) sel[i]);
}
- context.unconditionallyProcess(thisPObject, "AUTO:WEAPONPROF",
- selList.toString());
+ if (selList.length() > 0)
+ {
+ context.unconditionallyProcess(thisPObject, "AUTO:WEAPONPROF",
+ selList.toString());
+ }
sel = pnlWeapons.getSelectedList2();
@@ -1041,7 +1059,7 @@
|| editType == EditorConstants.EDIT_RACE)
{
thisPObject.removeAllFromList(WeaponProf.STARTING_LIST);
- context.unconditionallyProcess(thisPObject, "LANGBONUS",
+ context.unconditionallyProcess(thisPObject, "WEAPONBONUS",
EditUtil.delimitArray(sel, ','));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|