[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/attrview AttributeView.java,1.30,1.31
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-02-02 10:55:31
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14891/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: Changed Attributes to Attribute and made the AttributeView show Parametric objects by the GenericPanel Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AttributeView.java 25 Jan 2006 14:50:10 -0000 1.30 --- AttributeView.java 2 Feb 2006 10:55:19 -0000 1.31 *************** *** 8,14 **** --- 8,16 ---- import net.sourceforge.bprocessor.gui.Defaults; + import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Observer; + import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 23,26 **** --- 25,30 ---- import java.awt.GridBagLayout; import java.awt.GridBagConstraints; + import java.util.Iterator; + import java.util.List; import javax.swing.BorderFactory; *************** *** 42,46 **** /** The attributes panel */ ! private AttributesPanel ap; /** --- 46,50 ---- /** The attributes panel */ ! private JPanel container; /** *************** *** 50,56 **** super(); ! ap = new AttributesPanel(); ! ! addTab("Attributes", ap); setMinimumSize(new Dimension(120, 240)); setPreferredSize(new Dimension(120, 240)); --- 54,60 ---- super(); ! container = new JPanel(); ! ! addTab("Attributes", container); setMinimumSize(new Dimension(120, 240)); setPreferredSize(new Dimension(120, 240)); *************** *** 65,81 **** Selection selection = Selection.primary(); if (object == selection) { ! if (selection.size() == 1) { ! ap.display(selection.iterator().next()); ! } else { ! ap.display(null); } } ! Object current = ap.getCurrent(); if (object == current) { ap.display(current); ! } repaint(); } ! /** * Attributes panel --- 69,124 ---- Selection selection = Selection.primary(); if (object == selection) { ! if (selection.size() > 0) { ! Object o = selection.iterator().next(); ! container.removeAll(); ! if (o instanceof Parametric) { ! log.info("Were Parametric" + o); ! container.add(new GenericPanel((Parametric)o)); ! } else { ! AttributesPanel ap = new AttributesPanel(); ! ap.display(o); ! container.add(ap); ! } } } ! /*Object current = ap.getCurrent(); if (object == current) { ap.display(current); ! }*/ repaint(); } ! ! /** ! * A generic panel for classes that implement the parametric interface ! */ ! class GenericPanel extends JPanel { ! /** The current object shown */ ! private Parametric obj; ! ! /** ! * The constructor ! * @param content The content ! */ ! public GenericPanel(Parametric content) { ! super(); ! obj = content; ! generateContent(content.getAttributes()); ! } ! ! /** ! * local method for generating the content ! * @param what The list of attrinutes ! */ ! private void generateContent(List what) { ! Iterator iter = what.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); ! if (a.getValue() instanceof String) { ! this.add(new JLabel((String)(a.getValue()))); ! } ! } ! } ! } ! /** * Attributes panel |