[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/attrview SelectorAttribute.java, NONE, 1
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nordholt <nor...@us...> - 2007-01-29 18:10:55
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3258/src/net/sourceforge/bprocessor/gui/attrview Modified Files: BooleanAttribute.java GenericPanel.java Added Files: SelectorAttribute.java Log Message: added a GUI attribute for the selectors Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** GenericPanel.java 6 Jan 2007 21:10:46 -0000 1.31 --- GenericPanel.java 29 Jan 2007 18:10:46 -0000 1.32 *************** *** 34,37 **** --- 34,38 ---- import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Selector; /** *************** *** 210,214 **** } }); ! genAttributes.add(catext);; where.add(new AttributeRow(catext)); if (a.getClassification() != null && --- 211,215 ---- } }); ! genAttributes.add(catext); where.add(new AttributeRow(catext)); if (a.getClassification() != null && *************** *** 231,234 **** --- 232,238 ---- where.add(new AttributeRow(caid)); } + } else if (a.getValue() instanceof Selector) { + Selector sel = (Selector)a.getValue(); + where.add(new AttributeRow(new SelectorAttribute(a))); } else { log.info("[GenericPanel] Something were not implemented"); Index: BooleanAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/BooleanAttribute.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BooleanAttribute.java 4 Nov 2006 16:54:53 -0000 1.2 --- BooleanAttribute.java 29 Jan 2007 18:10:46 -0000 1.3 *************** *** 29,32 **** --- 29,37 ---- implements ItemListener { + /** + * Default serial version UID + */ + private static final long serialVersionUID = 1L; + /** The listeners */ private List listeners; --- NEW FILE: SelectorAttribute.java --- //--------------------------------------------------------------------------------- // $Id: SelectorAttribute.java,v 1.1 2007/01/29 18:10:46 nordholt Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.List; import javax.swing.BoxLayout; import javax.swing.JComboBox; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Selector; /** * GUI attribute for the selector attributes * */ public class SelectorAttribute extends GenericAttribute { /** */ private static final long serialVersionUID = 1L; /** The attribute of this gui attribute */ private Attribute att; /** The selector of the attribute */ private Selector sel = null; /** * Constructor sets the selector attribute. * @param a the attribute */ public SelectorAttribute(Attribute a) { super(BoxLayout.X_AXIS); att = a; if (att.getValue() instanceof Selector) { sel = (Selector)att.getValue(); List options = sel.getOptions(); JComboBox cb = new JComboBox(); for (Object o : options) { cb.addItem(o); } cb.setSelectedItem(sel.getCurrentValue()); cb.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == e.SELECTED) { sel.setCurrentValue(e.getItem()); } } }); this.add(cb); } } /** * * @return the attribute of the gui attribute */ public Attribute attribute() { return att; } /** * Cancel editing */ public void cancelEditing() { } /** * start editing */ public void startEditing() { } /** * stop editing */ public void stopEditing() { } } |