[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/attrview AttributeView.java,1.34,1.35 Str
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-02-13 21:16:50
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28158/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java StringAttribute.java GenericPanel.java Log Message: LayoutManager added to attributeview OffsetConstraint implements Parametric Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StringAttribute.java 11 Feb 2006 18:02:40 -0000 1.4 --- StringAttribute.java 13 Feb 2006 21:16:39 -0000 1.5 *************** *** 60,66 **** header.add(Box.createHorizontalGlue()); header.add(label); ! column.add(Box.createHorizontalStrut(60)); column.add(header); ! column.add(Box.createHorizontalStrut(60)); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); --- 60,68 ---- header.add(Box.createHorizontalGlue()); header.add(label); ! //column.add(Box.createHorizontalStrut(60)); ! column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); ! column.add(Box.createRigidArea(new Dimension(70, 3))); ! //column.add(Box.createHorizontalStrut(60)); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); *************** *** 77,80 **** --- 79,92 ---- /** + * Round + * @param value The value + * @return The rounded value + */ + protected double round(double value) { + int i = (int) (value * 100000); + return ((double) i) / 100000.0; + } + + /** * Create a label for the * @param key The key *************** *** 142,150 **** s = (String)value; } else if (value instanceof Double) { ! s = ((Double)value).toString(); ! int index = s.indexOf('.'); ! if (index > 0) { ! s = s.substring(0, index + 4 > s.length() ? s.length() - 1 : index + 4); ! } } JLabel valueLabel = new JLabel(s); --- 154,159 ---- s = (String)value; } else if (value instanceof Double) { ! double rounded = round(((Double) value).doubleValue()); ! s = Double.toString(rounded); } JLabel valueLabel = new JLabel(s); *************** *** 167,171 **** s = (String)value; } else if (value instanceof Double) { ! s = ((Double) value).toString(); } JTextField valueEditor = new JTextField(s); --- 176,181 ---- s = (String)value; } else if (value instanceof Double) { ! double rounded = round(((Double) value).doubleValue()); ! s = Double.toString(rounded); } JTextField valueEditor = new JTextField(s); Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GenericPanel.java 11 Feb 2006 18:02:40 -0000 1.5 --- GenericPanel.java 13 Feb 2006 21:16:39 -0000 1.6 *************** *** 60,71 **** attributes = param.getAttributes(); generateContent(attributes, content); ! Box b = Box.createHorizontalBox(); JLabel label = new JLabel(" - " + param.getGeneralName() + " - "); label.setFont(AttributeView.FONT_HEADER); ! b.add(Box.createHorizontalGlue()); ! b.add(label); ! b.add(Box.createHorizontalGlue()); ! add(BorderLayout.NORTH, b); add(BorderLayout.CENTER, this.content); addMouseListener(this); --- 60,74 ---- attributes = param.getAttributes(); generateContent(attributes, content); ! Box title = Box.createVerticalBox(); ! Box header = Box.createHorizontalBox(); JLabel label = new JLabel(" - " + param.getGeneralName() + " - "); label.setFont(AttributeView.FONT_HEADER); ! header.add(Box.createHorizontalGlue()); ! header.add(label); ! header.add(Box.createHorizontalGlue()); ! title.add(header); ! title.add(Box.createVerticalStrut(7)); ! add(BorderLayout.NORTH, title); add(BorderLayout.CENTER, this.content); addMouseListener(this); Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** AttributeView.java 11 Feb 2006 18:02:40 -0000 1.34 --- AttributeView.java 13 Feb 2006 21:16:39 -0000 1.35 *************** *** 45,51 **** */ public AttributeView() { ! super(); ! setMinimumSize(new Dimension(120, 240)); ! setPreferredSize(new Dimension(120, 240)); Selection.primary().addObserver(this); Project.getInstance().addObserver(this); --- 45,51 ---- */ public AttributeView() { ! super(new BorderLayout()); ! setMinimumSize(new Dimension(140, 240)); ! setPreferredSize(new Dimension(140, 240)); Selection.primary().addObserver(this); Project.getInstance().addObserver(this); *************** *** 58,64 **** Selection selection = Selection.primary(); if (object == selection) { if (selection.size() == 1) { Object o = selection.iterator().next(); ! this.removeAll(); if (o instanceof Parametric) { this.add(BorderLayout.NORTH, new GenericPanel((Parametric)o)); --- 58,65 ---- Selection selection = Selection.primary(); if (object == selection) { + this.removeAll(); if (selection.size() == 1) { Object o = selection.iterator().next(); ! if (o instanceof Parametric) { this.add(BorderLayout.NORTH, new GenericPanel((Parametric)o)); *************** *** 66,73 **** AttributePanel ap = new AttributePanel(); ap.display(o); ! this.add(ap); } - } else { - this.removeAll(); } } else { --- 67,72 ---- AttributePanel ap = new AttributePanel(); ap.display(o); ! this.add(BorderLayout.CENTER, ap); } } } else { |