[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/attrview AttributeView.java,1.33,1.34 Gen
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-02-11 18:02:54
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2401/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java GenericAttribute.java StringAttribute.java GenericPanel.java Log Message: Made changes so that change calls reflects to the attribute view and so that changes to the attributeview call change on the affected objects Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StringAttribute.java 9 Feb 2006 13:55:12 -0000 1.3 --- StringAttribute.java 11 Feb 2006 18:02:40 -0000 1.4 *************** *** 19,23 **** import javax.swing.Box; import javax.swing.BoxLayout; - import javax.swing.DebugGraphics; import javax.swing.JComponent; import javax.swing.JLabel; --- 19,22 ---- *************** *** 189,198 **** if (attribute.isEditable()) { if (editor == null) { - Dimension d = component.getSize(); component.remove(0); editor = (JTextField) createValueEditor(attribute.getValue()); - editor.setMaximumSize(new Dimension((int)(d.getWidth()), - (int)d.getHeight())); - editor.setDebugGraphicsOptions(DebugGraphics.LOG_OPTION); editor.addKeyListener(this); component.add(editor); --- 188,193 ---- *************** *** 240,243 **** --- 235,247 ---- /** + * Update the content + */ + public void update() { + component.remove(0); + component.add(createValueLabel((String)attribute.getValue())); + component.revalidate(); + } + + /** * Respond to the enter key by stopping editing. * @param event The KeyEvent Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenericPanel.java 10 Feb 2006 14:59:03 -0000 1.4 --- GenericPanel.java 11 Feb 2006 18:02:40 -0000 1.5 *************** *** 8,11 **** --- 8,12 ---- import java.awt.BorderLayout; + import java.awt.Component; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; *************** *** 61,65 **** Box b = Box.createHorizontalBox(); JLabel label = new JLabel(" - " + ! param.getClass().getName().replaceFirst("net.sourceforge.bprocessor.model.", "") + " - "); label.setFont(AttributeView.FONT_HEADER); b.add(Box.createHorizontalGlue()); --- 62,66 ---- Box b = Box.createHorizontalBox(); JLabel label = new JLabel(" - " + ! param.getGeneralName() + " - "); label.setFont(AttributeView.FONT_HEADER); b.add(Box.createHorizontalGlue()); *************** *** 218,220 **** --- 219,242 ---- public void mouseExited(MouseEvent event) { } } + + /** + * Getter for the parametric + * @return the parametric + */ + public Parametric getParametric() { + return obj; + } + + /** + * Update the view + */ + public void update() { + Component[] c = content.getComponents(); + for (int i = 0; i < content.getComponentCount(); i++) { + if (c[i] instanceof GenericAttribute) { + ((GenericAttribute)c[i]).update(); + } + } + revalidate(); + } } Index: GenericAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenericAttribute.java 3 Feb 2006 15:23:00 -0000 1.1 --- GenericAttribute.java 11 Feb 2006 18:02:40 -0000 1.2 *************** *** 49,51 **** --- 49,56 ---- */ public abstract void cancelEditing(); + + /** + * Update the content + */ + public abstract void update(); } Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** AttributeView.java 9 Feb 2006 13:55:12 -0000 1.33 --- AttributeView.java 11 Feb 2006 18:02:40 -0000 1.34 *************** *** 13,16 **** --- 13,17 ---- import java.awt.BorderLayout; + import java.awt.Component; import java.awt.Dimension; import java.awt.Font; *************** *** 70,78 **** this.removeAll(); } } - /*Object current = ap.getCurrent(); - if (object == current) { - ap.display(current); - }*/ revalidate(); repaint(); --- 71,92 ---- this.removeAll(); } + } else { + if (this.getComponents().length > 0) { + Component jc = this.getComponent(0); + if (jc instanceof AttributePanel) { + AttributePanel ap = (AttributePanel)jc; + Object current = ap.getCurrent(); + if (object == current) { + ap.display(current); + } + } else if (jc instanceof GenericPanel) { + GenericPanel gp = (GenericPanel)jc; + Object current = gp.getParametric(); + if (current == object) { + gp.update(); + } + } + } } revalidate(); repaint(); |