From: <aki...@us...> - 2006-12-12 03:37:38
|
Revision: 1029 http://svn.sourceforge.net/gridarta/?rev=1029&view=rev Author: akirschbaum Date: 2006-12-10 10:40:10 -0800 (Sun, 10 Dec 2006) Log Message: ----------- Simplify expressions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-10 18:29:56 UTC (rev 1028) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-12-10 18:40:10 UTC (rev 1029) @@ -577,7 +577,7 @@ switch (dType) { case TEXT: { isText = true; // text section (need special embedding without additional scrollbars) - newAttr = new DialogAttrib<JTextArea>(type.getAttr()[i]); + newAttr = new DialogAttrib<JTextArea>(attrib); String text = ""; if (nameOld.equalsIgnoreCase("msg")) { if (archetype.getMsgText() != null && archetype.getMsgText().length() > 0 && (gameObject.getMsgText() == null || gameObject.getMsgText().trim().length() == 0)) { @@ -598,21 +598,21 @@ break; case BOOL: case BOOL_SPEC: { - newAttr = new DialogAttrib<JCheckBox>(type.getAttr()[i]); + newAttr = new DialogAttrib<JCheckBox>(attrib); final JCheckBox input; switch (dType) { case BOOL: // normal bool - input = new JCheckBox(type.getAttr()[i].getNameNew(), (gameObject.getAttributeInt(type.getAttr()[i].getNameOld()) == 1)); + input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeInt(nameOld) == 1); break; case BOOL_SPEC: { // parse values for customized bool - final String trueVal = type.getAttr()[i].getMisc()[0]; + final String trueVal = attrib.getMisc()[0]; if (trueVal.equals("0")) { - final String attrString = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); - input = new JCheckBox(type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); + final String attrString = gameObject.getAttributeString(nameOld); + input = new JCheckBox(attrib.getNameNew(), attrString.length() == 0 || attrString.equals("0")); } else { - input = new JCheckBox(type.getAttr()[i].getNameNew(), (gameObject.getAttributeString(type.getAttr()[i].getNameOld()).equals(trueVal))); + input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeString(nameOld).equals(trueVal)); } } break; @@ -628,10 +628,10 @@ case INT: case LONG: case FLOAT: { - cLabel = new JLabel(type.getAttr()[i].getNameNew() + ": "); + cLabel = new JLabel(attrib.getNameNew() + ": "); cLabel.setForeground(dType == ArchAttribType.FLOAT ? IGUIConstants.FLOAT_COLOR : IGUIConstants.INT_COLOR); - newAttr = new DialogAttrib<JFormattedTextField>(type.getAttr()[i]); - final int fieldLength = type.getAttr()[i].getInputLength() == 0 ? TEXTFIELD_COLUMNS : type.getAttr()[i].getInputLength(); + newAttr = new DialogAttrib<JFormattedTextField>(attrib); + final int fieldLength = attrib.getInputLength() == 0 ? TEXTFIELD_COLUMNS : attrib.getInputLength(); final NumberFormat format; switch (dType) { case INT: @@ -677,7 +677,7 @@ case FACENAME: case ANIMNAME: { final String dtxt; - if (type.getAttr()[i].getNameOld().equalsIgnoreCase("name")) { + if (nameOld.equalsIgnoreCase("name")) { if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { dtxt = gameObject.getObjName(); } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { @@ -685,20 +685,20 @@ } else { dtxt = archetype.getArchetypeName(); } - } else if (type.getAttr()[i].getNameOld().equalsIgnoreCase("face")) { + } else if (nameOld.equalsIgnoreCase("face")) { if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { dtxt = gameObject.getFaceName(); } else { dtxt = archetype.getFaceName(); } } else { - dtxt = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); + dtxt = gameObject.getAttributeString(nameOld); } final JTextField input = new JTextField(dtxt, TEXTFIELD_COLUMNS); switch (dType) { case STRING: - cLabel = new JLabel(type.getAttr()[i].getNameNew() + ": "); - newAttr = new DialogAttrib<JTextField>(type.getAttr()[i]); + cLabel = new JLabel(attrib.getNameNew() + ": "); + newAttr = new DialogAttrib<JTextField>(attrib); break; case FACENAME: case ANIMNAME: @@ -728,20 +728,20 @@ case SPELL: case ZSPELL: case LIST: { - cLabel = new JLabel(type.getAttr()[i].getNameNew() + ": "); + cLabel = new JLabel(attrib.getNameNew() + ": "); cLabel.setForeground(IGUIConstants.INT_COLOR); - newAttr = new DialogAttrib<JComboBox>(type.getAttr()[i]); + newAttr = new DialogAttrib<JComboBox>(attrib); // create ComboBox with parsed selection final JComboBox input; switch (dType) { case SPELL: case ZSPELL: - input = buildSpellBox(type.getAttr()[i]); + input = buildSpellBox(attrib); break; case LIST: - if (type.getAttr()[i].getMisc() != null && typelist.getListTable().containsKey(type.getAttr()[i].getMisc()[0])) { + if (attrib.getMisc() != null && typelist.getListTable().containsKey(attrib.getMisc()[0])) { // build the list from vector data - input = buildArrayBox(type.getAttr()[i], typelist.getListTable().get(type.getAttr()[i].getMisc()[0])); + input = buildArrayBox(attrib, typelist.getListTable().get(attrib.getMisc()[0])); } else { // error: list data is missing or corrupt cComp = new JLabel("Error: Undefined List"); @@ -792,12 +792,12 @@ } break; case BITMASK: { - newAttr = new BitmaskAttrib(type.getAttr()[i]); - if (type.getAttr()[i].getMisc() != null && typelist.getBitmaskTable().containsKey(type.getAttr()[i].getMisc()[0])) { + newAttr = new BitmaskAttrib(attrib); + if (attrib.getMisc() != null && typelist.getBitmaskTable().containsKey(attrib.getMisc()[0])) { // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (type.getAttr()[i].getMisc()[0])); + final CAttribBitmask bitmask = typelist.getBitmaskTable().get((String) (attrib.getMisc()[0])); ((BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr).bitmask = bitmask; - cLabel = new JButton(new MaskChangeAL(type.getAttr()[i].getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); + cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ':', (BitmaskAttrib) (DialogAttrib<JTextComponent>) newAttr)); final JTextArea input = new JTextArea(); input.setBackground(getBackground()); input.setEditable(false); @@ -812,9 +812,9 @@ } break; case TREASURE: { - newAttr = new DialogAttrib<JTextField>(type.getAttr()[i]); + newAttr = new DialogAttrib<JTextField>(attrib); // textfield (no direct input, text is set by the treasurelist dialog) - String treasureName = gameObject.getAttributeString(type.getAttr()[i].getNameOld()); + String treasureName = gameObject.getAttributeString(nameOld); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |