[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/attrview OperationAttribute.java, 1.1, 1
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-09 09:45:32
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4494/src/net/sourceforge/bprocessor/gui/attrview Modified Files: OperationAttribute.java GenericPanel.java Log Message: checkpoint code cleanup Index: OperationAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/OperationAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OperationAttribute.java 19 Oct 2007 08:28:33 -0000 1.1 --- OperationAttribute.java 9 Nov 2007 09:45:29 -0000 1.2 *************** *** 22,25 **** --- 22,26 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Operation; + import net.sourceforge.bprocessor.model.Project; /** *************** *** 142,145 **** --- 143,148 ---- Operation operation = (Operation) attribute.getValue(); operation.perform(); + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } } Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** GenericPanel.java 19 Oct 2007 12:11:30 -0000 1.46 --- GenericPanel.java 9 Nov 2007 09:45:29 -0000 1.47 *************** *** 97,113 **** } private void handleString(Attribute attribute, JComponent where) { StringAttribute sa = new StringAttribute(attribute); ! sa.addStringAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); genAttributes.add(sa); where.add(new AttributeRow(sa)); --- 97,117 ---- } + private class GenericListener implements AttributeListener { + public void valueChanged(Attribute a) { + obj.setAttributes(attributes); + if (obj instanceof Entity) { + simpleUpdate = true; + ((Entity)obj).changed(); + } else if (obj instanceof Camera) { + Project.getInstance().changed((Camera)obj); + } + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); + } + } + private void handleString(Attribute attribute, JComponent where) { StringAttribute sa = new StringAttribute(attribute); ! sa.addStringAttributeListener(new GenericListener()); genAttributes.add(sa); where.add(new AttributeRow(sa)); *************** *** 131,145 **** private void handleDescription(Attribute attribute, JComponent where) { DescriptionAttribute da = new DescriptionAttribute(attribute); ! da.addDescriptionAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); genAttributes.add(da); where.add(new AttributeRow(da)); --- 135,139 ---- private void handleDescription(Attribute attribute, JComponent where) { DescriptionAttribute da = new DescriptionAttribute(attribute); ! da.addDescriptionAttributeListener(new GenericListener()); genAttributes.add(da); where.add(new AttributeRow(da)); *************** *** 148,162 **** private void handleMaterial(Attribute attribute, JComponent where) { MaterialAttribute ma = new MaterialAttribute(attribute); ! ma.addMaterialAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); genAttributes.add(ma); where.add(new AttributeRow(ma)); --- 142,146 ---- private void handleMaterial(Attribute attribute, JComponent where) { MaterialAttribute ma = new MaterialAttribute(attribute); ! ma.addMaterialAttributeListener(new GenericListener()); genAttributes.add(ma); where.add(new AttributeRow(ma)); *************** *** 165,179 **** private void handleBoolean(Attribute attribute, JComponent where) { BooleanAttribute ba = new BooleanAttribute(attribute); ! ba.addBooleanAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); genAttributes.add(ba); where.add(new AttributeRow(ba)); --- 149,153 ---- private void handleBoolean(Attribute attribute, JComponent where) { BooleanAttribute ba = new BooleanAttribute(attribute); ! ba.addBooleanAttributeListener(new GenericListener()); genAttributes.add(ba); where.add(new AttributeRow(ba)); *************** *** 184,198 **** private void handleClassification(Attribute attribute, JComponent where) { ClassificationTextAttribute catext = new ClassificationTextAttribute(attribute); ! catext.addClassificationAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); genAttributes.add(catext); where.add(new AttributeRow(catext)); --- 158,162 ---- private void handleClassification(Attribute attribute, JComponent where) { ClassificationTextAttribute catext = new ClassificationTextAttribute(attribute); ! catext.addClassificationAttributeListener(new GenericListener()); genAttributes.add(catext); where.add(new AttributeRow(catext)); *************** *** 212,215 **** --- 176,181 ---- Project.getInstance().changed((Camera)obj); } + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } } *************** *** 221,235 **** private void handleLink(Attribute attribute, JComponent where) { LinkAttribute la = new LinkAttribute(attribute); ! la.addStringAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } ! } ! }); genAttributes.add(la); where.add(new AttributeRow(la)); --- 187,191 ---- private void handleLink(Attribute attribute, JComponent where) { LinkAttribute la = new LinkAttribute(attribute); ! la.addStringAttributeListener(new GenericListener()); genAttributes.add(la); where.add(new AttributeRow(la)); |