nextobjects-devel Mailing List for devaki-nextobjects (Page 2)
Status: Alpha
Brought to you by:
eflorent
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(41) |
Jun
(41) |
Jul
(8) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <efl...@us...> - 2003-06-08 09:57:06
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/workspace/models/objects In directory sc8-pr-cvs1:/tmp/cvs-serv4701/src/org/devaki/nextobjects/ui/workspace/models/objects Modified Files: AssociationLinkEdit.java Log Message: checkstyle Index: AssociationLinkEdit.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/workspace/models/objects/AssociationLinkEdit.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AssociationLinkEdit.java 8 Mar 2003 12:57:21 -0000 1.3 --- AssociationLinkEdit.java 8 Jun 2003 09:57:03 -0000 1.4 *************** *** 51,427 **** import org.devaki.nextobjects.workspace.models.graphics.LineView; public class AssociationLinkEdit extends JDialog { - /** Variables **/ - // Local reference of the edited object - private AssociationLink myAssociationLink; ! /** Components **/ [...976 lines suppressed...] ! } else if (this.jRadioButton11.isSelected()) ! { ! this.myAssociationLink.setCard(ConceptualModel._11_); ! } else if (this.jRadioButton0N.isSelected()) ! { ! this.myAssociationLink.setCard(ConceptualModel._0N_); ! } else if (this.jRadioButton1N.isSelected()) ! { ! this.myAssociationLink.setCard(ConceptualModel._1N_); ! } ! this.myAssociationLink.setNotes(this.jTextAreaNotes.getText()); ! this.myAssociationLink.setParentClass( ! (Association) this.jComboBoxParent.getSelectedItem()); ! this.myAssociationLink.setChildClass( ! (Entity) this.jComboBoxChild.getSelectedItem()); ! ((LineView) this.myAssociationLink.getObjectView()).computeBestPoints(); ! this.myAssociationLink.getMyModel().getPanel().repaint(); ! } } // End of class 'AssociationLinkEdit' |
From: <efl...@us...> - 2003-06-08 09:46:34
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/workspace/models/objects In directory sc8-pr-cvs1:/tmp/cvs-serv1772 Added Files: LabelEdit.java Log Message: Added Files: LabelEdit.java --- NEW FILE: LabelEdit.java --- /* nextobjects Copyright (C) 2001-2005 Laurent Thevenet,Emmanuel Florent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.devaki.nextobjects.ui.workspace.models.objects; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; import javax.swing.WindowConstants; import org.devaki.nextobjects.NextObjects; import org.devaki.nextobjects.ui.components.CustomButton; import org.devaki.nextobjects.ui.components.CustomTextArea; import org.devaki.nextobjects.ui.components.CustomTextField; import org.devaki.nextobjects.workspace.models.objects.Label; /** * Edit a note on the models * @author eflorent */ public class LabelEdit extends JDialog { /** * the label */ private Label myLabel; /** * the ok button */ private CustomButton jButtonOK = new CustomButton("OK", "", true, false); /** * the cancel button */ private CustomButton jButtonCancel = new CustomButton("Cancel", "", true, false); /** * the main jpanel */ private JPanel jPanelGeneral = new JPanel(new GridBagLayout()); /** * jlabel name */ private JLabel jLabelName = new JLabel("Name"); /** * jlabel description */ private JLabel jLabelDescription = new JLabel("Description"); /** * jtextfield name */ private CustomTextField jTextFieldName = new CustomTextField("", "Name of the association in the schema", true); /** * jtextarea description */ private CustomTextArea jTextAreaDescription = new CustomTextArea("", "Description of the association", true, true); /** * the tablbed pane */ private JTabbedPane jTabbedPane = new JTabbedPane(SwingConstants.TOP); /** * the unique panel */ private JPanel jPanelNotes = new JPanel(new GridBagLayout()); /** * Create a new 'LabelEdit' object */ public LabelEdit() { super(NextObjects.getReference()); this.jLabelDescription.setBorder(null); this.jLabelName.setBorder(null); /** Initialization **/ // Define the size of the window this.setSize(new Dimension(475, 500)); // Center the window this.setLocationRelativeTo(null); // Specify that the window is modal this.setModal(true); // Specify that the window is not resizable this.setResizable(false); // Define what to do when closing this window using the cross button this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); /** Components properties **/ // PANELS // Set a GridBagLayout for the content panel this.getContentPane().setLayout(new GridBagLayout()); // Create titled borders for some panels /** Listeners **/ // FOCUS this.jTextFieldName.addFocusListener(new FocusAdapter() { // Select the content of 'jTextFieldName' when it gained focus public void focusGained(FocusEvent e) { jTextFieldName.selectAll(); } }); this.jButtonOK.addActionListener(new ActionListener() { // When calling 'jButtonOK', save data and close the window public void actionPerformed(ActionEvent e) { closingWindow(true); } }); this.jButtonCancel.addActionListener(new ActionListener() { // When calling 'jButtonCancel', close the dialog without saving public void actionPerformed(ActionEvent e) { closingWindow(false); } }); // 'jPanelNotes' this.jPanelNotes.add( this.jLabelName, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); this.jPanelNotes.add( this.jTextFieldName, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); // 'jPanelNotes' this.jPanelNotes.add( new JScrollPane(this.jTextAreaDescription), new GridBagConstraints( 0, 1, 2, 2, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); this.jTabbedPane.add(this.jPanelNotes, "Notes"); // Content Panel this.getContentPane().add( this.jTabbedPane, new GridBagConstraints( 0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); this.getContentPane().add( this.jButtonOK, new GridBagConstraints( 0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); this.getContentPane().add( this.jButtonCancel, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); } // End of 'AssociationEdit()' /** * What to do before closing the window * @param isOK can save */ private void closingWindow(boolean isOK) { // Save data if this method follows an action on 'jButtonOK' if (isOK) { this.saveData(); } // Dispose window (unallocate resources) - show() must be call to set the // window visible again this.dispose(); } /** * Enable or disable the 'OK' button depending on the length of * 'jTextFieldName' and 'jTextFieldCode' */ private void enablingOKButton() { if ((this.jTextFieldName.getText().length() != 0) && (this.jTextAreaDescription.getText().length() != 0)) { // Both text fields length are different from zero, so enable 'jButtonOK' this.jButtonOK.setEnabled(true); } // One or both text fields length are equal to zero, so diable 'jButtonOK' else { this.jButtonOK.setEnabled(false); } } /** * Initialize window components with the data of the object given as * parameter of the constructor * @param pLabel the context label */ public void setData(Label pLabel) { // Define title of the window this.setTitle( new StringBuffer() .append("Properties of '") .append(pLabel.getName()) .append("' - devaki-nextobjects") .toString()); // Initialize the local reference of the edited object this.myLabel = pLabel; this.jTextFieldName.setText(pLabel.getName()); this.jTextAreaDescription.setText(pLabel.getDescription()); // Set 'General', the active tab when opening the dialog box this.jTabbedPane.setSelectedIndex(0); // Set 'jButtonOK' as the default button this.getRootPane().setDefaultButton(this.jButtonOK); // Make the window visible this.show(); } /** * Save the informations into the edited object */ private void saveData() { this.myLabel.setName(this.jTextFieldName.getText()); this.myLabel.setDescription(this.jTextAreaDescription.getText()); } } |
From: <efl...@us...> - 2003-06-08 09:45:20
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/workspace/models/objects In directory sc8-pr-cvs1:/tmp/cvs-serv1417/src/org/devaki/nextobjects/ui/workspace/models/objects Modified Files: AssociationEdit.java Log Message: checkstyle Index: AssociationEdit.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/workspace/models/objects/AssociationEdit.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AssociationEdit.java 5 Apr 2003 10:34:23 -0000 1.6 --- AssociationEdit.java 8 Jun 2003 09:45:16 -0000 1.7 *************** *** 21,26 **** package org.devaki.nextobjects.ui.workspace.models.objects; - - import java.awt.Dimension; import java.awt.GridBagConstraints; --- 21,24 ---- *************** *** 51,631 **** import org.devaki.nextobjects.workspace.models.objects.Association; [...1547 lines suppressed...] ! this.myAssociation.setDescription(this.jTextAreaDescription.getText()); ! this.myAssociation.setData(this.dataDict.model.getData()); ! this.myAssociation.setNotes(this.jTextAreaNotes.getText()); ! this.myAssociation.setSkipSql(!this.jCheckBoxGenerateSQL.isSelected()); ! this.myAssociation.setIdMethod( ! this.jComboBoxIdMethod.getSelectedItem().toString()); ! this.myAssociation.setHeavyIndexing( ! this.jCheckBoxHeavyIndexing.isSelected()); ! this.myAssociation.setJavaName(this.jTextFieldJavaName.getText()); ! this.myAssociation.setAbstractClass( ! this.jCheckBoxAbstract.isSelected()); ! this.myAssociation.setBaseClass(this.jTextFieldBaseClass.getText()); ! this.myAssociation.setBasePeer(this.jTextFieldBasePeer.getText()); ! this.myAssociation.setJavaNamingMethod( ! this.jComboBoxJavaNamingMethod.getSelectedItem().toString()); ! // Reload the columns in the tree ! NOTreeView.reloadBaseClassChildrens( ! this.myAssociation.getDynamicTreeNode()); ! } } |
From: <efl...@us...> - 2003-06-08 09:31:02
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv29347/src/org/devaki/nextobjects/workspace/models/graphics Added Files: ModelTitleView.java Log Message: Added ability to have labels, model titles ... --- NEW FILE: ModelTitleView.java --- /* nextobjects Copyright (C) 2001-2005 Emmanuel Florent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.devaki.nextobjects.workspace.models.graphics; import java.awt.Graphics; import java.awt.Point; import java.awt.Font; import javax.swing.UIManager; import org.devaki.nextobjects.constants.CstGraphics; import org.devaki.nextobjects.workspace.models.objects.ModelTitle; /** * This class is responsible for drawing a "cartouche" * around the graphic. * * @author eflorent *@todo add date to model * */ public class ModelTitleView extends ClassView { /** * Constructor * @param pLabel a dummy label who give a context */ public ModelTitleView(ModelTitle pObject) { super(pObject); Point p = new Point(5010, 2510); this.setLocation(p); this.setSize(CstGraphics.DEFAULT_MODELTITLE_SIZE); oldRectangle.setSize(rectangle.getSize()); oldRectangle.setLocation(rectangle.getLocation()); } /** * Paint the "cartouche" * @param g the graphic context */ public void paint(Graphics g) { /* * final : * ________ * I_________| * I____|__ __| * * 1/_______ * I | * I________| */ g.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); g.fillRect(0, 0, this.getSize().width , this.getSize().height); g.setColor(CstGraphics.DEFAULT_MODELTITLE_COLOR); g.drawRect(0, 0, this.getSize().width -1 , this.getSize().height -1); /* * 2/_ _ _ _ _ * I____. | * I____|_ _ _| * */ g.drawRect( 0, (this.getMiddlePoint().y - this.getLocation().y), this.getSize().width / 2, this.getSize().height / 2); /* * 3/ _ _ _ * I . ____| * I_ _ |__ __| * */ g.drawRect( (this.getMiddlePoint().x - this.getLocation().x) , (this.getMiddlePoint().y - this.getLocation().y) , this.getSize().width / 2, this.getSize().height / 2); printText(g); } /** * Draw the texts * @param g the graphic context */ public void printText(Graphics g) { this.metriques = g.getFontMetrics(g.getFont()); g.setFont( new Font( ((Font) UIManager.get("Label.font")).getName(), Font.PLAIN, ((Font) UIManager.get("Label.font")).getSize())); g.drawString(this.myObject.getMyModel().getName(), 4, 15); //g.drawString(myModel.getProjectURL(),4,15 + this.getSize().height / 2); g.drawString( this.myObject.getMyModel().getAuthor(), 4 + this.getSize().width / 2, 15 + this.getSize().height / 2); } } |
From: <efl...@us...> - 2003-06-08 09:28:31
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/workspace/models/graphics Modified Files: AssociationView.java BaseModelView.java ClassView.java ConceptualView.java EntityView.java ObjectView.java PhysicalView.java TableView.java Added Files: LabelView.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle --- NEW FILE: LabelView.java --- /* nextobjects Copyright (C) 2001-2005 Emmanuel Florent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.devaki.nextobjects.workspace.models.graphics; import java.awt.Graphics; import java.awt.Font; import java.awt.Dimension; import java.util.StringTokenizer; import java.awt.FontMetrics; import java.awt.Color; import javax.swing.UIManager; import org.devaki.nextobjects.constants.CstGraphics; import org.devaki.nextobjects.workspace.models.objects.BaseObject; /** * The labels view are like postits * @author eflorent */ public class LabelView extends ClassView { /** * construct a LabelView * @param pObject the base label */ public LabelView(BaseObject pObject) { super(pObject); this.setSize(CstGraphics.DEFAULT_LABEL_SIZE); oldRectangle.setSize(this.getSize()); oldRectangle.setLocation(this.getLocation()); } /** * Paint the "cartouche" * @param g the graphic context */ public void paint(Graphics g) { /* * final : * ___ * /| | * I____| * */ g.setColor(Color.YELLOW); g.fillRect(0, 0, this.getSize().width, this.getSize().height); // g.setColor(CstGraphics.DEFAULT_LABEL_COLOR); g.setColor(Color.BLACK); g.drawRect(0, 0, this.getSize().width - 1, this.getSize().height - 1); g.drawRect(0, 0, 15, 15); g.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); g.fillRect(0, 0, 15, 15); g.setColor(Color.BLACK); g.drawLine(0, 15, 15, 0); printText(g); } /** * Draw the texts * @param g the graphic context */ public void printText(Graphics g) { g.setColor(Color.BLACK); this.metriques = g.getFontMetrics(g.getFont()); g.setFont( new Font( ((Font) UIManager.get("Label.font")).getName(), Font.BOLD, ((Font) UIManager.get("Label.font")).getSize())); int line = 1; int linewidth = 0; int margin = 5; //add an empty space for postit(c) corner. StringBuffer sb = new StringBuffer(" "); FontMetrics fm = g.getFontMetrics(); StringTokenizer st = new StringTokenizer(myObject.getName()); while (st.hasMoreTokens()) { String nextword = st.nextToken(); if (fm.stringWidth(sb.toString() + nextword) + margin < this.getSize().width) { sb.append(nextword); sb.append(' '); } else if (sb.length() == 0) { g.drawString(nextword, margin, line * fm.getHeight()); line++; } else { g.drawString(sb.toString(), margin, line * fm.getHeight()); sb = new StringBuffer(nextword + " "); line++; } } if (sb.length() > 0) { g.drawString(sb.toString(), margin, line * fm.getHeight()); line++; } sb.delete(0, sb.length()); st = new StringTokenizer(myObject.getDescription()); g.setFont( new Font( ((Font) UIManager.get("Label.font")).getName(), Font.PLAIN, ((Font) UIManager.get("Label.font")).getSize())); while (st.hasMoreTokens()) { String nextword = st.nextToken(); if (fm.stringWidth(sb.toString() + nextword) + margin < this.getSize().width) { sb.append(nextword); sb.append(' '); } else if (sb.length() == 0) { g.drawString(nextword, margin, line * fm.getHeight()); line++; } else { g.drawString(sb.toString(), margin, line * fm.getHeight()); sb = new StringBuffer(nextword + " "); line++; } } if (sb.length() > 0) { g.drawString(sb.toString(), margin, line * fm.getHeight()); line++; } } public Dimension autoResize(boolean actIt) { //TODO implement label autoresize. return new Dimension(0, 0); } } Index: AssociationView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/AssociationView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AssociationView.java 31 May 2003 11:48:34 -0000 1.4 --- AssociationView.java 8 Jun 2003 09:28:26 -0000 1.5 *************** *** 85,89 **** 15, 15); ! this.printText(g2,0,0); } --- 85,89 ---- 15, 15); ! this.printColumns(g2,0,0); } Index: BaseModelView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/BaseModelView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BaseModelView.java 4 Jun 2003 19:29:42 -0000 1.1 --- BaseModelView.java 8 Jun 2003 09:28:26 -0000 1.2 *************** *** 1,3 **** ! /* nextobjects Copyright (C) 2001-2005 Emmanuel Florent --- 1,3 ---- ! /* nextobjects Copyright (C) 2001-2005 Emmanuel Florent *************** *** 19,52 **** */ package org.devaki.nextobjects.workspace.models.graphics; import java.io.Serializable; import java.awt.BorderLayout; - import java.awt.Dimension; - import java.awt.Graphics; import java.awt.Graphics2D; - import java.awt.Point; - import java.awt.Rectangle; import java.awt.image.BufferedImage; - import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import javax.swing.JPanel; import javax.swing.JScrollPane; - import org.devaki.nextobjects.constants.CstGraphics; - import org.devaki.nextobjects.util.ModelMan; - - import org.devaki.nextobjects.workspace.models.BaseModel; import org.devaki.nextobjects.workspace.models.objects.BaseObject; import org.devaki.nextobjects.workspace.models.objects.BaseClass; import java.awt.Image; public abstract class BaseModelView extends JPanel implements Serializable { /** --- 19,55 ---- */ package org.devaki.nextobjects.workspace.models.graphics; + import java.io.Serializable; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.devaki.nextobjects.constants.CstGraphics; import org.devaki.nextobjects.util.ModelMan; import org.devaki.nextobjects.workspace.models.BaseModel; import org.devaki.nextobjects.workspace.models.objects.BaseObject; import org.devaki.nextobjects.workspace.models.objects.BaseClass; + import org.devaki.nextobjects.workspace.models.objects.ModelTitle; + import java.awt.Image; + /** + * The base for all models + * @author efl...@de... + * + */ public abstract class BaseModelView extends JPanel implements Serializable { + /** + * The "cartouche" + */ + private ModelTitleView modelTitleView; /** *************** *** 110,118 **** transient protected BufferedImage bi = null; ! public BaseModelView(BaseModel pMerise) { /** Initialization **/ ! super(true); // is double buffered! ! myModel = pMerise; this.setVisible(true); --- 113,131 ---- transient protected BufferedImage bi = null; ! /** ! * constructor ! * @param pModel the model ! */ ! public BaseModelView(BaseModel pModel) { /** Initialization **/ ! super(false); // is double buffered! ! myModel = pModel; ! ! ModelTitle modelTitle = new ModelTitle(myModel); ! modelTitle.getObjectView().setLocation(CstGraphics.MODEL_INITIAL_POSITION); ! modelTitle.getObjectView().setSize(CstGraphics.DEFAULT_MODELTITLE_SIZE); ! pModel.getLabels().addElement(modelTitle.getObjectView()); ! this.setVisible(true); *************** *** 138,142 **** Graphics2D bi2g; ! BaseObject[] tmp = getMyModel().getModelObjects(); Rectangle rect; --- 151,155 ---- Graphics2D bi2g; ! ObjectView[] tmp = getVisibleObjectView(); Rectangle rect; *************** *** 157,166 **** { // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getObjectView().getSize(); ! Point l = tmp[k].getObjectView().getLocation(); ! if (tmp[k].getObjectView() instanceof LineView) { ! tmp[k].getObjectView().paint(big); } else { // classview ?! --- 170,179 ---- { // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getSize(); ! Point l = tmp[k].getLocation(); ! if (tmp[k] instanceof LineView) { ! tmp[k].paint(big); } else { // classview ?! *************** *** 172,176 **** d.height); bi2g = bi2.createGraphics(); ! tmp[k].getObjectView().paint(bi2g); big.drawImage( bi2, --- 185,189 ---- d.height); bi2g = bi2.createGraphics(); ! tmp[k].paint(bi2g); big.drawImage( bi2, *************** *** 180,184 **** --- 193,212 ---- } } + } + /* + bi2 = + (BufferedImage) drawingArea.createImage( + modelTitleView.getSize().width, + modelTitleView.getSize().height); + bi2g = bi2.createGraphics(); + modelTitleView.paint(bi2g); + + big.drawImage( + bi2, + modelTitleView.getLocation().x - getRectangle().x, + modelTitleView.getLocation().y - getRectangle().y, + this); + */ return bi; } *************** *** 279,283 **** --- 307,319 ---- CstGraphics.MODEL_INITIAL_POSITION); } + + + /** + * get the visible objects + * @return the object views + */ + public abstract ObjectView[] getVisibleObjectView(); + /** * Return a cached rectangle/bounds for the model *************** *** 338,341 **** --- 374,395 ---- ymax = ytmpmax; } + for (int i = 0; i < myModel.getLabels().size(); i++) + { + ObjectView baseObject = + (ObjectView) myModel.getLabels().elementAt(i); + xtmpmin = (int) baseObject.getLocation().getX(); + ytmpmin = (int) baseObject.getLocation().getY(); + + xtmpmax = baseObject.getLocation().x + baseObject.getSize().width; + ytmpmax = baseObject.getLocation().y + baseObject.getSize().height; + if (xtmpmin < xmin) + xmin = xtmpmin; + if (ytmpmin < ymin) + ymin = ytmpmin; + if (xtmpmax > xmax) + xmax = xtmpmax; + if (ytmpmax > ymax) + ymax = ytmpmax; + } rectangle = new Rectangle( *************** *** 348,352 **** /** ! * @return */ public BaseModel getMyModel() --- 402,407 ---- /** ! * get the model ! * @return the model */ public BaseModel getMyModel() *************** *** 356,360 **** /** ! * @param model */ public void setMyModel(BaseModel model) --- 411,416 ---- /** ! * set the model ! * @param model the model */ public void setMyModel(BaseModel model) *************** *** 371,375 **** jScrollPane.getViewport().setViewSize(d); } ! /** * return the view size --- 427,431 ---- jScrollPane.getViewport().setViewSize(d); } ! /** * return the view size *************** *** 389,393 **** fullRefresh = b; } ! /** * Location of the view position --- 445,449 ---- fullRefresh = b; } ! /** * Location of the view position *************** *** 398,400 **** --- 454,465 ---- return jScrollPane.getViewport().getViewPosition(); } + /** + * get the model title view + * @return the model "cartouche" + */ + public ModelTitleView getModelTitleView() + { + return modelTitleView; + } + } Index: ClassView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ClassView.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ClassView.java 2 Jun 2003 20:03:46 -0000 1.10 --- ClassView.java 8 Jun 2003 09:28:26 -0000 1.11 *************** *** 67,71 **** selectionPoints[i] = new SelectionPoint(0, 0); } ! } --- 67,82 ---- selectionPoints[i] = new SelectionPoint(0, 0); } ! } ! /** ! * Construct a new <code>ObjectView</code> object ! */ ! public ClassView() ! { ! super(); ! selectionPoints = new SelectionPoint[8]; ! for (int i = 0; i < 8; i++) ! { ! selectionPoints[i] = new SelectionPoint(0, 0); ! } } *************** *** 109,116 **** return this.oldRectangle; } ! /** ! * get the location ! * @return the location ! */ public Point getLocation() { --- 120,127 ---- return this.oldRectangle; } ! /** ! * get the location ! * @return the location ! */ public Point getLocation() { *************** *** 128,135 **** resetSelectionPoint(); } ! /** ! * get the size ! * @return the dimension ! */ public Dimension getSize() { --- 139,147 ---- resetSelectionPoint(); } ! ! /** ! * get the size ! * @return the dimension ! */ public Dimension getSize() { *************** *** 258,265 **** * Paint the text common in all ClassViews * @param g2 the graphics g ! * @param x offset X ! * @param y offset y */ ! public void printText(Graphics2D g2, int x, int y) { this.metriques = g2.getFontMetrics(g2.getFont()); --- 270,277 ---- * Paint the text common in all ClassViews * @param g2 the graphics g ! * @param x optional offset X ! * @param y optional offset y */ ! public void printColumns(Graphics2D g2, int x, int y) { this.metriques = g2.getFontMetrics(g2.getFont()); Index: ConceptualView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConceptualView.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ConceptualView.java 4 Jun 2003 19:29:42 -0000 1.22 --- ConceptualView.java 8 Jun 2003 09:28:27 -0000 1.23 *************** *** 23,27 **** import java.awt.Cursor; import java.awt.Dimension; ! import java.awt.Graphics2D; import java.awt.Color; import java.awt.Point; --- 23,27 ---- import java.awt.Cursor; import java.awt.Dimension; ! import java.awt.Graphics2D; import java.awt.Color; import java.awt.Point; *************** *** 46,50 **** import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; - /** * This class is responsible for drawing a ConceptualModel</code> --- 46,49 ---- *************** *** 53,57 **** public class ConceptualView extends BaseModelView implements Serializable { ! /** * Construct a new <code>ConceptualView</code> object --- 52,56 ---- public class ConceptualView extends BaseModelView implements Serializable { ! /** * Construct a new <code>ConceptualView</code> object *************** *** 61,64 **** --- 60,64 ---- { super(pMerise); + /* Listeners **/ // Mouse Listeners *************** *** 67,70 **** --- 67,132 ---- } + /** + * calculate the visible objects + * @return object views + */ + public ObjectView[] getVisibleObjectView() + { + ObjectView[] b = + new ObjectView[((ConceptualModel) myModel) + .getInheritanceLinks() + .size() + + ((ConceptualModel) myModel).getAssociationLinks().size() + + ((ConceptualModel) myModel).getEntities().size() + + ((ConceptualModel) myModel).getAssociations().size() + + ((ConceptualModel) myModel).getLabels().size()]; + int offset = 0; + for (int i = 0; + i < ((ConceptualModel) myModel).getAssociationLinks().size(); + i++) + { + b[offset] = + ((ConceptualModel) myModel) + .getAssociationLinkAt(i) + .getObjectView(); + offset++; + } + for (int i = 0; + i < ((ConceptualModel) myModel).getInheritanceLinks().size(); + i++) + { + b[offset] = + ((ConceptualModel) myModel) + .getInheritanceLinkAt(i) + .getObjectView(); + offset++; + } + for (int i = 0; + i < ((ConceptualModel) myModel).getAssociations().size(); + i++) + { + b[offset] = + ((ConceptualModel) myModel).getAssociationAt(i).getObjectView(); + offset++; + } + for (int i = 0; + i < ((ConceptualModel) myModel).getEntities().size(); + i++) + { + b[offset] = + ((ConceptualModel) myModel).getEntityAt(i).getObjectView(); + offset++; + } + for (int i = 0; + i < ((ConceptualModel) myModel).getLabels().size(); + i++) + { + b[offset] = + (ObjectView) ((ConceptualModel) myModel).getLabels().elementAt(i); + + offset++; + } + return b; + } /** *************** *** 100,104 **** // Add the new association to the model Association newAssociation = ! ModelMan.addAssociation((ConceptualModel)this.myModel, tmpPoint); // Add links between the new association and the entities --- 162,168 ---- // Add the new association to the model Association newAssociation = ! ModelMan.addAssociation( ! (ConceptualModel) this.myModel, ! tmpPoint); // Add links between the new association and the entities *************** *** 187,204 **** && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! BaseObject[] tmp = myModel.getModelObjects(); ! // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) { ! if (((Polygon) tmp[j].getObjectView().getSurface()) ! .contains(x1, y1)) { // Define the cuurent objects association link as the current object if (e.isControlDown()) { ! ModelMan.addCurrentObject(tmp[j]); } else { ! ModelMan.setCurrentObject(tmp[j]); } // only for association & entity ... --- 251,267 ---- && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! ObjectView[] tmp = getVisibleObjectView(); ! // Loop for visible objects for (int j = 0; j < tmp.length; j++) { ! if (((Polygon) tmp[j].getSurface()).contains(x1, y1)) { // Define the cuurent objects association link as the current object if (e.isControlDown()) { ! ModelMan.addCurrentObject(tmp[j].myObject); } else { ! ModelMan.setCurrentObject(tmp[j].myObject); } // only for association & entity ... *************** *** 240,244 **** case NOToolBar2.TOOL_TABLE : { ! ModelMan.addEntity((ConceptualModel)myModel, e.getPoint()); //record old location ModelMan.moveCurrentObject(0, 0); --- 303,317 ---- case NOToolBar2.TOOL_TABLE : { ! ModelMan.addEntity( ! (ConceptualModel) myModel, ! e.getPoint()); ! //record old location ! ModelMan.moveCurrentObject(0, 0); ! break; ! } ! // TOOL_TABLE selected ! case NOToolBar2.TOOL_LABEL : ! { ! ModelMan.addLabel(myModel, e.getPoint()); //record old location ModelMan.moveCurrentObject(0, 0); *************** *** 248,252 **** case NOToolBar2.TOOL_ASSOCIATION : { ! ModelMan.addAssociation((ConceptualModel)myModel, e.getPoint()); break; } --- 321,327 ---- case NOToolBar2.TOOL_ASSOCIATION : { ! ModelMan.addAssociation( ! (ConceptualModel) myModel, ! e.getPoint()); break; } *************** *** 589,595 **** // Loop for the entities to find the targeted object ! for (int i = 0; i < ((ConceptualModel)myModel).countEntities(); i++) { ! if (((Polygon) ((ConceptualModel)myModel) .getEntityAt(i) .getObjectView() --- 664,672 ---- // Loop for the entities to find the targeted object ! for (int i = 0; ! i < ((ConceptualModel) myModel).countEntities(); ! i++) { ! if (((Polygon) ((ConceptualModel) myModel) .getEntityAt(i) .getObjectView() *************** *** 608,615 **** .getDraggedObject() .equals( ! (BaseObject)((ConceptualModel) myModel).getEntityAt(i))) { ModelMan.setDropTargetObject( ! (BaseObject) ((ConceptualModel)myModel).getEntityAt(i)); targetNotFound = false; break; --- 685,702 ---- .getDraggedObject() .equals( ! (BaseObject) ! ( ! ( ! ConceptualModel) myModel) ! .getEntityAt( ! i))) { ModelMan.setDropTargetObject( ! (BaseObject) ! ( ! ( ! ConceptualModel) myModel) ! .getEntityAt( ! i)); targetNotFound = false; break; *************** *** 622,636 **** { for (int i = 0; ! i < (((ConceptualModel))myModel).countAssociation(); i++) { ! if (((ConceptualModel)myModel) .getAssociationAt(i) .getObjectView() .getSurface() .contains( ! x2+ e.getComponent().getX() + getViewPosition().x, ! y2+e.getComponent().getY()+getViewPosition().y)) { // Verify that the targeted object is not equal to the dragged --- 709,728 ---- { for (int i = 0; ! i ! < ((ConceptualModel) myModel) ! .countAssociation(); i++) { ! if (((ConceptualModel) myModel) .getAssociationAt(i) .getObjectView() .getSurface() .contains( ! x2 ! + e.getComponent().getX() + getViewPosition().x, ! y2 ! + e.getComponent().getY() ! + getViewPosition().y)) { // Verify that the targeted object is not equal to the dragged *************** *** 639,650 **** .getDraggedObject() .equals( ! ( ! BaseObject) ((ConceptualModel) myModel) ! .getAssociationAt( i))) { ModelMan.setDropTargetObject( ! (BaseObject) ((ConceptualModel)myModel) ! .getAssociationAt( i)); break; --- 731,747 ---- .getDraggedObject() .equals( ! (BaseObject) ! ( ! ( ! ConceptualModel) myModel) ! .getAssociationAt( i))) { ModelMan.setDropTargetObject( ! (BaseObject) ! ( ! ( ! ConceptualModel) myModel) ! .getAssociationAt( i)); break; Index: EntityView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/EntityView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EntityView.java 31 May 2003 11:48:34 -0000 1.3 --- EntityView.java 8 Jun 2003 09:28:27 -0000 1.4 *************** *** 72,76 **** (int)rect.getSize().getHeight()-1); /** Name **/ ! this.printText(g2,0,0); } --- 72,76 ---- (int)rect.getSize().getHeight()-1); /** Name **/ ! this.printColumns(g2,0,0); } Index: ObjectView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ObjectView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ObjectView.java 31 May 2003 11:48:34 -0000 1.4 --- ObjectView.java 8 Jun 2003 09:28:27 -0000 1.5 *************** *** 51,55 **** this.myObject = pObject; } ! /** * Paint object --- 51,62 ---- this.myObject = pObject; } ! ! /** ! * Construct a new 'ObjectView' object ! */ ! public ObjectView() ! { ! this.myObject =null; ! } /** * Paint object *************** *** 104,112 **** * @return the location */ ! public Point getLocation() ! { ! return new Point(0, 0); ! } ! /** * Define the dimension --- 111,116 ---- * @return the location */ ! public abstract Point getLocation() ; ! /** * Define the dimension Index: PhysicalView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/PhysicalView.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PhysicalView.java 4 Jun 2003 19:29:42 -0000 1.21 --- PhysicalView.java 8 Jun 2003 09:28:27 -0000 1.22 *************** *** 98,102 **** Graphics2D bi2g; ! BaseObject[] tmp = myModel.getModelObjects(); Rectangle rect; --- 98,102 ---- Graphics2D bi2g; ! ObjectView[] tmp = getVisibleObjectView(); Rectangle rect; *************** *** 115,124 **** { // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getObjectView().getSize(); ! Point l = tmp[k].getObjectView().getLocation(); ! if (tmp[k].getObjectView() instanceof LineView) { ! tmp[k].getObjectView().paint(big); } else { // classview ?! --- 115,124 ---- { // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getSize(); ! Point l = tmp[k].getLocation(); ! if (tmp[k] instanceof LineView) { ! tmp[k].paint(big); } else { // classview ?! *************** *** 127,131 **** bi2 =(BufferedImage)drawingArea.createImage(d.width,d.height); bi2g = bi2.createGraphics(); ! tmp[k].getObjectView().paint(bi2g); big.drawImage( bi2, --- 127,131 ---- bi2 =(BufferedImage)drawingArea.createImage(d.width,d.height); bi2g = bi2.createGraphics(); ! tmp[k].paint(bi2g); big.drawImage( bi2, *************** *** 379,387 **** && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! BaseObject[] tmp = myModel.getModelObjects(); // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) { ! if (((Polygon) tmp[j].getObjectView().getSurface()) .contains(x1, y1)) { --- 379,387 ---- && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! ObjectView[] tmp = getVisibleObjectView(); // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) { ! if (((Polygon) tmp[j].getSurface()) .contains(x1, y1)) { *************** *** 389,396 **** if (e.isControlDown()) { ! ModelMan.addCurrentObject(tmp[j]); } else { ! ModelMan.setCurrentObject(tmp[j]); } --- 389,396 ---- if (e.isControlDown()) { ! ModelMan.addCurrentObject(tmp[j].myObject); } else { ! ModelMan.setCurrentObject(tmp[j].myObject); } *************** *** 441,444 **** --- 441,449 ---- break; } + case NOToolBar2.TOOL_LABEL : + { + ModelMan.addLabel(myModel, e.getPoint()); + break; + } } if (ModelMan.getCurrentObject() == null && e.getClickCount() == 2) *************** *** 538,541 **** --- 543,547 ---- x2 = e.getX(); y2 = e.getY(); + // Define what to do according to the selected tool switch (NOToolBar2.getCurrentTool()) *************** *** 894,937 **** } /** ! * Calculate a cached model rectangle ! * @return the rectangle */ ! public Rectangle calculateRectangle() { ! int xmin = 1000000; ! int ymin = 1000000; ! int xmax = 0; ! int ymax = 0; ! int xtmpmin = 0; ! int ytmpmin = 0; ! int xtmpmax = 0; ! int ytmpmax = 0; ! for (int i = 0; i <myModel.getClasses().size(); i++) ! { ! BaseClass baseObject = (BaseClass) myModel.getClasses().elementAt(i); ! xtmpmin = (int) baseObject.getObjectView().getLocation().getX(); ! ytmpmin = (int) baseObject.getObjectView().getLocation().getY(); ! xtmpmax = ! baseObject.getObjectView().getLocation().x ! + baseObject.getObjectView().getSize().width; ! ytmpmax = ! baseObject.getObjectView().getLocation().y ! + baseObject.getObjectView().getSize().height; ! if (xtmpmin < xmin) ! xmin = xtmpmin; ! if (ytmpmin < ymin) ! ymin = ytmpmin; ! if (xtmpmax > xmax) ! xmax = xtmpmax; ! if (ytmpmax > ymax) ! ymax = ytmpmax; ! } ! rectangle = ! new Rectangle( ! Math.abs(xmin - 10), ! Math.abs(ymin - 10), ! xmax - xmin + 20, ! ymax - ymin + 20); ! return rectangle; } } --- 900,936 ---- } /** ! * Calculate the visibles objects ! * @return the objects views */ ! public ObjectView[] getVisibleObjectView() { ! ObjectView[] b = ! new ObjectView[((PhysicalModel)myModel).getInheritanceLinks().size() ! + ((PhysicalModel)myModel).getTables().size() ! + ((PhysicalModel)myModel).getConstraints().size() ! + ((PhysicalModel) myModel).getLabels().size()]; ! int offset = 0; ! ! for (int i = 0; i < ((PhysicalModel)myModel).getInheritanceLinks().size(); i++) { ! b[offset] = ((PhysicalModel)myModel).getInheritanceLinkAt(i).getObjectView();; ! offset++; ! } ! for (int i = 0; i < ((PhysicalModel)myModel).getConstraints().size(); i++) ! { ! b[offset] = ((PhysicalModel)myModel).getConstraintAt(i).getObjectView();; ! offset++; } + for (int i = 0; i < ((PhysicalModel)myModel).getTables().size(); i++) + { + b[offset] = ((PhysicalModel)myModel).getTableAt(i).getObjectView();; + offset++; + } + for (int i = 0;i < ((PhysicalModel) myModel).getLabels().size(); + i++) + { + b[offset] =(ObjectView) ((PhysicalModel) myModel).getLabels().elementAt(i); + offset++; + } + return b; + } } Index: TableView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/TableView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TableView.java 31 May 2003 11:48:35 -0000 1.7 --- TableView.java 8 Jun 2003 09:28:27 -0000 1.8 *************** *** 87,91 **** (int) this.getSize().getHeight() - 1); /** Text **/ ! this.printText(g2, x, y); } --- 87,91 ---- (int) this.getSize().getHeight() - 1); /** Text **/ ! this.printColumns(g2, x, y); } |
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/util Modified Files: DatabaseLoader.java EditorFactory.java MeriseTransform.java ModelMan.java NOImageTransform.java TorqueWrapper.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: DatabaseLoader.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/DatabaseLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DatabaseLoader.java 15 Mar 2003 17:58:25 -0000 1.2 --- DatabaseLoader.java 8 Jun 2003 09:28:26 -0000 1.3 *************** *** 118,124 **** //evaluate a sequential location val=x % rows; ! table.getTableView().setLocation(new Point(dx+5000,(y*dy)+2500)); // set next time espacement. ! dx=dx + (int)table.getTableView().getSize().getWidth() + 20; if (val==0) { y++; --- 118,124 ---- //evaluate a sequential location val=x % rows; ! table.getObjectView().setLocation(new Point(dx+5000,(y*dy)+2500)); // set next time espacement. ! dx=dx + (int)table.getObjectView().getSize().getWidth() + 20; if (val==0) { y++; Index: EditorFactory.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/EditorFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EditorFactory.java 25 May 2003 20:21:10 -0000 1.4 --- EditorFactory.java 8 Jun 2003 09:28:26 -0000 1.5 *************** *** 6,9 **** --- 6,10 ---- import org.devaki.nextobjects.ui.workspace.models.objects.ConstraintEdit; import org.devaki.nextobjects.ui.workspace.models.objects.EntityEdit; + import org.devaki.nextobjects.ui.workspace.models.objects.LabelEdit; import org.devaki.nextobjects.ui.workspace.models.objects.InheritanceLinkEdit; import org.devaki.nextobjects.ui.workspace.models.objects.TableEdit; *************** *** 19,22 **** --- 20,24 ---- import org.devaki.nextobjects.workspace.models.objects.Constraint; import org.devaki.nextobjects.workspace.models.objects.Entity; + import org.devaki.nextobjects.workspace.models.objects.Label; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; import org.devaki.nextobjects.workspace.models.objects.Table; *************** *** 42,45 **** --- 44,48 ---- private static InheritanceLinkEdit inheritanceLinkEdit = new InheritanceLinkEdit(); private static ConstraintEdit constraintEdit = new ConstraintEdit(); + private static LabelEdit labelEdit = new LabelEdit(); // xxxStyleEdit *************** *** 90,93 **** --- 93,100 ---- //ModelMan.getInheritanceLinkEdit((InheritanceLink)currentObject); } + else if (currentObject instanceof Label) + { + EditorFactory.getLabelEdit((Label)currentObject); + } else if (currentObject instanceof Table) { *************** *** 95,99 **** } else if (ModelMan.getCurrentObjects().isEmpty()) { - System.out.println("2getModelEdit()"); EditorFactory.getModelEdit(); } --- 102,105 ---- *************** *** 152,155 **** --- 158,169 ---- { tableEdit.setData(pTable); + } + /** + * Call the 'TableEdit' window + * @param pTable + */ + public static void getLabelEdit(Label pLabel) + { + labelEdit.setData(pLabel); } Index: MeriseTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/MeriseTransform.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MeriseTransform.java 2 Jun 2003 20:03:45 -0000 1.21 --- MeriseTransform.java 8 Jun 2003 09:28:26 -0000 1.22 *************** *** 128,132 **** MeriseTransform.applyRule_00_(db, anotherMerise); ModelMan.resizeModelObjects(db); ! db.getPhysicalView().repaint(); } else { --- 128,132 ---- MeriseTransform.applyRule_00_(db, anotherMerise); ModelMan.resizeModelObjects(db); ! db.getModelView().repaint(); } else { Index: ModelMan.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/ModelMan.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ModelMan.java 2 Jun 2003 20:03:45 -0000 1.25 --- ModelMan.java 8 Jun 2003 09:28:26 -0000 1.26 *************** *** 45,48 **** --- 45,49 ---- import org.devaki.nextobjects.workspace.models.PhysicalModel; import org.devaki.nextobjects.workspace.models.graphics.ConceptualView; + import org.devaki.nextobjects.workspace.models.graphics.AssociationView; import org.devaki.nextobjects.workspace.models.graphics.LineView; import org.devaki.nextobjects.workspace.models.graphics.PhysicalView; *************** *** 57,60 **** --- 58,62 ---- import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; import org.devaki.nextobjects.workspace.models.objects.Table; + import org.devaki.nextobjects.workspace.models.objects.Label; /** *************** *** 174,180 **** (int) ((p.getY() - newEntity.getObjectView().getSize().getHeight() / 2))); ! newEntity.getEntityView().setLocation(p); addEntity(pMerise, newEntity); setCurrentObject(newEntity); return newEntity; } --- 176,183 ---- (int) ((p.getY() - newEntity.getObjectView().getSize().getHeight() / 2))); ! newEntity.getObjectView().setLocation(p); addEntity(pMerise, newEntity); setCurrentObject(newEntity); + NOToolBar2.setCurrentTool(NOToolBar2.TOOL_SELECTION); return newEntity; } *************** *** 204,208 **** pEntity.setMyModel(pMerise); pMerise.getEntities().addElement(pEntity); ! pEntity.getEntityView().setOldLocation(pEntity.getEntityView().getLocation()); currentModel.redoLog.log( NORedoLog.ACTION_CREATE, --- 207,211 ---- pEntity.setMyModel(pMerise); pMerise.getEntities().addElement(pEntity); ! //((EntityView)pEntity.getObjectView()).setOldLocation(pEntity.getEntityView().getLocation()); currentModel.redoLog.log( NORedoLog.ACTION_CREATE, *************** *** 256,260 **** - newAssociation.getObjectView().getSize().getHeight() / 2)); newAssociation.getObjectView().setLocation(p); ! newAssociation.getAssociationView().setOldLocation(p); addAssociation(pMerise, newAssociation); resetCurrentObjects(); --- 259,263 ---- - newAssociation.getObjectView().getSize().getHeight() / 2)); newAssociation.getObjectView().setLocation(p); ! ((AssociationView) newAssociation.getObjectView()).setOldLocation(p); addAssociation(pMerise, newAssociation); resetCurrentObjects(); *************** *** 265,268 **** --- 268,272 ---- (int) newAssociation.getObjectView().getLocation().getX(), (int) newAssociation.getObjectView().getLocation().getY()); + NOToolBar2.setCurrentTool(NOToolBar2.TOOL_SELECTION); return newAssociation; } *************** *** 384,387 **** --- 388,392 ---- pTable.getObjectView().setLocation(p); addTable(pDatabase, pTable); + NOToolBar2.setCurrentTool(NOToolBar2.TOOL_SELECTION); return pTable; } *************** *** 418,423 **** (int) pTable.getObjectView().getLocation().getY()); pDatabase.getTables().addElement(pTable); ! ((ClassView)pTable.getObjectView()).setOldLocation(pTable.getObjectView().getLocation()); ! pTable.getTableView().resetSelectionPoint(); pDatabase.getPanel().repaint(); } --- 423,429 ---- (int) pTable.getObjectView().getLocation().getY()); pDatabase.getTables().addElement(pTable); ! ((ClassView) pTable.getObjectView()).setOldLocation( ! pTable.getObjectView().getLocation()); ! pTable.getObjectView().resetSelectionPoint(); pDatabase.getPanel().repaint(); } *************** *** 498,501 **** --- 504,521 ---- /** + * Conveniency method for the ConceptualView.java to add an InheritanceLink. + * @param pModel the model + * @param p the point + */ + public static void addLabel(BaseModel pModel, Point p) + { + Label lbl = new Label(currentModel); + lbl.getObjectView().setLocation(p); + pModel.getLabels().addElement(lbl.getObjectView()); + setCurrentObject(lbl); + NOToolBar2.setCurrentTool(NOToolBar2.TOOL_SELECTION); + } + + /** * Remove a table from a database * @param pDatabase the database *************** *** 509,513 **** NOTreeView.removeNode(t.getDynamicTreeNode()); } ! /** * Remove a constraint from a table --- 529,544 ---- NOTreeView.removeNode(t.getDynamicTreeNode()); } ! /** ! * Remove a label from a model ! * @param pModel the model ! * @param pLabel the label ! */ ! public static void removeLabel(BaseModel pModel, Label pLabel) ! { ! pModel.isVerified = false; ! pModel.isSaved = false; ! resetCurrentObjects(); ! pModel.getLabels().removeElement(pLabel.getObjectView()); ! } /** * Remove a constraint from a table *************** *** 741,748 **** draggedObject = pDraggedObject; } ! /** ! * get the dragged object ! * @return the object ! */ public static BaseObject getDraggedObject() { --- 772,779 ---- draggedObject = pDraggedObject; } ! /** ! * get the dragged object ! * @return the object ! */ public static BaseObject getDraggedObject() { *************** *** 758,766 **** dropTargetObject = pDropTargetObject; } ! ! /** ! * get the drop target object ! * @return the object ! */ public static BaseObject getDropTargetObject() { --- 789,797 ---- dropTargetObject = pDropTargetObject; } ! ! /** ! * get the drop target object ! * @return the object ! */ public static BaseObject getDropTargetObject() { *************** *** 874,877 **** --- 905,912 ---- ((ConceptualModel) currentModel), (InheritanceLink) currentObject); + + } else if (currentObject instanceof Label) + { + removeLabel(currentModel, (Label) currentObject); } *************** *** 893,900 **** --- 928,939 ---- currentModel, (InheritanceLink) currentObject); + } else if (currentObject instanceof Label) + { + removeLabel(currentModel, (Label) currentObject); } } } resetCurrentObjects(); + currentModel.getModelView().repaint(); } Index: NOImageTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/NOImageTransform.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NOImageTransform.java 4 Jun 2003 19:29:40 -0000 1.6 --- NOImageTransform.java 8 Jun 2003 09:28:26 -0000 1.7 *************** *** 33,36 **** --- 33,37 ---- import org.devaki.nextobjects.workspace.models.ConceptualModel; import org.devaki.nextobjects.workspace.models.objects.BaseObject; + import org.devaki.nextobjects.workspace.models.graphics.ObjectView; import org.devaki.nextobjects.workspace.models.graphics.ClassView; *************** *** 69,83 **** int yOffset) { ! BaseObject[] tmp = pPDM.getModelObjects(); // loop for (int j = 0; j < tmp.length; j++) { ! if (tmp[j].getObjectView() instanceof ClassView) { ! ((ClassView) tmp[j].getObjectView()).setLocation( new Point( ! tmp[j].getObjectView().getLocation().x - xOffset, ! tmp[j].getObjectView().getLocation().y - yOffset)); ! tmp[j].getObjectView().resetSelectionPoint(); } } --- 70,84 ---- int yOffset) { ! ObjectView[] tmp = pPDM.getModelView().getVisibleObjectView(); // loop for (int j = 0; j < tmp.length; j++) { ! if (tmp[j] instanceof ClassView) { ! ((ClassView) tmp[j]).setLocation( new Point( ! tmp[j].getLocation().x - xOffset, ! tmp[j].getLocation().y - yOffset)); ! tmp[j].resetSelectionPoint(); } } *************** *** 116,120 **** boolean success = false; ! Point oldP = pCDM.getConceptualView().getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. --- 117,121 ---- boolean success = false; ! Point oldP = pCDM.getModelView().getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. *************** *** 122,134 **** // by that time it havn't been redrawed ... translateModel(pCDM, oldP.x, oldP.y); ! pCDM.getConceptualView().calculateRectangle(); ! pCDM.getConceptualView().setFullRefresh(true); // the rectangle give the offfset. ! Rectangle rect = pCDM.getConceptualView().getRectangle(); ! pCDM.getConceptualView().setFullRefresh(true); BufferedImage bi = getImage( ! pCDM.getConceptualView().drawingArea, rect.width, rect.height); --- 123,136 ---- // by that time it havn't been redrawed ... translateModel(pCDM, oldP.x, oldP.y); ! pCDM.getModelView().calculateRectangle(); ! pCDM.getModelView().setFullRefresh(true); // the rectangle give the offfset. ! Rectangle rect = pCDM.getModelView().getRectangle(); ! ! pCDM.getModelView().setFullRefresh(true); BufferedImage bi = getImage( ! pCDM.getModelView().drawingArea, rect.width, rect.height); *************** *** 144,151 **** } translateModel(pCDM, -oldP.x, -oldP.y); ! pCDM.getConceptualView().calculateRectangle(); ! pCDM.getConceptualView().setFullRefresh(true); ! pCDM.getConceptualView().repaint(); ! pCDM.getConceptualView().repaint(); return success; } --- 146,153 ---- } translateModel(pCDM, -oldP.x, -oldP.y); ! pCDM.getModelView().calculateRectangle(); ! pCDM.getModelView().setFullRefresh(true); ! pCDM.getModelView().repaint(); ! pCDM.getModelView().repaint(); return success; } *************** *** 161,165 **** boolean success = false; ! Point oldP = pPDM.getPhysicalView().getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. --- 163,167 ---- boolean success = false; ! Point oldP = pPDM.getModelView().getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. *************** *** 167,174 **** // by that time it havn't been redrawed ... translateModel(pPDM, oldP.x, oldP.y); ! pPDM.getPhysicalView().calculateRectangle(); ! pPDM.getPhysicalView().setFullRefresh(true); // the rectangle give the offfset. ! Rectangle rect = pPDM.getPhysicalView().getRectangle(); try --- 169,176 ---- // by that time it havn't been redrawed ... translateModel(pPDM, oldP.x, oldP.y); ! pPDM.getModelView().calculateRectangle(); ! pPDM.getModelView().setFullRefresh(true); // the rectangle give the offfset. ! Rectangle rect = pPDM.getModelView().getRectangle(); try *************** *** 176,180 **** BufferedImage bi = getImage( ! pPDM.getPhysicalView().drawingArea, rect.width, rect.height); --- 178,182 ---- BufferedImage bi = getImage( ! pPDM.getModelView().drawingArea, rect.width, rect.height); *************** *** 189,195 **** // return to the old offset. translateModel(pPDM, -oldP.x, -oldP.y); ! pPDM.getPhysicalView().calculateRectangle(); ! pPDM.getPhysicalView().setFullRefresh(true); ! pPDM.getPhysicalView().repaint(); return success; --- 191,197 ---- // return to the old offset. translateModel(pPDM, -oldP.x, -oldP.y); ! pPDM.getModelView().calculateRectangle(); ! pPDM.getModelView().setFullRefresh(true); ! pPDM.getModelView().repaint(); return success; Index: TorqueWrapper.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/TorqueWrapper.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TorqueWrapper.java 28 May 2003 21:48:28 -0000 1.17 --- TorqueWrapper.java 8 Jun 2003 09:28:26 -0000 1.18 *************** *** 938,942 **** --- 938,946 ---- new Boolean(pColumn.isRequired()).toString()); } + if (pColumn.getType()!=null) { tmpElementColumn.setAttribute("type",pColumn.getType().toString()); + } else { + logger.error("Invalid column : " + pColumn); + } if (!pColumn.getJavaType().equals("primitive")) { |
From: <efl...@us...> - 2003-06-08 09:28:30
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/sample In directory sc8-pr-cvs1:/tmp/cvs-serv28289/sample Modified Files: videoclub.cdm Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: videoclub.cdm =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/sample/videoclub.cdm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** videoclub.cdm 25 May 2003 08:02:35 -0000 1.8 --- videoclub.cdm 8 Jun 2003 09:28:25 -0000 1.9 *************** *** 30,34 **** <column name="comments" javaName="" code="COMMENTS" primaryKey="false" required="true" type="VARCHAR" javaType="primitive" size="255" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="CATEGORIES" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5165" y="2702" width="92" height="48"> <code>CATEGORIES</code> <notes /> --- 30,34 ---- <column name="comments" javaName="" code="COMMENTS" primaryKey="false" required="true" type="VARCHAR" javaType="primitive" size="255" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="CATEGORIES" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5138" y="2781" width="92" height="74"> <code>CATEGORIES</code> <notes /> *************** *** 37,41 **** <column name="Item 2" javaName="" code="ITEM_2" primaryKey="false" required="false" type="VARCHAR" javaType="primitive" size="255" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="Tape" javaName="" idMethod="none" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5232" y="2527" width="57" height="61"> <code>Tape</code> <notes /> --- 37,41 ---- <column name="Item 2" javaName="" code="ITEM_2" primaryKey="false" required="false" type="VARCHAR" javaType="primitive" size="255" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="Tape" javaName="" idMethod="none" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5302" y="2529" width="57" height="61"> <code>Tape</code> <notes /> *************** *** 43,47 **** <column name="dispo" javaName="" code="dispo" primaryKey="false" required="false" type="BOOLEANCHAR" javaType="primitive" size="" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="CUSTORMER" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5547" y="2566" width="85" height="61"> <code>CUSTORMER</code> <notes /> --- 43,47 ---- <column name="dispo" javaName="" code="dispo" primaryKey="false" required="false" type="BOOLEANCHAR" javaType="primitive" size="" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="CUSTORMER" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5613" y="2591" width="85" height="61"> <code>CUSTORMER</code> <notes /> *************** *** 54,58 **** <column name="actorid" javaName="" code="ACTORID" primaryKey="true" required="true" type="INTEGER" javaType="primitive" size="" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="Director" javaName="" idMethod="none" skipSql="false" abstract="false" baseClass="org.devaki.nextobjects.sample.Base" basePeer="org.devaki.nextobjects.sample.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5312" y="2878" width="85" height="61"> <code>Director</code> <notes /> --- 54,58 ---- <column name="actorid" javaName="" code="ACTORID" primaryKey="true" required="true" type="INTEGER" javaType="primitive" size="" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <entity name="Director" javaName="" idMethod="none" skipSql="false" abstract="false" baseClass="org.devaki.nextobjects.sample.Base" basePeer="org.devaki.nextobjects.sample.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5449" y="2997" width="85" height="61"> <code>Director</code> <notes /> *************** *** 60,64 **** <column name="biography" javaName="" code="biography" primaryKey="false" required="false" type="CLOB" javaType="primitive" size="" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <association name="HAVE_DIRECTED" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5298" y="2805" width="106" height="35"> <code>HAVE_DIRECTED</code> <notes /> --- 60,64 ---- <column name="biography" javaName="" code="biography" primaryKey="false" required="false" type="CLOB" javaType="primitive" size="" default="" autoIncrement="false" inheritance="false" inputValidator="" javaNamingMethod="null" description="" /> </entity> ! <association name="HAVE_DIRECTED" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5439" y="2885" width="106" height="35"> <code>HAVE_DIRECTED</code> <notes /> *************** *** 66,70 **** <associationLink linkedEntity="Director" cardinality="3" /> </association> ! <association name="IS_OF" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5301" y="2703" width="50" height="35"> <code>IS_OF</code> <notes /> --- 66,70 ---- <associationLink linkedEntity="Director" cardinality="3" /> </association> ! <association name="IS_OF" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5323" y="2744" width="50" height="35"> <code>IS_OF</code> <notes /> *************** *** 72,76 **** <associationLink linkedEntity="Movie" cardinality="3" /> </association> ! <association name="RECORDED" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5204" y="2611" width="71" height="35"> <code>RECORDED</code> <notes /> --- 72,76 ---- <associationLink linkedEntity="Movie" cardinality="3" /> </association> ! <association name="RECORDED" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5275" y="2637" width="71" height="35"> <code>RECORDED</code> <notes /> *************** *** 84,88 **** <associationLink linkedEntity="Actor" cardinality="3" /> </association> ! <association name="RENT" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5370" y="2542" width="43" height="35"> <code>RENT</code> <notes /> --- 84,88 ---- <associationLink linkedEntity="Actor" cardinality="3" /> </association> ! <association name="RENT" javaName="" idMethod="null" skipSql="false" abstract="false" basePeer="org.apache.torque.util.BasePeer" alias="" javaNamingMethod="null" heavyIndexing="false" description="" x="5476" y="2547" width="43" height="35"> <code>RENT</code> <notes /> |
From: <efl...@us...> - 2003-06-08 09:28:30
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/workspace/models Modified Files: BaseModel.java ConceptualModel.java PhysicalModel.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: BaseModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/BaseModel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BaseModel.java 4 Jun 2003 19:29:41 -0000 1.11 --- BaseModel.java 8 Jun 2003 09:28:26 -0000 1.12 *************** *** 29,32 **** --- 29,33 ---- import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; import org.devaki.nextobjects.workspace.models.objects.BaseObject; + import org.devaki.nextobjects.workspace.models.graphics.BaseModelView; /** *************** *** 81,85 **** */ private Vector inheritanceLinks = new Vector(); ! /** * Torqu's DB type --- 82,90 ---- */ private Vector inheritanceLinks = new Vector(); ! /** ! * labels ! */ ! private Vector labels=new Vector(); ! /** * Torqu's DB type *************** *** 210,214 **** */ public abstract BaseObject[] getModelObjects(); ! /** --- 215,224 ---- */ public abstract BaseObject[] getModelObjects(); ! ! /** ! * Get the model view ! * @return model view ! */ ! public abstract BaseModelView getModelView(); /** *************** *** 752,755 **** --- 762,766 ---- } } + /** * Return the inheritance links, constraints, halfAssociations of the model *************** *** 770,774 **** } ! /** * The model is saved --- 781,792 ---- } ! /** ! * Return the labels of the model ! * @return the classes ! */ ! public Vector getLabels() ! { ! return labels; ! } /** * The model is saved Index: ConceptualModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/ConceptualModel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ConceptualModel.java 4 Jun 2003 19:29:41 -0000 1.6 --- ConceptualModel.java 8 Jun 2003 09:28:26 -0000 1.7 *************** *** 24,27 **** --- 24,28 ---- import java.util.Vector; import org.devaki.nextobjects.workspace.models.graphics.ConceptualView; + import org.devaki.nextobjects.workspace.models.graphics.BaseModelView; import org.devaki.nextobjects.workspace.models.graphics.LineView; import org.devaki.nextobjects.workspace.models.objects.Association; *************** *** 131,135 **** * in this models. * @return the base objects ! */ public BaseObject[] getModelObjects() { --- 132,137 ---- * in this models. * @return the base objects ! * */ ! public BaseObject[] getModelObjects() { *************** *** 163,172 **** return baseObjects; } ! /** * Return the graphics view of the model * @return the graphic view */ ! public ConceptualView getConceptualView() { return this.myConceptualView; --- 165,175 ---- return baseObjects; } ! ! /** * Return the graphics view of the model * @return the graphic view */ ! public BaseModelView getModelView() { return this.myConceptualView; Index: PhysicalModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/PhysicalModel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PhysicalModel.java 4 Jun 2003 19:29:41 -0000 1.6 --- PhysicalModel.java 8 Jun 2003 09:28:26 -0000 1.7 *************** *** 23,26 **** --- 23,27 ---- import java.util.Vector; import org.devaki.nextobjects.workspace.models.graphics.PhysicalView; + import org.devaki.nextobjects.workspace.models.graphics.BaseModelView; import org.devaki.nextobjects.workspace.models.objects.BaseObject; import org.devaki.nextobjects.workspace.models.objects.Constraint; *************** *** 86,90 **** * @return model view */ ! public PhysicalView getPhysicalView() { return this.myPhysicalView; --- 87,91 ---- * @return model view */ ! public BaseModelView getModelView() { return this.myPhysicalView; |
From: <efl...@us...> - 2003-06-08 09:28:29
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects Modified Files: NextObjects.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: NextObjects.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/NextObjects.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NextObjects.java 2 Jun 2003 20:03:45 -0000 1.13 --- NextObjects.java 8 Jun 2003 09:28:25 -0000 1.14 *************** *** 132,136 **** public NextObjects() { ! super("nextObjects "); /** Initialization **/ --- 132,136 ---- public NextObjects() { ! super("devaki-nextobjects "); /** Initialization **/ |
From: <efl...@us...> - 2003-06-08 09:28:29
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/toolbars In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/ui/toolbars Modified Files: NOToolBar2.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: NOToolBar2.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/toolbars/NOToolBar2.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NOToolBar2.java 3 May 2003 12:50:49 -0000 1.4 --- NOToolBar2.java 8 Jun 2003 09:28:26 -0000 1.5 *************** *** 33,289 **** /** ! * ! * <p>Title: NOToolBar2</p> ! * <p>Description: </p> ! * <p>Copyright: Copyright (c) 2002</p> ! * <p>Company: devaki.org</p> ! * @version 1.0 */ public class NOToolBar2 extends JToolBar { - /** Variables **/ - public static final int TOOL_TABLE = 0; - public static final int TOOL_SELECTION = 1; - public static final int TOOL_RESIZE = 2; - public static final int TOOL_INHERITANCE = 6; - // CDM - public static final int TOOL_ASSOCIATION = 3; - public static final int TOOL_ASSOCIATION_LINK = 4; - // PDM - public static final int TOOL_CONSTRAINT = 5; - // Current selected tool - private static int currentTool = TOOL_SELECTION; ! /**Components**/ ! // Toggle buttons ! private static CustomToggleButton jToggleButtonTable; ! private static CustomToggleButton jToggleButtonAssociation; ! private static CustomToggleButton jToggleButtonAssociationLink; ! private static CustomToggleButton jToggleButtonInheritancy; ! private static CustomToggleButton jToggleButtonConstraint; ! private static CustomToggleButton jToggleButtonSelection; ! // Button group ! private static ButtonGroup buttonGroup = new ButtonGroup(); ! /** ! * Construct a new 'NOToolBar2' object ! */ ! public NOToolBar2() ! { ! /** Initialization **/ ! super(JToolBar.HORIZONTAL); ! this.setFloatable(true); ! /** Components **/ ! // Toggle buttons ! jToggleButtonTable = new CustomToggleButton(CstImages.ICN_TABLE, ! "Draw a table", ! "Create a new table or a new entity according to the type of the current model", ! false, ! false); ! jToggleButtonAssociation = new CustomToggleButton(CstImages.ICN_ASSOCIATION, ! "Draw an association", ! "Create a new association", ! false, ! false); ! jToggleButtonAssociationLink = new CustomToggleButton(CstImages. ! ICN_ASSOCIATIONLINK, ! "Draw an association link", ! "Create a new association link", ! false, ! false); ! jToggleButtonInheritancy = new CustomToggleButton(CstImages.ICN_INHERITANCE, ! "Draw an inheritance link", ! "Create a new inheritance link", ! false, ! false); ! jToggleButtonConstraint = new CustomToggleButton(CstImages.ICN_CONSTRAINT, ! "Draw a constraint", ! "Create a new constraint", ! false, ! false); ! jToggleButtonSelection = new CustomToggleButton(CstImages.ICN_SELECTION, ! "Select/Move an object", ! "Select/Move an object in the current model", ! true, ! true); ! // Button group ! buttonGroup.add(jToggleButtonTable); ! buttonGroup.add(jToggleButtonAssociation); ! buttonGroup.add(jToggleButtonAssociationLink); ! buttonGroup.add(jToggleButtonInheritancy); ! buttonGroup.add(jToggleButtonConstraint); ! buttonGroup.add(jToggleButtonSelection); ! /** Listeners **/ ! jToggleButtonTable.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_TABLE); ! // Set there is no current object ! ModelMan.setCurrentObject(null); ! } ! }); ! jToggleButtonAssociation.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_ASSOCIATION); ! // Set there is no current object ! ModelMan.setCurrentObject(null); ! } ! }); ! jToggleButtonAssociationLink.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_ASSOCIATION_LINK); ! if (ModelMan.getCurrentModel() instanceof ConceptualModel) { ! ((ConceptualModel)ModelMan.getCurrentModel()) ! .getConceptualView() ! .setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } ! } ! }); ! jToggleButtonInheritancy.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_INHERITANCE); ! if(ModelMan.getCurrentModel()instanceof ConceptualModel) ! { ! ((ConceptualModel)ModelMan.getCurrentModel()) ! .getConceptualView() ! .setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } ! else if(ModelMan.getCurrentModel()instanceof PhysicalModel) ! { ! ((PhysicalModel)ModelMan.getCurrentModel()) ! .getPhysicalView() ! .setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } ! } ! }); ! jToggleButtonConstraint.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_CONSTRAINT); ! if(ModelMan.getCurrentModel()instanceof PhysicalModel) ! { // only if! ! ((PhysicalModel)ModelMan.getCurrentModel()) ! .getPhysicalView() ! .setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } ! } ! }); ! jToggleButtonSelection.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_SELECTION); ! } ! }); ! /** Assembling components **/ ! this.add(jToggleButtonTable); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonAssociation); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonAssociationLink); ! // not completly implemented. ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonInheritancy); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonConstraint); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonSelection); ! } ! /** ! * Return the current used tool ! * @return ! */ ! static public int getCurrentTool() ! { ! return currentTool; ! } ! /** ! * Defines the current button used ! * @param pCurrentTool ! */ ! static public void setCurrentTool(int pCurrentTool) ! { ! currentTool = pCurrentTool; ! switch(currentTool) ! { ! case TOOL_TABLE: ! jToggleButtonTable.setSelected(true); ! break; ! case TOOL_ASSOCIATION: ! jToggleButtonAssociation.setSelected(true); ! break; ! case TOOL_ASSOCIATION_LINK: ! jToggleButtonAssociationLink.setSelected(true); ! break; ! case TOOL_INHERITANCE: ! jToggleButtonInheritancy.setSelected(true); ! break; ! case TOOL_CONSTRAINT: ! jToggleButtonConstraint.setSelected(true); ! break; ! case TOOL_SELECTION: ! jToggleButtonSelection.setSelected(true); ! break; ! } ! } ! /** ! * Enable/Disable icons ! */ ! static public void fixIcons() ! { ! if(ModelMan.getCurrentModel() != null) ! { ! jToggleButtonTable.setEnabled(true); ! // CDM ! if(ModelMan.getCurrentModel()instanceof ConceptualModel) ! { ! jToggleButtonAssociation.setEnabled(true); ! jToggleButtonAssociationLink.setEnabled(true); ! jToggleButtonConstraint.setEnabled(false); ! jToggleButtonInheritancy.setEnabled(true); ! if(jToggleButtonConstraint.isSelected()) ! { ! jToggleButtonSelection.setSelected(true); ! } ! } ! // PDM ! else ! { ! jToggleButtonAssociation.setEnabled(false); ! jToggleButtonAssociationLink.setEnabled(false); ! jToggleButtonConstraint.setEnabled(true); ! jToggleButtonInheritancy.setEnabled(true); ! if(jToggleButtonAssociation.isSelected()) ! { ! jToggleButtonSelection.setSelected(true); ! } ! } ! } ! else ! { ! jToggleButtonTable.setEnabled(false); ! jToggleButtonAssociation.setEnabled(false); ! jToggleButtonAssociationLink.setEnabled(false); ! jToggleButtonConstraint.setEnabled(false); ! jToggleButtonInheritancy.setEnabled(false); ! jToggleButtonSelection.setSelected(true); ! } ! } } --- 33,388 ---- /** ! * This class is responsible for drawing the draw toolbar ! * @author efl...@de... */ public class NOToolBar2 extends JToolBar { ! /** ! * TOOL_TABLE ! */ ! public static final int TOOL_TABLE = 0; ! /** ! * TOOL_SELECTION ! */ ! public static final int TOOL_SELECTION = 1; ! /** ! * TOOL_RESIZE ! */ ! public static final int TOOL_RESIZE = 2; ! /** ! * TOOL_ASSOCIATION ! */ ! public static final int TOOL_ASSOCIATION = 3; ! /** ! * TOOL_ASSOCIATION_LINK ! */ ! public static final int TOOL_ASSOCIATION_LINK = 4; ! /** ! * TOOL_CONSTRAINT ! */ ! public static final int TOOL_CONSTRAINT = 5; ! /** ! * TOOL_INHERITANCE ! */ ! public static final int TOOL_INHERITANCE = 6; ! /** ! * TOOL_LABEL ! */ ! public static final int TOOL_LABEL = 7; ! /** ! * The current tool ! */ ! private static int currentTool = TOOL_SELECTION; ! /** ! * this button activate drawing table. Clicking on the drawing ! * drop a table centered on the point you have just clicked. ! * This button is activated only on physical model. ! */ ! private static CustomToggleButton jToggleButtonTable; ! ! /** ! * This button activate the drawing of an association. Cliking ! * on the drawing will drop an association centered on the point ! * you have just clicked. This button is activated only on conceptual ! * model. ! */ ! private static CustomToggleButton jToggleButtonAssociation; ! ! /** ! * This button activate the association link tool , represented by a line and ! * a pair of number called cardinaliities. When the tool is activated, dragging ! * cause a line to be streched. If the line is between two entites an association ! * and two association links are created. If it's between an entity and an ! * association then a single association link is created. ! */ ! private static CustomToggleButton jToggleButtonAssociationLink; ! ! /** ! * This button activate the Inheritancy tool. ! */ ! private static CustomToggleButton jToggleButtonInheritancy; ! ! /** ! * This button activate the Constraint tool. ! */ ! private static CustomToggleButton jToggleButtonConstraint; ! ! /** ! * This button activate the Selection tool. ! */ ! private static CustomToggleButton jToggleButtonSelection; ! ! /** ! * The button Label ! */ ! private static CustomToggleButton jToggleButtonLabel; ! ! /** ! * The button group ! */ ! private static ButtonGroup buttonGroup = new ButtonGroup(); ! ! /** ! * Construct a new 'NOToolBar2' object ! */ ! public NOToolBar2() ! { ! /** Initialization **/ ! super(JToolBar.HORIZONTAL); ! this.setFloatable(true); ! ! /** Components **/ ! // Toggle buttons ! ! jToggleButtonTable = ! new CustomToggleButton( ! CstImages.ICN_TABLE, ! "Draw a table", ! "Create a new table or a new entity according to the type of the current model", ! false, ! false); ! jToggleButtonAssociation = ! new CustomToggleButton( ! CstImages.ICN_ASSOCIATION, ! "Draw an association", ! "Create a new association", ! false, ! false); ! jToggleButtonAssociationLink = ! new CustomToggleButton( ! CstImages.ICN_ASSOCIATIONLINK, ! "Draw an association link", ! "Create a new association link", ! false, ! false); ! jToggleButtonInheritancy = ! new CustomToggleButton( ! CstImages.ICN_INHERITANCE, ! "Draw an inheritance link", ! "Create a new inheritance link", ! false, ! false); ! jToggleButtonConstraint = ! new CustomToggleButton( ! CstImages.ICN_CONSTRAINT, ! "Draw a constraint", ! "Create a new constraint", ! false, ! false); ! jToggleButtonSelection = ! new CustomToggleButton( ! CstImages.ICN_SELECTION, ! "Select an object", ! "Select an object.", ! true, ! true); ! jToggleButtonLabel = ! new CustomToggleButton( ! CstImages.ICN_LABEL, ! "Add a label", ! "Add a label to the current object.", ! true, ! true); ! // Button group ! buttonGroup.add(jToggleButtonTable); ! buttonGroup.add(jToggleButtonAssociation); ! buttonGroup.add(jToggleButtonAssociationLink); ! buttonGroup.add(jToggleButtonInheritancy); ! buttonGroup.add(jToggleButtonConstraint); ! buttonGroup.add(jToggleButtonSelection); ! buttonGroup.add(jToggleButtonLabel); ! ! /** Listeners **/ ! jToggleButtonTable.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_TABLE); ! // Set there is no current object ! ModelMan.setCurrentObject(null); ! } ! }); ! jToggleButtonAssociation.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_ASSOCIATION); ! // Set there is no current object ! ModelMan.setCurrentObject(null); ! } ! }); ! jToggleButtonAssociationLink.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_ASSOCIATION_LINK); ! if (ModelMan.getCurrentModel() instanceof ConceptualModel) ! { ! ((ConceptualModel) ModelMan.getCurrentModel()) ! .getModelView() ! .setCursor( ! new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } ! } ! }); ! jToggleButtonInheritancy.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_INHERITANCE); ! if (ModelMan.getCurrentModel() instanceof ConceptualModel) ! { ! ((ConceptualModel) ModelMan.getCurrentModel()) ! .getModelView() ! .setCursor( ! new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } else if (ModelMan.getCurrentModel() instanceof PhysicalModel) ! { ! ((PhysicalModel) ModelMan.getCurrentModel()) ! .getModelView() ! .setCursor( ! new Cursor(Cursor.CROSSHAIR_CURSOR)); ! ! } ! } ! }); ! jToggleButtonConstraint.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_CONSTRAINT); ! if (ModelMan.getCurrentModel() instanceof PhysicalModel) ! { // only if! ! ((PhysicalModel) ModelMan.getCurrentModel()) ! .getModelView() ! .setCursor( ! new Cursor(Cursor.CROSSHAIR_CURSOR)); ! } ! } ! }); ! jToggleButtonSelection.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_SELECTION); ! } ! }); ! jToggleButtonLabel.addMouseListener(new MouseAdapter() ! { ! public void mousePressed(MouseEvent e) ! { ! setCurrentTool(TOOL_LABEL); ! } ! }); ! ! /** Assembling components **/ ! this.add(jToggleButtonTable); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonAssociation); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonAssociationLink); ! // not completly implemented. ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonInheritancy); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonConstraint); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonSelection); ! this.add(new JToolBar.Separator(new Dimension(2, 0))); ! this.add(jToggleButtonLabel); ! fixIcons(); ! } ! ! /** ! * Return the current used tool ! * @return the current tool ! */ ! static public int getCurrentTool() ! { ! return currentTool; ! } ! ! /** ! * Defines the current button used ! * @param pCurrentTool the new current tool ! */ ! static public void setCurrentTool(int pCurrentTool) ! { ! currentTool = pCurrentTool; ! switch (currentTool) ! { ! case TOOL_TABLE : ! jToggleButtonTable.setSelected(true); ! break; ! case TOOL_ASSOCIATION : ! jToggleButtonAssociation.setSelected(true); ! break; ! case TOOL_ASSOCIATION_LINK : ! jToggleButtonAssociationLink.setSelected(true); ! break; ! case TOOL_INHERITANCE : ! jToggleButtonInheritancy.setSelected(true); ! break; ! case TOOL_CONSTRAINT : ! jToggleButtonConstraint.setSelected(true); ! break; ! case TOOL_SELECTION : ! jToggleButtonSelection.setSelected(true); ! break; ! case TOOL_LABEL : ! jToggleButtonLabel.setSelected(true); ! break; ! } ! } ! ! /** ! * Enable/Disable icons ! */ ! static public void fixIcons() ! { ! if (ModelMan.getCurrentModel() != null) ! { ! jToggleButtonTable.setEnabled(true); ! jToggleButtonSelection.setEnabled(true); ! jToggleButtonInheritancy.setEnabled(true); ! jToggleButtonLabel.setEnabled(true); ! ! // CDM ! if (ModelMan.getCurrentModel() instanceof ConceptualModel) ! { ! jToggleButtonAssociation.setEnabled(true); ! jToggleButtonAssociationLink.setEnabled(true); ! jToggleButtonConstraint.setEnabled(false); ! } ! // PDM ! else ! { ! jToggleButtonAssociation.setEnabled(false); ! jToggleButtonAssociationLink.setEnabled(false); ! jToggleButtonConstraint.setEnabled(true); ! } ! } ! // there is no current model ! else ! { ! jToggleButtonTable.setEnabled(false); ! jToggleButtonAssociation.setEnabled(false); ! jToggleButtonAssociationLink.setEnabled(false); ! jToggleButtonConstraint.setEnabled(false); ! jToggleButtonInheritancy.setEnabled(false); ! jToggleButtonSelection.setEnabled(false); ! jToggleButtonLabel.setEnabled(false); ! } ! } } |
From: <efl...@us...> - 2003-06-08 09:28:29
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/icons In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/icons Added Files: label.png Log Message: First step in adding ability to have mabels and model's titles + checkstyle --- NEW FILE: label.png --- (This appears to be a binary file; contents omitted.) |
From: <efl...@us...> - 2003-06-08 09:28:29
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/menus In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/ui/menus Modified Files: ModelPopupMenu.java NOMenuBar.java TreePopupMenu.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: ModelPopupMenu.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/menus/ModelPopupMenu.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ModelPopupMenu.java 24 May 2003 18:50:47 -0000 1.10 --- ModelPopupMenu.java 8 Jun 2003 09:28:26 -0000 1.11 *************** *** 40,48 **** --- 40,51 ---- import org.devaki.nextobjects.workspace.models.objects.Constraint; import org.devaki.nextobjects.workspace.models.objects.Entity; + import org.devaki.nextobjects.workspace.models.objects.Label; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; import org.devaki.nextobjects.workspace.models.objects.Table; import org.devaki.nextobjects.workspace.models.objects.BaseClass; + import org.devaki.nextobjects.workspace.models.objects.BaseLine; import org.devaki.nextobjects.workspace.models.graphics.ClassView; import org.devaki.nextobjects.workspace.models.graphics.LineView; + import org.devaki.nextobjects.workspace.models.graphics.LabelView; *************** *** 116,119 **** --- 119,126 ---- /** Listeners **/ // Action Listeners + //TODO add public abstract Dimension autoResize(Boolean actIt) in ClassView.java + //TODO add private autoResize(Label pLabel){} + //TODO add private autoResize(ClassView pClassView) {} + jMenuItemResize.addActionListener(new ActionListener() { *************** *** 127,137 **** ((ClassView)ModelMan.getCurrentObject().getObjectView()) .autoResize(true); ! } else { ((LineView)ModelMan.getCurrentObject().getObjectView()) .computeBestPoints(); ! } } } }); this.jMenuItemNew.addActionListener(new ActionListener() { --- 134,147 ---- ((ClassView)ModelMan.getCurrentObject().getObjectView()) .autoResize(true); ! } else if (ModelMan.getCurrentObject() instanceof BaseLine) { ((LineView)ModelMan.getCurrentObject().getObjectView()) .computeBestPoints(); ! } else if (ModelMan.getCurrentObject() instanceof Label) { ! ((LabelView)((Label)ModelMan.getCurrentObject()).getObjectView()).autoResize(true); ! } } } }); + this.jMenuItemNew.addActionListener(new ActionListener() { *************** *** 141,150 **** { ModelMan.newObject(((ConceptualModel)ModelMan.getCurrentModel()) ! .getConceptualView(), new Point(X, Y)); } else if(ModelMan.getCurrentModel()instanceof PhysicalModel) { ModelMan.newObject(((PhysicalModel)ModelMan.getCurrentModel()) ! .getPhysicalView(), new Point(X, Y)); } } --- 151,160 ---- { ModelMan.newObject(((ConceptualModel)ModelMan.getCurrentModel()) ! .getModelView(), new Point(X, Y)); } else if(ModelMan.getCurrentModel()instanceof PhysicalModel) { ModelMan.newObject(((PhysicalModel)ModelMan.getCurrentModel()) ! .getModelView(), new Point(X, Y)); } } *************** *** 183,187 **** ModelMan.delete(); ((ConceptualModel)ModelMan.getCurrentModel()) ! .getConceptualView().repaint(); } else if(ModelMan.getCurrentModel()instanceof PhysicalModel) --- 193,197 ---- ModelMan.delete(); ((ConceptualModel)ModelMan.getCurrentModel()) ! .getModelView().repaint(); } else if(ModelMan.getCurrentModel()instanceof PhysicalModel) *************** *** 189,193 **** ModelMan.delete(); ((PhysicalModel)ModelMan.getCurrentModel()) ! .getPhysicalView().repaint(); } } --- 199,203 ---- ModelMan.delete(); ((PhysicalModel)ModelMan.getCurrentModel()) ! .getModelView().repaint(); } } Index: NOMenuBar.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/menus/NOMenuBar.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NOMenuBar.java 28 May 2003 21:48:27 -0000 1.12 --- NOMenuBar.java 8 Jun 2003 09:28:26 -0000 1.13 *************** *** 226,230 **** ModelMan.delete(); ((ConceptualModel)ModelMan.getCurrentModel()) ! .getConceptualView().repaint(); } else if(ModelMan.getCurrentModel()instanceof PhysicalModel) --- 226,230 ---- ModelMan.delete(); ((ConceptualModel)ModelMan.getCurrentModel()) ! .getModelView().repaint(); } else if(ModelMan.getCurrentModel()instanceof PhysicalModel) *************** *** 232,236 **** ModelMan.delete(); ((PhysicalModel)ModelMan.getCurrentModel()) ! .getPhysicalView().repaint(); } } --- 232,236 ---- ModelMan.delete(); ((PhysicalModel)ModelMan.getCurrentModel()) ! .getModelView().repaint(); } } Index: TreePopupMenu.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/ui/menus/TreePopupMenu.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TreePopupMenu.java 27 Apr 2003 17:05:26 -0000 1.4 --- TreePopupMenu.java 8 Jun 2003 09:28:26 -0000 1.5 *************** *** 200,208 **** if (objectParent instanceof ConceptualModel) { ModelMan.delete(); ! ((ConceptualModel) ModelMan.getCurrentModel()).getConceptualView(). repaint(); } else if (objectParent instanceof PhysicalModel) { ModelMan.delete(); ! ((PhysicalModel) ModelMan.getCurrentModel()).getPhysicalView().repaint(); } ModelMan.getCurrentModel().getPanel().repaint(); --- 200,208 ---- if (objectParent instanceof ConceptualModel) { ModelMan.delete(); ! ((ConceptualModel) ModelMan.getCurrentModel()).getModelView(). repaint(); } else if (objectParent instanceof PhysicalModel) { ModelMan.delete(); ! ((PhysicalModel) ModelMan.getCurrentModel()).getModelView().repaint(); } ModelMan.getCurrentModel().getPanel().repaint(); |
From: <efl...@us...> - 2003-06-08 09:28:29
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/constants In directory sc8-pr-cvs1:/tmp/cvs-serv28289/src/org/devaki/nextobjects/constants Modified Files: CstGraphics.java CstImages.java Log Message: First step in adding ability to have mabels and model's titles + checkstyle Index: CstGraphics.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/constants/CstGraphics.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CstGraphics.java 2 Jun 2003 20:03:45 -0000 1.3 --- CstGraphics.java 8 Jun 2003 09:28:26 -0000 1.4 *************** *** 117,119 **** --- 117,137 ---- */ public final static Color DEFAULT_CONSTRAINT_COLOR = Color.blue; + /** + * DEFAULT_MODELTITLE_SIZE + */ + public final static Dimension DEFAULT_MODELTITLE_SIZE = new Dimension(250,50); + /** + * DEFAULT_MODELTITLE_COLOR + */ + public final static Color DEFAULT_MODELTITLE_COLOR = Color.blue; + /** + * DEFAULT_LABEL_BACKGROUNG_COLOR + */ + public final static Color DEFAULT_LABEL_BACKROUNG_COLOR = Color.YELLOW; + /** + * DEFAULT_LABEL_SIZE + */ + public final static Dimension DEFAULT_LABEL_SIZE = new Dimension(120,120); + + } Index: CstImages.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/constants/CstImages.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CstImages.java 18 Feb 2003 19:24:26 -0000 1.3 --- CstImages.java 8 Jun 2003 09:28:26 -0000 1.4 *************** *** 88,91 **** --- 88,93 ---- public final static ImageIcon ICN_FIELD = NOTools.loadIconResource("field.gif"); + public final static ImageIcon ICN_LABEL + = NOTools.loadIconResource("label.png"); |
From: <efl...@us...> - 2003-06-04 19:30:15
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util In directory sc8-pr-cvs1:/tmp/cvs-serv8358/src/org/devaki/nextobjects/util Modified Files: NOImageTransform.java Log Message: Refactored graphics- Index: NOImageTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/NOImageTransform.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NOImageTransform.java 3 Jun 2003 18:00:54 -0000 1.5 --- NOImageTransform.java 4 Jun 2003 19:29:40 -0000 1.6 *************** *** 29,32 **** --- 29,33 ---- import org.apache.log4j.Category; import org.apache.log4j.Logger; + import org.devaki.nextobjects.workspace.models.BaseModel; import org.devaki.nextobjects.workspace.models.PhysicalModel; import org.devaki.nextobjects.workspace.models.ConceptualModel; *************** *** 57,89 **** /** ! * Move the ConceptualModel to the upper left corner to get the samllest image. ! * @param pCDM the context model ! * @param xOffset the X offset ! * @param yOffset the Y offset ! */ ! private static void translateModel( ! ConceptualModel pCDM, ! int xOffset, ! int yOffset) ! { ! BaseObject[] tmp = pCDM.getModel0bjects(); ! ! // loop ! for (int j = 0; j < tmp.length; j++) ! { ! if (tmp[j].getObjectView() instanceof ClassView) ! { ! ((ClassView) tmp[j].getObjectView()).setLocation( ! new Point( ! tmp[j].getObjectView().getLocation().x - xOffset, ! tmp[j].getObjectView().getLocation().y - yOffset)); ! tmp[j].getObjectView().resetSelectionPoint(); ! } ! } ! ! } ! ! /** ! * Move the PhysicalModel to the upper left corner to get the samllest image. * @param pPDM the context model * @param xOffset the X offset --- 58,63 ---- /** ! * Move the model to the upper left corner to get the samllest image. ! * * @param pPDM the context model * @param xOffset the X offset *************** *** 91,100 **** */ private static void translateModel( ! PhysicalModel pPDM, int xOffset, int yOffset) { ! Rectangle rect = pPDM.getRectangle(); ! BaseObject[] tmp = pPDM.getModel0bjects(); // loop for (int j = 0; j < tmp.length; j++) --- 65,73 ---- */ private static void translateModel( ! BaseModel pPDM, int xOffset, int yOffset) { ! BaseObject[] tmp = pPDM.getModelObjects(); // loop for (int j = 0; j < tmp.length; j++) *************** *** 102,106 **** if (tmp[j].getObjectView() instanceof ClassView) { - ((ClassView) tmp[j].getObjectView()).setLocation( new Point( --- 75,78 ---- *************** *** 110,114 **** } } - pPDM.calculateRectangle(); } --- 82,85 ---- *************** *** 145,149 **** boolean success = false; ! Point oldP = pCDM.getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. --- 116,120 ---- boolean success = false; ! Point oldP = pCDM.getConceptualView().getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. *************** *** 151,156 **** // by that time it havn't been redrawed ... translateModel(pCDM, oldP.x, oldP.y); // the rectangle give the offfset. ! Rectangle rect = pCDM.getRectangle(); pCDM.getConceptualView().setFullRefresh(true); BufferedImage bi = --- 122,130 ---- // by that time it havn't been redrawed ... translateModel(pCDM, oldP.x, oldP.y); + pCDM.getConceptualView().calculateRectangle(); + pCDM.getConceptualView().setFullRefresh(true); + // the rectangle give the offfset. ! Rectangle rect = pCDM.getConceptualView().getRectangle(); pCDM.getConceptualView().setFullRefresh(true); BufferedImage bi = *************** *** 170,173 **** --- 144,150 ---- } translateModel(pCDM, -oldP.x, -oldP.y); + pCDM.getConceptualView().calculateRectangle(); + pCDM.getConceptualView().setFullRefresh(true); + pCDM.getConceptualView().repaint(); pCDM.getConceptualView().repaint(); return success; *************** *** 184,188 **** boolean success = false; ! Point oldP = pPDM.getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. --- 161,165 ---- boolean success = false; ! Point oldP = pPDM.getPhysicalView().getRectangle().getLocation(); // this is a hack, the model is moved to top left corner in // order to avoid drawing the whole 5000*5000 drawingArea. *************** *** 190,195 **** // by that time it havn't been redrawed ... translateModel(pPDM, oldP.x, oldP.y); // the rectangle give the offfset. ! Rectangle rect = pPDM.getRectangle(); try --- 167,174 ---- // by that time it havn't been redrawed ... translateModel(pPDM, oldP.x, oldP.y); + pPDM.getPhysicalView().calculateRectangle(); + pPDM.getPhysicalView().setFullRefresh(true); // the rectangle give the offfset. ! Rectangle rect = pPDM.getPhysicalView().getRectangle(); try *************** *** 210,213 **** --- 189,194 ---- // return to the old offset. translateModel(pPDM, -oldP.x, -oldP.y); + pPDM.getPhysicalView().calculateRectangle(); + pPDM.getPhysicalView().setFullRefresh(true); pPDM.getPhysicalView().repaint(); |
From: <efl...@us...> - 2003-06-04 19:29:47
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv8358/src/org/devaki/nextobjects/workspace/models/graphics Modified Files: AssociationLinkView.java ConceptualView.java ConstraintView.java InheritanceLinkView.java PhysicalView.java Added Files: BaseModelView.java Log Message: Refactored graphics- --- NEW FILE: BaseModelView.java --- /* nextobjects Copyright (C) 2001-2005 Emmanuel Florent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU GeneralSys Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.devaki.nextobjects.workspace.models.graphics; import java.io.Serializable; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; import javax.swing.event.ChangeListener; import javax.swing.event.ChangeEvent; import javax.swing.JPanel; import javax.swing.JScrollPane; import org.devaki.nextobjects.constants.CstGraphics; import org.devaki.nextobjects.util.ModelMan; import org.devaki.nextobjects.workspace.models.BaseModel; import org.devaki.nextobjects.workspace.models.objects.BaseObject; import org.devaki.nextobjects.workspace.models.objects.BaseClass; import java.awt.Image; public abstract class BaseModelView extends JPanel implements Serializable { /** * X coordinates used when mouse clicking */ protected int x1; /** * Y coordinates used when mouse clicking */ protected int y1; /** * X coordinates used when mouse draging */ protected int x2; /** * Y coordinates used when mouse draging */ protected int y2; /** * X difference between x1 and object location */ protected int dx; /** * Y difference between x1 and object location */ protected int dy; /** * the model bounds */ protected Rectangle rectangle; /** * the context model */ protected BaseModel myModel; /** * the drawing area */ public JPanel drawingArea; /** * the scrollpane */ public JScrollPane jScrollPane; /** * full drawing refresh */ protected boolean fullRefresh = false; /** * The buffered image */ transient protected BufferedImage bi = null; public BaseModelView(BaseModel pMerise) { /** Initialization **/ super(true); // is double buffered! myModel = pMerise; this.setVisible(true); /** Components **/ // Main Panel this.setLayout(new BorderLayout()); // Construct the drawing area drawingArea = new JPanel() { /** * Draw all components * @param g the graphics */ public void paint(Graphics g) { update(g); } public Image makeImage(int x, int y) { Graphics2D big; BufferedImage bi2; Graphics2D bi2g; BaseObject[] tmp = getMyModel().getModelObjects(); Rectangle rect; calculateRectangle(); rect = getRectangle(); bi = (BufferedImage) drawingArea.createImage( rect.width, rect.height); big = bi.createGraphics(); big.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); big.fillRect(0, 0, rect.width, rect.height); for (int k = 0; k < tmp.length; k++) { // Clears the rectangle that was previously drawn. Dimension d = tmp[k].getObjectView().getSize(); Point l = tmp[k].getObjectView().getLocation(); if (tmp[k].getObjectView() instanceof LineView) { tmp[k].getObjectView().paint(big); } else { // classview ?! if (d.height > 0 && d.width > 0) { bi2 = (BufferedImage) drawingArea.createImage( d.width, d.height); bi2g = bi2.createGraphics(); tmp[k].getObjectView().paint(bi2g); big.drawImage( bi2, l.x - getRectangle().x, l.y - getRectangle().y, this); } } } return bi; } public void update(Graphics g) { Graphics2D g2 = (Graphics2D) g; // blank fill, clean ... super.paintComponent(g2); //Rectangle area; BufferedImage bi2; Graphics2D bi2g; if (fullRefresh) { bi = (BufferedImage) makeImage(getRectangle().height, getRectangle().width); fullRefresh = false; } g2.drawImage(bi, getRectangle().x, getRectangle().y, this); // loop/paint selected objects objects toviewPort panel. for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) { ObjectView tmpObjectView = ((BaseObject) ModelMan .getCurrentObjects() .elementAt(j)) .getObjectView(); Dimension d2 = tmpObjectView.getSize(); Point p2 = tmpObjectView.getLocation(); if (tmpObjectView instanceof ClassView) { g2.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); Rectangle r = ((ClassView) tmpObjectView).getOldrectangle(); g2.fillRect(r.x, r.y, r.width, r.height); bi2 = (BufferedImage) jScrollPane.createImage( d2.width, d2.height); bi2g = bi2.createGraphics(); tmpObjectView.paint(bi2g); ((BaseObject) ModelMan .getCurrentObjects() .elementAt(j)) .getObjectView() .paint( bi2g); g2.drawImage(bi2, p2.x, p2.y, this); } else { Graphics tmpClip = g2.create( getRectangle().x, getRectangle().y, getViewSize().width, getViewSize().height); ((BaseObject) ModelMan .getCurrentObjects() .elementAt(j)) .getObjectView() .paint( tmpClip); } ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)) .getObjectView() .renderSelected(g); } } }; // Define the color of the background this.drawingArea.setBackground(CstGraphics.MODEL_BACKGROUND_COLOR); this.drawingArea.setPreferredSize(CstGraphics.MODEL_DIMENSION); /* Assembling components **/ this.jScrollPane = new JScrollPane(this.drawingArea); jScrollPane.getViewport().setBackground( CstGraphics.MODEL_BACKGROUND_COLOR); this.add(jScrollPane, BorderLayout.CENTER); //will update the buffered image in case viewport have changed. // used at least at init this.jScrollPane.getViewport().addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { fullRefresh = true; } }); /** Extra **/ // Initialize scrolling position jScrollPane.getViewport().setViewPosition( CstGraphics.MODEL_INITIAL_POSITION); } /** * Return a cached rectangle/bounds for the model * @return the rectangle */ public Rectangle getRectangle() { if (rectangle == null) { rectangle = calculateRectangle(); } if (rectangle.x == 999990) { rectangle = new Rectangle( CstGraphics.MODEL_INITIAL_POSITION.x, CstGraphics.MODEL_INITIAL_POSITION.y, 20, 20); } return rectangle; } /** * Calculate a cached model rectangle * @return the rectangle */ public Rectangle calculateRectangle() { int xmin = 1000000; int ymin = 1000000; int xmax = 0; int ymax = 0; int xtmpmin = 0; int ytmpmin = 0; int xtmpmax = 0; int ytmpmax = 0; for (int i = 0; i < myModel.getClasses().size(); i++) { BaseClass baseObject = (BaseClass) myModel.getClasses().elementAt(i); xtmpmin = (int) baseObject.getObjectView().getLocation().getX(); ytmpmin = (int) baseObject.getObjectView().getLocation().getY(); xtmpmax = baseObject.getObjectView().getLocation().x + baseObject.getObjectView().getSize().width; ytmpmax = baseObject.getObjectView().getLocation().y + baseObject.getObjectView().getSize().height; if (xtmpmin < xmin) xmin = xtmpmin; if (ytmpmin < ymin) ymin = ytmpmin; if (xtmpmax > xmax) xmax = xtmpmax; if (ytmpmax > ymax) ymax = ytmpmax; } rectangle = new Rectangle( Math.abs(xmin - 10), Math.abs(ymin - 10), xmax - xmin + 20, ymax - ymin + 20); return rectangle; } /** * @return */ public BaseModel getMyModel() { return myModel; } /** * @param model */ public void setMyModel(BaseModel model) { myModel = model; } /** * set the dimension * @param d the dimension */ public void setViewSize(Dimension d) { jScrollPane.getViewport().setViewSize(d); } /** * return the view size * @return the location */ public Dimension getViewSize() { return jScrollPane.getViewport().getViewSize(); } /** * Set if to refresh the drawing at next paint * @param b full refresh */ public void setFullRefresh(boolean b) { fullRefresh = b; } /** * Location of the view position * @return the point */ public Point getViewPosition() { return jScrollPane.getViewport().getViewPosition(); } } Index: AssociationLinkView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/AssociationLinkView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AssociationLinkView.java 2 Jun 2003 20:03:46 -0000 1.4 --- AssociationLinkView.java 4 Jun 2003 19:29:42 -0000 1.5 *************** *** 101,105 **** public void paint(Graphics g) { ! Point p0=myObject.getMyModel().getRectangle().getLocation(); Point p1=selectionPoints[0].getPoint(); --- 101,105 ---- public void paint(Graphics g) { ! Point p0=((ConceptualView)myObject.getMyModel().getPanel()).getRectangle().getLocation(); Point p1=selectionPoints[0].getPoint(); Index: ConceptualView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConceptualView.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** ConceptualView.java 3 Jun 2003 18:00:55 -0000 1.21 --- ConceptualView.java 4 Jun 2003 19:29:42 -0000 1.22 *************** *** 19,40 **** */ package org.devaki.nextobjects.workspace.models.graphics; import java.io.Serializable; - import java.awt.BorderLayout; import java.awt.Cursor; import java.awt.Dimension; - - import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Color; import java.awt.Point; import java.awt.Polygon; - import java.awt.Rectangle; - import java.awt.image.BufferedImage; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; - import javax.swing.event.ChangeListener; - import javax.swing.event.ChangeEvent; - import javax.swing.JPanel; - import javax.swing.JScrollPane; import javax.swing.event.MouseInputAdapter; import org.devaki.nextobjects.constants.CstGraphics; --- 19,32 ---- */ package org.devaki.nextobjects.workspace.models.graphics; + import java.io.Serializable; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Color; import java.awt.Point; import java.awt.Polygon; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.event.MouseInputAdapter; import org.devaki.nextobjects.constants.CstGraphics; *************** *** 53,57 **** import org.devaki.nextobjects.workspace.models.objects.Entity; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; ! import java.awt.Image; /** --- 45,49 ---- import org.devaki.nextobjects.workspace.models.objects.Entity; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; ! /** *************** *** 59,119 **** * @author efl...@de... */ ! public class ConceptualView extends JPanel implements Serializable { ! /** ! * X coordinates used when mouse clicking ! */ ! private int x1; ! ! /** ! * Y coordinates used when mouse clicking ! */ ! private int y1; ! ! /** ! * X coordinates used when mouse draging ! */ ! private int x2; ! ! /** ! * Y coordinates used when mouse draging ! */ ! private int y2; ! ! /** ! * X difference between x1 and object location ! */ ! private int dx; ! ! /** ! * Y difference between x1 and object location ! */ ! private int dy; ! ! /** ! * the context model ! */ ! private ConceptualModel myModel; ! ! /** ! * the drawing area ! */ ! public JPanel drawingArea; ! ! /** ! * the scrollpane ! */ ! public JScrollPane jScrollPane; ! ! /** ! * full drawing refresh ! */ ! private boolean fullRefresh = false; ! ! /** ! * The buffered image ! */ ! transient private BufferedImage bi = null; ! /** * Construct a new <code>ConceptualView</code> object --- 51,57 ---- * @author efl...@de... */ ! public class ConceptualView extends BaseModelView implements Serializable { ! /** * Construct a new <code>ConceptualView</code> object *************** *** 122,275 **** public ConceptualView(ConceptualModel pMerise) { ! /** Initialization **/ ! this.myModel = pMerise; ! this.setVisible(true); ! ! /** Components **/ ! // Main Panel ! this.setLayout(new BorderLayout()); ! // Construct the drawing area ! drawingArea = new JPanel() ! { ! /** ! * Draw all components ! * @param g the graphics ! */ ! public void paint(Graphics g) ! { ! update(g); ! } ! ! public Image makeImage(int x,int y) ! { ! Graphics2D big; ! BufferedImage bi2; ! Graphics2D bi2g; ! ! BaseObject[] tmp = myModel.getModel0bjects(); ! ! Rectangle rect; ! myModel.calculateRectangle(); ! rect = myModel.getRectangle(); ! ! ! bi=(BufferedImage) drawingArea.createImage(rect.width,rect.height); ! ! big = bi.createGraphics(); ! ! big.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ! big.fillRect(0, 0, rect.width, rect.height); ! ! for (int k = 0; k < tmp.length; k++) ! { ! // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getObjectView().getSize(); ! Point l = tmp[k].getObjectView().getLocation(); ! ! if (tmp[k].getObjectView() instanceof LineView) ! { ! tmp[k].getObjectView().paint(big); ! } else ! { // classview ?! ! if (d.height > 0 && d.width > 0) ! { ! bi2 =(BufferedImage)drawingArea.createImage(d.width,d.height); ! bi2g = bi2.createGraphics(); ! tmp[k].getObjectView().paint(bi2g); ! big.drawImage( ! bi2, ! l.x - myModel.getRectangle().x, ! l.y - myModel.getRectangle().y, ! this); ! } ! } ! } ! return bi; ! } ! ! public void update(Graphics g) ! { ! Graphics2D g2 = (Graphics2D) g; ! // blank fill, clean ... ! super.paintComponent(g2); ! //Rectangle area; ! BufferedImage bi2; ! Graphics2D bi2g; ! ! if (fullRefresh) ! { ! bi = (BufferedImage) makeImage(myModel.getRectangle().height,myModel.getRectangle().width); ! fullRefresh = false; ! } ! ! g2.drawImage(bi,myModel.getRectangle().x, myModel.getRectangle().y,this); ! ! // loop/paint selected objects objects toviewPort panel. ! for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) ! { ! ObjectView tmpObjectView = ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView(); ! Dimension d2 = tmpObjectView.getSize(); ! Point p2 = tmpObjectView.getLocation(); ! ! if (tmpObjectView instanceof ClassView) ! { ! g2.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ! Rectangle r =((ClassView) tmpObjectView).getOldrectangle(); ! g2.fillRect(r.x, r.y, r.width, r.height); ! bi2 =(BufferedImage) jScrollPane.createImage( d2.width, d2.height); ! bi2g = bi2.createGraphics(); ! tmpObjectView.paint(bi2g); ! ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView() ! .paint( ! bi2g); ! g2.drawImage(bi2, p2.x, p2.y, this); ! } else ! { ! Graphics tmpClip =g2.create(myModel.getRectangle().x, ! myModel.getRectangle().y, ! getViewSize().width, ! getViewSize().height); ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().paint(tmpClip); ! } ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().renderSelected(g); ! } ! } ! }; ! // Define the color of the background ! this.drawingArea.setBackground(CstGraphics.MODEL_BACKGROUND_COLOR); ! this.drawingArea.setPreferredSize(CstGraphics.MODEL_DIMENSION); ! /* Listeners **/ // Mouse Listeners this.drawingArea.addMouseListener(new MyMouseListener()); this.drawingArea.addMouseMotionListener(new MyMouseMotionListener()); - - /* Assembling components **/ - this.jScrollPane = new JScrollPane(this.drawingArea); - jScrollPane.getViewport().setBackground( - CstGraphics.MODEL_BACKGROUND_COLOR); - this.add(jScrollPane, BorderLayout.CENTER); - - //will update the buffered image in case viewport have changed. - // used at least at init - this.jScrollPane.getViewport().addChangeListener(new ChangeListener() - { - public void stateChanged(ChangeEvent e) - { - fullRefresh = true; - } - }); - /** Extra **/ - // Initialize scrolling position - jScrollPane.getViewport().setViewPosition( - CstGraphics.MODEL_INITIAL_POSITION); } --- 60,68 ---- public ConceptualView(ConceptualModel pMerise) { ! super(pMerise); /* Listeners **/ // Mouse Listeners this.drawingArea.addMouseListener(new MyMouseListener()); this.drawingArea.addMouseMotionListener(new MyMouseMotionListener()); } *************** *** 307,311 **** // Add the new association to the model Association newAssociation = ! ModelMan.addAssociation(this.myModel, tmpPoint); // Add links between the new association and the entities --- 100,104 ---- // Add the new association to the model Association newAssociation = ! ModelMan.addAssociation((ConceptualModel)this.myModel, tmpPoint); // Add links between the new association and the entities *************** *** 394,398 **** && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! BaseObject[] tmp = myModel.getModel0bjects(); // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) --- 187,191 ---- && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! BaseObject[] tmp = myModel.getModelObjects(); // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) *************** *** 447,451 **** case NOToolBar2.TOOL_TABLE : { ! ModelMan.addEntity(myModel, e.getPoint()); //record old location ModelMan.moveCurrentObject(0, 0); --- 240,244 ---- case NOToolBar2.TOOL_TABLE : { ! ModelMan.addEntity((ConceptualModel)myModel, e.getPoint()); //record old location ModelMan.moveCurrentObject(0, 0); *************** *** 455,459 **** case NOToolBar2.TOOL_ASSOCIATION : { ! ModelMan.addAssociation(myModel, e.getPoint()); break; } --- 248,252 ---- case NOToolBar2.TOOL_ASSOCIATION : { ! ModelMan.addAssociation((ConceptualModel)myModel, e.getPoint()); break; } *************** *** 490,494 **** { fullRefresh = true; ! myModel.calculateRectangle(); x2 = e.getX(); y2 = e.getY(); --- 283,287 ---- { fullRefresh = true; ! calculateRectangle(); x2 = e.getX(); y2 = e.getY(); *************** *** 796,802 **** // Loop for the entities to find the targeted object ! for (int i = 0; i < myModel.countEntities(); i++) { ! if (((Polygon) myModel .getEntityAt(i) .getObjectView() --- 589,595 ---- // Loop for the entities to find the targeted object ! for (int i = 0; i < ((ConceptualModel)myModel).countEntities(); i++) { ! if (((Polygon) ((ConceptualModel)myModel) .getEntityAt(i) .getObjectView() *************** *** 815,822 **** .getDraggedObject() .equals( ! (BaseObject) myModel.getEntityAt(i))) { ModelMan.setDropTargetObject( ! (BaseObject) myModel.getEntityAt(i)); targetNotFound = false; break; --- 608,615 ---- .getDraggedObject() .equals( ! (BaseObject)((ConceptualModel) myModel).getEntityAt(i))) { ModelMan.setDropTargetObject( ! (BaseObject) ((ConceptualModel)myModel).getEntityAt(i)); targetNotFound = false; break; *************** *** 829,836 **** { for (int i = 0; ! i < myModel.countAssociation(); i++) { ! if (myModel .getAssociationAt(i) .getObjectView() --- 622,629 ---- { for (int i = 0; ! i < (((ConceptualModel))myModel).countAssociation(); i++) { ! if (((ConceptualModel)myModel) .getAssociationAt(i) .getObjectView() *************** *** 847,857 **** .equals( ( ! BaseObject) myModel .getAssociationAt( i))) { ModelMan.setDropTargetObject( ! ( ! BaseObject) myModel .getAssociationAt( i)); --- 640,649 ---- .equals( ( ! BaseObject) ((ConceptualModel) myModel) .getAssociationAt( i))) { ModelMan.setDropTargetObject( ! (BaseObject) ((ConceptualModel)myModel) .getAssociationAt( i)); *************** *** 922,979 **** } } - } - - - - /** - * Set if to refresh the drawing at next paint - * @param b full refresh - */ - public void setFullRefresh(boolean b) - { - fullRefresh = b; - } - - /** - * Location of the view position - * @return the point - */ - public Point getViewPosition() - { - return jScrollPane.getViewport().getViewPosition(); - } - - /** - * return the view size - * @return the location - */ - public Dimension getViewSize() - { - return jScrollPane.getViewport().getViewSize(); - } - - /** - * Set the view position - * @param point the location - */ - public void setViewPosition(Point point) - { - jScrollPane.getViewport().setViewPosition(point); - } - /** - * Get the visible rectangle - * @return the rectangle - */ - public Rectangle getViewRect() - { - return jScrollPane.getViewport().getViewRect(); - } - /** - * set the dimension - * @param d the dimension - */ - public void setViewSize(Dimension d) - { - jScrollPane.getViewport().setViewSize(d); } --- 714,717 ---- Index: ConstraintView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConstraintView.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ConstraintView.java 2 Jun 2003 20:03:46 -0000 1.8 --- ConstraintView.java 4 Jun 2003 19:29:42 -0000 1.9 *************** *** 75,80 **** public void paint(Graphics g) { ! ! Point p0=this.myObject.getMyModel().getRectangle().getLocation(); Point p1=selectionPoints[0].getPoint(); --- 75,80 ---- public void paint(Graphics g) { ! Point p0=((PhysicalView)myObject.getMyModel().getPanel()).getRectangle().getLocation(); ! Point p1=selectionPoints[0].getPoint(); Index: InheritanceLinkView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/InheritanceLinkView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** InheritanceLinkView.java 2 Jun 2003 20:03:46 -0000 1.7 --- InheritanceLinkView.java 4 Jun 2003 19:29:42 -0000 1.8 *************** *** 68,72 **** { ! Point p0 =myObject.getMyModel().getRectangle().getLocation(); Point p1 = selectionPoints[0].getPoint(); --- 68,72 ---- { ! Point p0=((BaseModelView)myObject.getMyModel().getPanel()).getRectangle().getLocation(); Point p1 = selectionPoints[0].getPoint(); Index: PhysicalView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/PhysicalView.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** PhysicalView.java 3 Jun 2003 18:00:55 -0000 1.20 --- PhysicalView.java 4 Jun 2003 19:29:42 -0000 1.21 *************** *** 57,60 **** --- 57,61 ---- /** * Main class for drawing Physical Data Models + * * @see http://www.devaki.org/pdm.html * @author efl...@de... *************** *** 62,124 **** * @task set PhysicalView.jscrollbar to private */ ! public class PhysicalView extends JPanel implements Serializable { - /** - * X coordinates used when mouse clicking - */ - private int x1; - - /** - * Y coordinates used when mouse clicking - */ - private int y1; - - /** - * X coordinates used when mouse draging - */ - private int x2; - - /** - * Y coordinates used when mouse draging - */ - private int y2; - - /** - * X difference between x1 and object location - */ - private int dx; - - /** - * Y difference between x1 and object location - */ - private int dy; - - /** - * the context model - */ - private PhysicalModel myModel; - - /** - * the drawing area - */ - public JPanel drawingArea; - - /** - * the scrollpane - */ - public JScrollPane jScrollPane; - - /** - * full drawing refresh - */ - private boolean fullRefresh = true; - - /** - * the buffered image - */ - transient private BufferedImage bi = null; /** ! * Construct a new <code>PhysicalView</code> object * @param theDatabase the context database */ --- 63,71 ---- * @task set PhysicalView.jscrollbar to private */ ! public class PhysicalView extends BaseModelView implements Serializable { /** ! * Construct a new PhysicalView object * @param theDatabase the context database */ *************** *** 126,130 **** { /** Initialization **/ ! myModel = theDatabase; this.setVisible(true); --- 73,77 ---- { /** Initialization **/ ! super(theDatabase); this.setVisible(true); *************** *** 151,159 **** Graphics2D bi2g; ! BaseObject[] tmp = myModel.getModel0bjects(); Rectangle rect; ! myModel.calculateRectangle(); ! rect = myModel.getRectangle(); --- 98,106 ---- Graphics2D bi2g; ! BaseObject[] tmp = myModel.getModelObjects(); Rectangle rect; ! calculateRectangle(); ! rect = getRectangle(); *************** *** 183,188 **** big.drawImage( bi2, ! l.x - myModel.getRectangle().x, ! l.y - myModel.getRectangle().y, this); } --- 130,135 ---- big.drawImage( bi2, ! l.x - getRectangle().x, ! l.y - getRectangle().y, this); } *************** *** 203,211 **** if (fullRefresh) { ! bi = (BufferedImage) makeImage(myModel.getRectangle().height,myModel.getRectangle().width); fullRefresh = false; } ! System.out.println(myModel.getRectangle()); ! g2.drawImage(bi,myModel.getRectangle().x, myModel.getRectangle().y,this); // loop/paint selected objects objects toviewPort panel. --- 150,158 ---- if (fullRefresh) { ! bi = (BufferedImage) makeImage(getRectangle().height,getRectangle().width); fullRefresh = false; } ! ! g2.drawImage(bi,getRectangle().x, getRectangle().y,this); // loop/paint selected objects objects toviewPort panel. *************** *** 242,247 **** } else { ! Graphics tmpClip =g2.create(myModel.getRectangle().x, ! myModel.getRectangle().y, getViewSize().width, getViewSize().height); --- 189,194 ---- } else { ! Graphics tmpClip =g2.create(getRectangle().x, ! getRectangle().y, getViewSize().width, getViewSize().height); *************** *** 294,298 **** Constraint constraint = ModelMan.addConstraint( ! this.myModel, (Table) ModelMan.getDraggedObject(), (Table) ModelMan.getDropTargetObject()); --- 241,245 ---- Constraint constraint = ModelMan.addConstraint( ! (PhysicalModel)this.myModel, (Table) ModelMan.getDraggedObject(), (Table) ModelMan.getDropTargetObject()); *************** *** 432,436 **** && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! BaseObject[] tmp = myModel.getModel0bjects(); // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) --- 379,383 ---- && (NOToolBar2.getCurrentTool() != NOToolBar2.TOOL_ASSOCIATION)) { ! BaseObject[] tmp = myModel.getModelObjects(); // Loop for the association links and inheritance links. for (int j = 0; j < tmp.length; j++) *************** *** 491,495 **** case NOToolBar2.TOOL_TABLE : { ! ModelMan.addTable(myModel, e.getPoint()); break; } --- 438,442 ---- case NOToolBar2.TOOL_TABLE : { ! ModelMan.addTable((PhysicalModel)myModel, e.getPoint()); break; } *************** *** 511,515 **** { fullRefresh = true; ! myModel.calculateRectangle(); x2 = e.getX(); y2 = e.getY(); --- 458,462 ---- { fullRefresh = true; ! calculateRectangle(); x2 = e.getX(); y2 = e.getY(); *************** *** 824,830 **** // Loop for the entities to find the targeted object ! for (int i = 0; i < myModel.countTable(); i++) { ! if (((Polygon) myModel .getTableAt(i) .getObjectView() --- 771,777 ---- // Loop for the entities to find the targeted object ! for (int i = 0; i < ((PhysicalModel) myModel).countTable(); i++) { ! if (((Polygon) ((PhysicalModel)myModel) .getTableAt(i) .getObjectView() *************** *** 836,843 **** if (!ModelMan .getDraggedObject() ! .equals((BaseObject) myModel.getTableAt(i))) { ModelMan.setDropTargetObject( ! (BaseObject) myModel.getTableAt(i)); break; } --- 783,790 ---- if (!ModelMan .getDraggedObject() ! .equals((BaseObject) ((PhysicalModel)myModel).getTableAt(i))) { ModelMan.setDropTargetObject( ! (BaseObject) ((PhysicalModel) myModel).getTableAt(i)); break; } *************** *** 923,926 **** --- 870,937 ---- return jScrollPane.getViewport().getViewSize(); } + /** + * Return a cached rectangle/bounds for the model + * @return the rectangle + */ + public Rectangle getRectangle() + { + + if (rectangle == null) + { + rectangle = calculateRectangle(); + } + if (rectangle.x == 999990) + { + rectangle = + new Rectangle( + CstGraphics.MODEL_INITIAL_POSITION.x, + CstGraphics.MODEL_INITIAL_POSITION.y, + 20, + 20); + } + return rectangle; + } + /** + * Calculate a cached model rectangle + * @return the rectangle + */ + public Rectangle calculateRectangle() + { + int xmin = 1000000; + int ymin = 1000000; + int xmax = 0; + int ymax = 0; + int xtmpmin = 0; + int ytmpmin = 0; + int xtmpmax = 0; + int ytmpmax = 0; + for (int i = 0; i <myModel.getClasses().size(); i++) + { + BaseClass baseObject = (BaseClass) myModel.getClasses().elementAt(i); + xtmpmin = (int) baseObject.getObjectView().getLocation().getX(); + ytmpmin = (int) baseObject.getObjectView().getLocation().getY(); + xtmpmax = + baseObject.getObjectView().getLocation().x + + baseObject.getObjectView().getSize().width; + ytmpmax = + baseObject.getObjectView().getLocation().y + + baseObject.getObjectView().getSize().height; + if (xtmpmin < xmin) + xmin = xtmpmin; + if (ytmpmin < ymin) + ymin = ytmpmin; + if (xtmpmax > xmax) + xmax = xtmpmax; + if (ytmpmax > ymax) + ymax = ytmpmax; + } + rectangle = + new Rectangle( + Math.abs(xmin - 10), + Math.abs(ymin - 10), + xmax - xmin + 20, + ymax - ymin + 20); + return rectangle; + } } |
From: <efl...@us...> - 2003-06-04 19:29:46
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models In directory sc8-pr-cvs1:/tmp/cvs-serv8358/src/org/devaki/nextobjects/workspace/models Modified Files: BaseModel.java ConceptualModel.java PhysicalModel.java Log Message: Refactored graphics- Index: BaseModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/BaseModel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BaseModel.java 2 Jun 2003 20:03:45 -0000 1.10 --- BaseModel.java 4 Jun 2003 19:29:41 -0000 1.11 *************** *** 21,25 **** import java.io.Serializable; - import java.awt.Rectangle; import javax.swing.JPanel; import java.util.Vector; --- 21,24 ---- *************** *** 29,34 **** import org.devaki.nextobjects.util.NORedoLog; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; ! import org.devaki.nextobjects.workspace.models.objects.BaseClass; ! import org.devaki.nextobjects.constants.CstGraphics; /** --- 28,32 ---- import org.devaki.nextobjects.util.NORedoLog; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; ! import org.devaki.nextobjects.workspace.models.objects.BaseObject; /** *************** *** 37,41 **** * @task check BaseModel.java against maven's project.xml DTD */ ! public class BaseModel implements Serializable { /** --- 35,39 ---- * @task check BaseModel.java against maven's project.xml DTD */ ! public abstract class BaseModel implements Serializable { /** *************** *** 196,204 **** /** - * the model bounds - */ - private Rectangle rectangle; - - /** * Construct a standard NOModel * @param pName the model name --- 194,197 ---- *************** *** 211,214 **** --- 204,214 ---- redoLog = new NORedoLog(); } + + /** + * return the objects of the model + * @return array of BaseObject + */ + public abstract BaseObject[] getModelObjects(); + /** *************** *** 232,238 **** /** * Set the panel associated ! * @param pFrame the panel */ ! public void setPanel(JPanel pPanel) { this.panel = pPanel; } /** --- 232,241 ---- /** * Set the panel associated ! * @param pPanel the panel */ ! public void setPanel(JPanel pPanel) ! { ! this.panel = pPanel; ! } /** *************** *** 493,497 **** * @return the panel */ ! public JPanel getPanel() { return this.panel; } /** --- 496,503 ---- * @return the panel */ ! public JPanel getPanel() ! { ! return this.panel; ! } /** *************** *** 764,832 **** } - /** - * Return a cached rectangle/bounds for the model - * @return the rectangle - */ - public Rectangle getRectangle() - { - if (rectangle == null) - { - rectangle = calculateRectangle(); - } - - if (rectangle.x == 999990) - { - rectangle = - new Rectangle( - CstGraphics.MODEL_INITIAL_POSITION.x, - CstGraphics.MODEL_INITIAL_POSITION.y, - 20, - 20); - } - return rectangle; - } - /** - * Calculate a cached model rectangle - * @return the rectangle - */ - public Rectangle calculateRectangle() - { - int xmin = 1000000; - int ymin = 1000000; - int xmax = 0; - int ymax = 0; - int xtmpmin = 0; - int ytmpmin = 0; - int xtmpmax = 0; - int ytmpmax = 0; - for (int i = 0; i < this.getClasses().size(); i++) - { - BaseClass baseObject = (BaseClass) this.getClasses().elementAt(i); - xtmpmin = (int) baseObject.getObjectView().getLocation().getX(); - ytmpmin = (int) baseObject.getObjectView().getLocation().getY(); - xtmpmax = - baseObject.getObjectView().getLocation().x - + baseObject.getObjectView().getSize().width; - ytmpmax = - baseObject.getObjectView().getLocation().y - + baseObject.getObjectView().getSize().height; - if (xtmpmin < xmin) - xmin = xtmpmin; - if (ytmpmin < ymin) - ymin = ytmpmin; - if (xtmpmax > xmax) - xmax = xtmpmax; - if (ytmpmax > ymax) - ymax = ytmpmax; - } - rectangle = - new Rectangle( - Math.abs(xmin - 10), - Math.abs(ymin - 10), - xmax - xmin + 20, - ymax - ymin + 20); - return rectangle; - } /** * The model is saved --- 770,774 ---- Index: ConceptualModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/ConceptualModel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConceptualModel.java 31 May 2003 11:48:34 -0000 1.5 --- ConceptualModel.java 4 Jun 2003 19:29:41 -0000 1.6 *************** *** 32,36 **** /** * The Conceptual Data Model ! * @author efl...@de... */ public class ConceptualModel extends BaseModel implements Serializable --- 32,36 ---- /** * The Conceptual Data Model ! * @author efl...@de... */ public class ConceptualModel extends BaseModel implements Serializable *************** *** 132,136 **** * @return the base objects */ ! public BaseObject[] getModel0bjects() { --- 132,136 ---- * @return the base objects */ ! public BaseObject[] getModelObjects() { Index: PhysicalModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/PhysicalModel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PhysicalModel.java 25 May 2003 08:02:36 -0000 1.5 --- PhysicalModel.java 4 Jun 2003 19:29:41 -0000 1.6 *************** *** 6,10 **** it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your ! option) any later version. This program is distributed in the hope that it will --- 6,10 ---- it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your ! option) any later version. This program is distributed in the hope that it will *************** *** 28,202 **** public class PhysicalModel extends BaseModel implements Serializable { ! /** Variables **/ ! // List of tables in the model ! private Vector tables = new Vector(); ! // List of constraints in the model ! private Vector constraints = new Vector(); ! // Graphical View ! private PhysicalView myPhysicalView; ! // If a SQL file has been generated for this model, this variable indicates ! // where to find it ! private String sqlFile; ! /** ! * Construct a new 'PhysicalModel' object ! * @param pName Nae of the model ! */ ! public PhysicalModel(String pName) ! { ! super(pName); ! } ! /** ! * Return the best possible filename for save ! * @return ! */ ! public String getBestFilename() ! { ! if (this.getFileForSave() == null) ! { ! return (new StringBuffer().append(this.getCode()) ! .append(".pdm")) ! .toString(); ! } ! else ! { ! return this.getFileForSave(); ! } ! } ! /** ! * Get the model view ! * @return ! */ ! public PhysicalView getPhysicalView() { return this.myPhysicalView; } ! /** ! * Get the list of tables in the model ! * @return ! */ ! public Vector getTables() { return this.tables; } ! /** ! * Get the list of constraints in the model ! * @return ! */ ! public Vector getConstraints() { return this.constraints; } ! /** ! * Get constraint(s) for the given table ! * @param t ! * @return ! */ ! public Vector getConstraints(Table t) ! { ! Vector cst = new Vector(); ! for (int i = 0; i < this.countConstraint(); i++) ! { ! if (this.getConstraintAt(i).getParentClass().equals(t)) ! { ! cst.addElement(this.getConstraintAt(i)); ! } ! } ! return cst; ! } ! /** ! * Get table for the given tableCode ! * @param pString ! * @return ! */ ! public Table getTableForId(String pString) ! { ! Table tmp=null; ! for (int i=0;i<getTables().size();i++) { ! if (this.getTableAt(i).getCode().equals(pString)) { ! tmp=(Table)this.tables.elementAt(i); ! } ! } ! return tmp; ! } ! /** ! * Return the table identified by the parameter in the list of tables. ! * @param at ! * @return ! */ ! public Table getTableAt(int at) ! { ! return (Table)this.tables.elementAt(at); ! } ! /** ! * Return the constraint identified by the parameter in the list ! * of constraints. ! * @param at ! * @return ! */ ! public Constraint getConstraintAt(int at) ! { ! return (Constraint)constraints.elementAt(at); ! } ! /** ! * Return the number of tables in the model ! * @return ! */ ! public int countTable() { return this.tables.size(); } ! /** ! * Return the number of constraint in the model ! * @return ! */ ! public int countConstraint () { return this.constraints.size(); } ! /** ! * Get the path for the SQL file generated from this model ! * @return ! */ ! public String getSqlFile() { return this.sqlFile; } ! /** ! * Set the path for the SQL file generated from this model ! * @param pSqlFile ! */ ! public void setSqlFile(String pSqlFile) { this.sqlFile = pSqlFile; } ! /** ! * Set the model view ! * @param pView ! */ ! public void setPhysicalView(PhysicalView pView) { this.myPhysicalView = pView; } ! /* ! * Conveniency method wich return all the objects in the models ! * in this models. -- OPTIMIZABLE, SUPPRESIBLE? ! */ ! public BaseObject[] getModel0bjects() { ! BaseObject[] baseObjects=new BaseObject[ tables.size() ! + getInheritanceLinks().size() ! + constraints.size() ! ]; ! int offset=0; ! for (int i = 0; i < tables.size(); i++) ! { ! baseObjects[offset]=getTableAt(i); ! offset++; ! } ! for (int i=0; i<getInheritanceLinks().size();i++) ! { ! baseObjects[offset]=getInheritanceLinkAt(i); ! offset++; ! } ! for (int i=0; i<constraints.size();i++) ! { ! baseObjects[offset]=getConstraintAt(i); ! offset++; ! } ! return baseObjects; ! } } --- 28,242 ---- + /** + * Physical model represent the database as it is. + * + *@see http://www.devaki.org/pdm.html + * @author efl...@de... + */ public class PhysicalModel extends BaseModel implements Serializable { ! /** ! * tables ! */ ! private Vector tables = new Vector(); + /** + * constraints + */ + private Vector constraints = new Vector(); ! /** ! * the model view ! */ ! private PhysicalView myPhysicalView; + /** + * If a SQL file has been generated for this model, this variable indicates + * where to find it + */ + private String sqlFile; ! /** ! * Construct a new 'PhysicalModel' object ! * @param pName Nae of the model ! */ ! public PhysicalModel(String pName) ! { ! super(pName); ! } ! /** ! * Return the best possible filename for save ! * @return filename ! */ ! public String getBestFilename() ! { ! if (this.getFileForSave() == null) ! { ! return (new StringBuffer().append(this.getCode()).append(".pdm")) ! .toString(); ! } else ! { ! return this.getFileForSave(); ! } ! } ! /** ! * Get the model view ! * @return model view ! */ ! public PhysicalView getPhysicalView() ! { ! return this.myPhysicalView; ! } ! /** ! * Get the list of tables in the model ! * @return tables ! */ ! public Vector getTables() ! { ! return this.tables; ! } ! /** ! * Get the list of constraints in the model ! * @return constraints ! */ ! public Vector getConstraints() ! { ! return this.constraints; ! } ! /** ! * Get constraint(s) for the given table ! * @param t the context table ! * @return vctConstraints ! */ ! public Vector getConstraints(Table t) ! { ! Vector cst = new Vector(); ! for (int i = 0; i < this.countConstraint(); i++) ! { ! if (this.getConstraintAt(i).getParentClass().equals(t)) ! { ! cst.addElement(this.getConstraintAt(i)); ! } ! } ! return cst; ! } ! /** ! * Get table for the given tableCode ! * @param pString the table code ! * @return table ! */ ! public Table getTableForId(String pString) ! { ! Table tmp = null; ! for (int i = 0; i < getTables().size(); i++) ! { ! if (this.getTableAt(i).getCode().equals(pString)) ! { ! tmp = (Table) this.tables.elementAt(i); ! } ! } ! return tmp; ! } ! /** ! * Return the table identified by the parameter in the list of tables. ! * @param at index ! * @return table ! */ ! public Table getTableAt(int at) ! { ! return (Table) this.tables.elementAt(at); ! } ! /** ! * Return the constraint identified by the parameter in the list ! * of constraints. ! * @param at index ! * @return constraint ! */ ! public Constraint getConstraintAt(int at) ! { ! return (Constraint) constraints.elementAt(at); ! } ! /** ! * Return the number of tables in the model ! * @return count ! */ ! public int countTable() ! { ! return this.tables.size(); ! } ! /** ! * Return the number of constraint in the model ! * @return count ! */ ! public int countConstraint() ! { ! return this.constraints.size(); ! } ! /** ! * Get the path for the SQL file generated from this model ! * @return filename ! */ ! public String getSqlFile() ! { ! return this.sqlFile; ! } ! /** ! * Set the path for the SQL file generated from this model ! * @param pSqlFile filename ! */ ! public void setSqlFile(String pSqlFile) ! { ! this.sqlFile = pSqlFile; ! } ! /** ! * Set the model view ! * @param pView the model view ! */ ! public void setPhysicalView(PhysicalView pView) ! { ! this.myPhysicalView = pView; ! } ! ! /** ! * Conveniency method wich return all the objects in the models ! * @return array of base objects ! */ ! public BaseObject[] getModelObjects() ! { ! ! BaseObject[] baseObjects = ! new BaseObject[tables.size() ! + getInheritanceLinks().size() ! + constraints.size()]; ! int offset = 0; ! for (int i = 0; i < tables.size(); i++) ! { ! baseObjects[offset] = getTableAt(i); ! offset++; ! } ! for (int i = 0; i < getInheritanceLinks().size(); i++) ! { ! baseObjects[offset] = getInheritanceLinkAt(i); ! offset++; ! } ! for (int i = 0; i < constraints.size(); i++) ! { ! baseObjects[offset] = getConstraintAt(i); ! offset++; ! } ! return baseObjects; ! } } |
From: <efl...@us...> - 2003-06-03 18:00:58
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util In directory sc8-pr-cvs1:/tmp/cvs-serv30142/src/org/devaki/nextobjects/util Modified Files: NOImageTransform.java Log Message: Made 'model' --> 'png image' work with new graphics. Index: NOImageTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/NOImageTransform.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NOImageTransform.java 2 Jun 2003 20:03:45 -0000 1.4 --- NOImageTransform.java 3 Jun 2003 18:00:54 -0000 1.5 *************** *** 78,83 **** --- 78,85 ---- tmp[j].getObjectView().getLocation().x - xOffset, tmp[j].getObjectView().getLocation().y - yOffset)); + tmp[j].getObjectView().resetSelectionPoint(); } } + } *************** *** 105,111 **** tmp[j].getObjectView().getLocation().x - xOffset, tmp[j].getObjectView().getLocation().y - yOffset)); } } ! System.out.println(xOffset + " -" + yOffset); } --- 107,114 ---- tmp[j].getObjectView().getLocation().x - xOffset, tmp[j].getObjectView().getLocation().y - yOffset)); + tmp[j].getObjectView().resetSelectionPoint(); } } ! pPDM.calculateRectangle(); } *************** *** 167,170 **** --- 170,174 ---- } translateModel(pCDM, -oldP.x, -oldP.y); + pCDM.getConceptualView().repaint(); return success; } *************** *** 206,209 **** --- 210,214 ---- // return to the old offset. translateModel(pPDM, -oldP.x, -oldP.y); + pPDM.getPhysicalView().repaint(); return success; |
From: <efl...@us...> - 2003-06-03 18:00:58
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv30142/src/org/devaki/nextobjects/workspace/models/graphics Modified Files: ConceptualView.java PhysicalView.java Log Message: Made 'model' --> 'png image' work with new graphics. Index: ConceptualView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConceptualView.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ConceptualView.java 2 Jun 2003 20:03:46 -0000 1.20 --- ConceptualView.java 3 Jun 2003 18:00:55 -0000 1.21 *************** *** 143,147 **** public Image makeImage(int x,int y) { - // collect our objects. Graphics2D big; BufferedImage bi2; --- 143,146 ---- Index: PhysicalView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/PhysicalView.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PhysicalView.java 2 Jun 2003 20:03:46 -0000 1.19 --- PhysicalView.java 3 Jun 2003 18:00:55 -0000 1.20 *************** *** 144,148 **** } ! public BufferedImage getImage() { // collect our objects. --- 144,148 ---- } ! public BufferedImage makeImage(int x,int y) { // collect our objects. *************** *** 151,164 **** Graphics2D bi2g; ! BaseObject[] tmp = myModel.getModel0bjects(); Rectangle rect; myModel.calculateRectangle(); rect = myModel.getRectangle(); ! ! bi = ! (BufferedImage) drawingArea.createImage( ! rect.width, ! rect.height); big = bi.createGraphics(); --- 151,163 ---- Graphics2D bi2g; ! BaseObject[] tmp = myModel.getModel0bjects(); Rectangle rect; myModel.calculateRectangle(); rect = myModel.getRectangle(); ! ! ! bi=(BufferedImage) drawingArea.createImage(rect.width,rect.height); ! big = bi.createGraphics(); *************** *** 179,186 **** if (d.height > 0 && d.width > 0) { ! bi2 = ! (BufferedImage) drawingArea.createImage( ! d.width, ! d.height); bi2g = bi2.createGraphics(); tmp[k].getObjectView().paint(bi2g); --- 178,182 ---- if (d.height > 0 && d.width > 0) { ! bi2 =(BufferedImage)drawingArea.createImage(d.width,d.height); bi2g = bi2.createGraphics(); tmp[k].getObjectView().paint(bi2g); *************** *** 201,205 **** // blank fill, clean ... super.paintComponent(g2); ! Rectangle area; BufferedImage bi2; Graphics2D bi2g; --- 197,201 ---- // blank fill, clean ... super.paintComponent(g2); ! //Rectangle area; BufferedImage bi2; Graphics2D bi2g; *************** *** 207,220 **** if (fullRefresh) { ! bi = getImage(); fullRefresh = false; } ! int a=myModel.getRectangle().x; ! int b=myModel.getRectangle().y; ! Point p=new Point(a,b); ! g2.drawImage(bi,p.x, p.y,this); ! ! ! // loop/paint selected objects objects toviewPort panel. for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) --- 203,212 ---- if (fullRefresh) { ! bi = (BufferedImage) makeImage(myModel.getRectangle().height,myModel.getRectangle().width); fullRefresh = false; } ! System.out.println(myModel.getRectangle()); ! g2.drawImage(bi,myModel.getRectangle().x, myModel.getRectangle().y,this); ! // loop/paint selected objects objects toviewPort panel. for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) *************** *** 250,258 **** } else { ! Graphics tmpClip =g2.create(p.x, ! p.y, getViewSize().width, getViewSize().height); - ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().paint(tmpClip); } ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().renderSelected(g); --- 242,249 ---- } else { ! Graphics tmpClip =g2.create(myModel.getRectangle().x, ! myModel.getRectangle().y, getViewSize().width, getViewSize().height); } ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().renderSelected(g); |
From: <efl...@us...> - 2003-06-02 20:03:50
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv28736/src/org/devaki/nextobjects/workspace/models/graphics Modified Files: AssociationLinkView.java ClassView.java ConceptualView.java ConstraintView.java InheritanceLinkView.java PhysicalView.java Log Message: made model -> png about to work again + checkstyleS Index: AssociationLinkView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/AssociationLinkView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AssociationLinkView.java 31 May 2003 11:48:34 -0000 1.3 --- AssociationLinkView.java 2 Jun 2003 20:03:46 -0000 1.4 *************** *** 101,105 **** public void paint(Graphics g) { ! Point p0=((ConceptualView)this.myObject.getMyModel().getPanel()).jScrollPane.getViewport().getViewPosition(); Point p1=selectionPoints[0].getPoint(); --- 101,105 ---- public void paint(Graphics g) { ! Point p0=myObject.getMyModel().getRectangle().getLocation(); Point p1=selectionPoints[0].getPoint(); Index: ClassView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ClassView.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ClassView.java 31 May 2003 11:48:34 -0000 1.9 --- ClassView.java 2 Jun 2003 20:03:46 -0000 1.10 *************** *** 53,57 **** * old rectangle */ ! public Rectangle oldRectangle = new Rectangle(); /** --- 53,57 ---- * old rectangle */ ! protected Rectangle oldRectangle = new Rectangle(); /** Index: ConceptualView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConceptualView.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ConceptualView.java 31 May 2003 13:42:35 -0000 1.19 --- ConceptualView.java 2 Jun 2003 20:03:46 -0000 1.20 *************** *** 53,56 **** --- 53,57 ---- import org.devaki.nextobjects.workspace.models.objects.Entity; import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; + import java.awt.Image; /** *************** *** 108,113 **** * full drawing refresh */ ! private boolean fullRefresh = true; ! /** * The buffered image --- 109,114 ---- * full drawing refresh */ ! private boolean fullRefresh = false; ! /** * The buffered image *************** *** 129,133 **** this.setLayout(new BorderLayout()); // Construct the drawing area ! this.drawingArea = new JPanel() { /** --- 130,134 ---- this.setLayout(new BorderLayout()); // Construct the drawing area ! drawingArea = new JPanel() { /** *************** *** 139,220 **** update(g); } - public void update(Graphics g) - { - Graphics2D g2 = (Graphics2D) g; - //super.paint(g); // blank fill, clean ... - super.paintComponent(g2); - Rectangle area; ! BufferedImage bi2; Graphics2D big; Graphics2D bi2g; ! if (fullRefresh) ! { ! // collect our objects. ! BaseObject[] tmp = myModel.getModel0bjects(); ! Rectangle rect = jScrollPane.getViewportBorderBounds(); ! bi = ! (BufferedImage) drawingArea.createImage( ! rect.width, ! rect.height); ! big = bi.createGraphics(); ! big.setColor(Color.WHITE); ! big.fillRect(0, 0, rect.width, rect.height); ! for (int k = 0; k < tmp.length; k++) ! { ! // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getObjectView().getSize(); ! Point l = tmp[k].getObjectView().getLocation(); ! if (tmp[k].getObjectView() instanceof LineView) { ! tmp[k].getObjectView().paint(big); ! } else ! { // classview ?! ! if (d.height > 0 && d.width > 0) ! { ! bi2 = ! (BufferedImage) drawingArea.createImage( ! d.width, ! d.height); ! bi2g = bi2.createGraphics(); ! tmp[k].getObjectView().paint(bi2g); ! big.drawImage( ! bi2, ! l.x ! - ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX()), ! l.y ! - ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY()), ! this); ! } } } - fullRefresh = false; } ! if (bi != null) { ! g2.drawImage( ! bi, ! (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX(), ! (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY(), ! this); } // loop/paint selected objects objects toviewPort panel. for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) --- 140,209 ---- update(g); } ! public Image makeImage(int x,int y) ! { ! // collect our objects. Graphics2D big; + BufferedImage bi2; Graphics2D bi2g; ! BaseObject[] tmp = myModel.getModel0bjects(); ! Rectangle rect; ! myModel.calculateRectangle(); ! rect = myModel.getRectangle(); ! ! ! bi=(BufferedImage) drawingArea.createImage(rect.width,rect.height); ! big = bi.createGraphics(); ! big.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ! big.fillRect(0, 0, rect.width, rect.height); ! for (int k = 0; k < tmp.length; k++) ! { ! // Clears the rectangle that was previously drawn. ! Dimension d = tmp[k].getObjectView().getSize(); ! Point l = tmp[k].getObjectView().getLocation(); ! ! if (tmp[k].getObjectView() instanceof LineView) ! { ! tmp[k].getObjectView().paint(big); ! } else ! { // classview ?! ! if (d.height > 0 && d.width > 0) { ! bi2 =(BufferedImage)drawingArea.createImage(d.width,d.height); ! bi2g = bi2.createGraphics(); ! tmp[k].getObjectView().paint(bi2g); ! big.drawImage( ! bi2, ! l.x - myModel.getRectangle().x, ! l.y - myModel.getRectangle().y, ! this); } } } ! return bi; ! } ! ! public void update(Graphics g) ! { ! Graphics2D g2 = (Graphics2D) g; ! // blank fill, clean ... ! super.paintComponent(g2); ! //Rectangle area; ! BufferedImage bi2; ! Graphics2D bi2g; ! ! if (fullRefresh) { ! bi = (BufferedImage) makeImage(myModel.getRectangle().height,myModel.getRectangle().width); ! fullRefresh = false; } + g2.drawImage(bi,myModel.getRectangle().x, myModel.getRectangle().y,this); + // loop/paint selected objects objects toviewPort panel. for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) *************** *** 230,241 **** if (tmpObjectView instanceof ClassView) { ! g2.setColor(Color.WHITE); ! Rectangle r = ! ((ClassView) tmpObjectView).getOldrectangle(); g2.fillRect(r.x, r.y, r.width, r.height); ! bi2 = ! (BufferedImage) drawingArea.createImage( ! d2.width, ! d2.height); bi2g = bi2.createGraphics(); tmpObjectView.paint(bi2g); --- 219,226 ---- if (tmpObjectView instanceof ClassView) { ! g2.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ! Rectangle r =((ClassView) tmpObjectView).getOldrectangle(); g2.fillRect(r.x, r.y, r.width, r.height); ! bi2 =(BufferedImage) jScrollPane.createImage( d2.width, d2.height); bi2g = bi2.createGraphics(); tmpObjectView.paint(bi2g); *************** *** 250,283 **** } else { ! ! Graphics tmpClip = ! g2.create( ! ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX()), ! ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY()), ! ((int) jScrollPane ! .getViewport() ! .getViewSize() ! .width), ! ((int) jScrollPane ! .getViewport() ! .getViewSize() ! .height)); ! ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView() ! .paint( ! tmpClip); } ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)) ! .getObjectView() ! .renderSelected(g); } } --- 235,245 ---- } else { ! Graphics tmpClip =g2.create(myModel.getRectangle().x, ! myModel.getRectangle().y, ! getViewSize().width, ! getViewSize().height); ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().paint(tmpClip); } ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().renderSelected(g); } } *************** *** 287,296 **** this.drawingArea.setPreferredSize(CstGraphics.MODEL_DIMENSION); ! /** Listeners **/ // Mouse Listeners this.drawingArea.addMouseListener(new MyMouseListener()); this.drawingArea.addMouseMotionListener(new MyMouseMotionListener()); ! /** Assembling components **/ this.jScrollPane = new JScrollPane(this.drawingArea); jScrollPane.getViewport().setBackground( --- 249,258 ---- this.drawingArea.setPreferredSize(CstGraphics.MODEL_DIMENSION); ! /* Listeners **/ // Mouse Listeners this.drawingArea.addMouseListener(new MyMouseListener()); this.drawingArea.addMouseMotionListener(new MyMouseMotionListener()); ! /* Assembling components **/ this.jScrollPane = new JScrollPane(this.drawingArea); jScrollPane.getViewport().setBackground( *************** *** 299,302 **** --- 261,265 ---- //will update the buffered image in case viewport have changed. + // used at least at init this.jScrollPane.getViewport().addChangeListener(new ChangeListener() { *************** *** 306,310 **** } }); - /** Extra **/ // Initialize scrolling position --- 269,272 ---- *************** *** 313,316 **** --- 275,279 ---- } + /** * Manage the drawing of an AssociationLink (Drag'n Drop operations) *************** *** 528,531 **** --- 491,495 ---- { fullRefresh = true; + myModel.calculateRectangle(); x2 = e.getX(); y2 = e.getY(); *************** *** 823,827 **** { // Draw a line between the currently dragged object ! ptrGphx2D.setColor(Color.WHITE); ptrGphx2D.fillRect( Math.min(x1, x2), --- 787,791 ---- { // Draw a line between the currently dragged object ! ptrGphx2D.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ptrGphx2D.fillRect( Math.min(x1, x2), *************** *** 842,855 **** x2 + e.getComponent().getX() ! + (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX(), y2 + e.getComponent().getY() ! + (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY())) { // Verify that the targeted object is not equal to the dragged --- 806,813 ---- x2 + e.getComponent().getX() ! + getViewPosition().x, y2 + e.getComponent().getY() ! + getViewPosition().y)) { // Verify that the targeted object is not equal to the dragged *************** *** 880,895 **** .getSurface() .contains( ! x2 ! + e.getComponent().getX() ! + (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX(), ! y2 ! + e.getComponent().getY() ! + (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY())) { // Verify that the targeted object is not equal to the dragged --- 838,844 ---- .getSurface() .contains( ! x2+ e.getComponent().getX() ! + getViewPosition().x, ! y2+e.getComponent().getY()+getViewPosition().y)) { // Verify that the targeted object is not equal to the dragged *************** *** 973,978 **** } } - } } --- 922,980 ---- } } } + } + + + + /** + * Set if to refresh the drawing at next paint + * @param b full refresh + */ + public void setFullRefresh(boolean b) + { + fullRefresh = b; + } + + /** + * Location of the view position + * @return the point + */ + public Point getViewPosition() + { + return jScrollPane.getViewport().getViewPosition(); + } + + /** + * return the view size + * @return the location + */ + public Dimension getViewSize() + { + return jScrollPane.getViewport().getViewSize(); + } + + /** + * Set the view position + * @param point the location + */ + public void setViewPosition(Point point) + { + jScrollPane.getViewport().setViewPosition(point); + } + /** + * Get the visible rectangle + * @return the rectangle + */ + public Rectangle getViewRect() + { + return jScrollPane.getViewport().getViewRect(); + } + /** + * set the dimension + * @param d the dimension + */ + public void setViewSize(Dimension d) + { + jScrollPane.getViewport().setViewSize(d); } Index: ConstraintView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConstraintView.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ConstraintView.java 31 May 2003 11:48:34 -0000 1.7 --- ConstraintView.java 2 Jun 2003 20:03:46 -0000 1.8 *************** *** 76,80 **** { ! Point p0=((PhysicalView)this.myObject.getMyModel().getPanel()).jScrollPane.getViewport().getViewPosition(); Point p1=selectionPoints[0].getPoint(); --- 76,80 ---- { ! Point p0=this.myObject.getMyModel().getRectangle().getLocation(); Point p1=selectionPoints[0].getPoint(); Index: InheritanceLinkView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/InheritanceLinkView.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** InheritanceLinkView.java 31 May 2003 11:48:34 -0000 1.6 --- InheritanceLinkView.java 2 Jun 2003 20:03:46 -0000 1.7 *************** *** 68,76 **** { ! Point p0 = ! ((ConceptualView) this.myObject.getMyModel().getPanel()) ! .jScrollPane ! .getViewport() ! .getViewPosition(); Point p1 = selectionPoints[0].getPoint(); --- 68,72 ---- { ! Point p0 =myObject.getMyModel().getRectangle().getLocation(); Point p1 = selectionPoints[0].getPoint(); *************** *** 87,91 **** g.setColor(this.myStyle.getLineColor()); ! // calculate parralle lines double angle = Math.atan2(y2 - y1, x2 - x1) + Math.PI; int x5 = (int) (x1 + Math.cos(angle - theta) * size / 2); --- 83,87 ---- g.setColor(this.myStyle.getLineColor()); ! // calculate parrallels double angle = Math.atan2(y2 - y1, x2 - x1) + Math.PI; int x5 = (int) (x1 + Math.cos(angle - theta) * size / 2); *************** *** 103,107 **** // calculate points for arrowhead - x3 = (int) (x2 + Math.cos(angle - theta) * size); y3 = (int) (y2 + Math.sin(angle - theta) * size); --- 99,102 ---- Index: PhysicalView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/PhysicalView.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** PhysicalView.java 31 May 2003 13:42:35 -0000 1.18 --- PhysicalView.java 2 Jun 2003 20:03:46 -0000 1.19 *************** *** 54,57 **** --- 54,58 ---- import org.devaki.nextobjects.workspace.models.objects.InheritanceLink; + /** * Main class for drawing Physical Data Models *************** *** 96,100 **** * the context model */ ! transient private PhysicalModel myModel; /** --- 97,101 ---- * the context model */ ! private PhysicalModel myModel; /** *************** *** 134,158 **** drawingArea = new JPanel() { ! public void paint(Graphics g) ! { ! update(g); ! } ! public void update(Graphics g) ! { ! Rectangle area; ! BufferedImage bi2; ! Graphics2D big; ! Graphics2D bi2g; ! ! Graphics2D g2 = (Graphics2D) g; ! //super.paint(g); // blank fill, clean ... ! super.paintComponent(g2); ! if (fullRefresh) { // collect our objects. BaseObject[] tmp = myModel.getModel0bjects(); ! Rectangle rect = jScrollPane.getViewportBorderBounds(); bi = (BufferedImage) drawingArea.createImage( --- 135,160 ---- drawingArea = new JPanel() { ! /** ! * Draw all components ! * @param g the graphics ! */ ! public void paint(Graphics g) ! { ! update(g); ! } ! public BufferedImage getImage() { // collect our objects. + Graphics2D big; + BufferedImage bi2; + Graphics2D bi2g; + BaseObject[] tmp = myModel.getModel0bjects(); ! Rectangle rect; ! myModel.calculateRectangle(); ! rect = myModel.getRectangle(); ! bi = (BufferedImage) drawingArea.createImage( *************** *** 161,165 **** big = bi.createGraphics(); ! big.setColor(Color.WHITE); big.fillRect(0, 0, rect.width, rect.height); --- 163,167 ---- big = bi.createGraphics(); ! big.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); big.fillRect(0, 0, rect.width, rect.height); *************** *** 185,284 **** big.drawImage( bi2, ! l.x ! - ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX()), ! l.y ! - ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY()), this); } } } ! fullRefresh = false; ! } ! if (bi != null) ! { ! g2.drawImage( ! bi, ! (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX(), ! (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY(), ! this); } ! // loop/paint selected objects objects toviewPort panel. ! for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) { ! ObjectView tmpObjectView = ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView(); ! Dimension d2 = tmpObjectView.getSize(); ! Point p2 = tmpObjectView.getLocation(); ! if (tmpObjectView instanceof ClassView) { ! g2.setColor(Color.WHITE); ! Rectangle r = ! ((ClassView) tmpObjectView).getOldrectangle(); ! g2.fillRect(r.x, r.y, r.width, r.height); ! bi2 = ! (BufferedImage) drawingArea.createImage( ! d2.width, ! d2.height); ! bi2g = bi2.createGraphics(); ! tmpObjectView.paint(bi2g); ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView() ! .paint( ! bi2g); ! g2.drawImage(bi2, p2.x, p2.y, this); ! } else { ! Graphics tmpClip = ! g2.create( ! ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX()), ! ((int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY()), ! ((int) jScrollPane ! .getViewport() ! .getViewSize() ! .width), ! ((int) jScrollPane ! .getViewport() ! .getViewSize() ! .height)); ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView() ! .paint( ! tmpClip); } - ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)) - .getObjectView() - .renderSelected(g); } - } - }; // Define the color of the background --- 187,262 ---- big.drawImage( bi2, ! l.x - myModel.getRectangle().x, ! l.y - myModel.getRectangle().y, this); } } } ! return bi; } ! ! public void update(Graphics g) { ! Graphics2D g2 = (Graphics2D) g; ! // blank fill, clean ... ! super.paintComponent(g2); ! Rectangle area; ! BufferedImage bi2; ! Graphics2D bi2g; ! if (fullRefresh) { ! bi = getImage(); ! fullRefresh = false; ! } ! int a=myModel.getRectangle().x; ! int b=myModel.getRectangle().y; ! Point p=new Point(a,b); ! g2.drawImage(bi,p.x, p.y,this); ! ! ! // loop/paint selected objects objects toviewPort panel. ! for (int j = 0; j < ModelMan.getCurrentObjects().size(); j++) { + ObjectView tmpObjectView = + ((BaseObject) ModelMan + .getCurrentObjects() + .elementAt(j)) + .getObjectView(); + Dimension d2 = tmpObjectView.getSize(); + Point p2 = tmpObjectView.getLocation(); ! if (tmpObjectView instanceof ClassView) ! { ! g2.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ! Rectangle r = ! ((ClassView) tmpObjectView).getOldrectangle(); ! g2.fillRect(r.x, r.y, r.width, r.height); ! bi2 = ! (BufferedImage) drawingArea.createImage( ! d2.width, ! d2.height); ! bi2g = bi2.createGraphics(); ! tmpObjectView.paint(bi2g); ! ((BaseObject) ModelMan ! .getCurrentObjects() ! .elementAt(j)) ! .getObjectView() ! .paint( ! bi2g); ! g2.drawImage(bi2, p2.x, p2.y, this); ! } else ! { ! Graphics tmpClip =g2.create(p.x, ! p.y, ! getViewSize().width, ! getViewSize().height); ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().paint(tmpClip); ! } ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(j)).getObjectView().renderSelected(g); } } }; // Define the color of the background *************** *** 286,299 **** this.drawingArea.setPreferredSize(CstGraphics.MODEL_DIMENSION); - /** Listeners **/ // Mouse Listeners this.drawingArea.addMouseListener(new MyMouseListener()); this.drawingArea.addMouseMotionListener(new MyMouseMotionListener()); ! /** Assembling components **/ this.jScrollPane = new JScrollPane(this.drawingArea); this.add(jScrollPane, BorderLayout.CENTER); - /** Extra **/ // Initialize scrolling position jScrollPane.getViewport().setViewPosition( --- 264,275 ---- this.drawingArea.setPreferredSize(CstGraphics.MODEL_DIMENSION); // Mouse Listeners this.drawingArea.addMouseListener(new MyMouseListener()); this.drawingArea.addMouseMotionListener(new MyMouseMotionListener()); ! // Assembling components this.jScrollPane = new JScrollPane(this.drawingArea); this.add(jScrollPane, BorderLayout.CENTER); // Initialize scrolling position jScrollPane.getViewport().setViewPosition( *************** *** 431,435 **** newInheritanceLink); } - repaint(); } } --- 407,410 ---- *************** *** 437,440 **** --- 412,416 ---- ModelMan.setDraggedObject(null); ModelMan.setDropTargetObject(null); + drawingArea.repaint(); } *************** *** 544,547 **** --- 520,524 ---- { fullRefresh = true; + myModel.calculateRectangle(); x2 = e.getX(); y2 = e.getY(); *************** *** 846,850 **** { // Draw a line between the currently dragged object ! ptrGphx2D.setColor(Color.WHITE); ptrGphx2D.fillRect( Math.min(x1, x2), --- 823,827 ---- { // Draw a line between the currently dragged object ! ptrGphx2D.setColor(CstGraphics.MODEL_BACKGROUND_COLOR); ptrGphx2D.fillRect( Math.min(x1, x2), *************** *** 880,895 **** } // Refresh the drawing area ! if (ModelMan.getCurrentObject() != null) ! { ! // this could be set somewhere else. ! ptrGphx2D.setClip(jScrollPane.getViewport().getViewRect()); ! for (int i = 0; i < ModelMan.getCurrentObjects().size(); i++) ! { ! ((BaseObject) ModelMan.getCurrentObjects().elementAt(i)) ! .getObjectView() ! .paint( ! ptrGphx2D); ! } ! } } --- 857,861 ---- } // Refresh the drawing area ! drawingArea.repaint(); } *************** *** 948,950 **** --- 914,935 ---- } } + + + /** + * set if refresh rectangle / drawing + * @param b refresh + */ + public void setFullRefresh(boolean b) + { + fullRefresh = b; + } + /** + * return the view size + * @return the location + */ + public Dimension getViewSize() + { + return jScrollPane.getViewport().getViewSize(); + } + } |
From: <efl...@us...> - 2003-06-02 20:03:49
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects In directory sc8-pr-cvs1:/tmp/cvs-serv28736 Modified Files: build.xml Log Message: made model -> png about to work again + checkstyleS Index: build.xml =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** build.xml 31 May 2003 11:48:33 -0000 1.11 --- build.xml 2 Jun 2003 20:03:44 -0000 1.12 *************** *** 199,203 **** <target name="run" depends="jar" description="Run devaki's nextobjects"> ! <exec dir="." executable="./nextobjects" os="Linux"> <arg line=""/> </exec> --- 199,203 ---- <target name="run" depends="jar" description="Run devaki's nextobjects"> ! <exec dir="." executable="/opt/nextobjects/nextobjects/nextobjects/nextobjects" os="Linux"> <arg line=""/> </exec> |
From: <efl...@us...> - 2003-06-02 20:03:49
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects In directory sc8-pr-cvs1:/tmp/cvs-serv28736/src/org/devaki/nextobjects Modified Files: NextObjects.java Log Message: made model -> png about to work again + checkstyleS Index: NextObjects.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/NextObjects.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NextObjects.java 28 May 2003 21:48:27 -0000 1.12 --- NextObjects.java 2 Jun 2003 20:03:45 -0000 1.13 *************** *** 21,25 **** package org.devaki.nextobjects; - import java.awt.FlowLayout; import java.awt.GridBagConstraints; --- 21,24 ---- *************** *** 50,54 **** import org.devaki.nextobjects.ui.workspace.models.objects.DataDictionaryEdit; - /* * devaki-nextobjects is an Integrated Development Tool for Entreprise Applications. --- 49,52 ---- *************** *** 59,309 **** */ public class NextObjects extends JFrame { ! /* ! * Reference to the instantiated 'NextObjects' object ! */ ! ! private static NextObjects nextObjects; ! ! /* ! * Logger ! */ ! private static Category logger ! = Logger.getInstance(NextObjects.class.getName()); ! /* ! * Components ! */ ! private static JLabel jLabelStatus = new JLabel(" "); ! /* ! * Components ! */ ! private NOMenuBar menuBar = new NOMenuBar(); ! /* ! * Components ! */ ! private NOToolBar1 toolBar1 = new NOToolBar1(); ! /* ! * Components ! */ ! private NOToolBar2 toolBar2 = new NOToolBar2(); ! // Panels ! private CustomSplitPane jSplitPane1 = ! new CustomSplitPane(JSplitPane.HORIZONTAL_SPLIT, 220); ! /* * Components */ ! private CustomSplitPane jSplitPane2 = ! new CustomSplitPane(JSplitPane.VERTICAL_SPLIT, 0); ! /* * Components */ ! private JPanel jPanelStatusBar = new JPanel(new GridBagLayout()); ! ! /* ! * Thetabbedpane ! */ ! public NOWorkspace nOWorkspace; ! /* ! * The treeview ! */ ! public static DataDictionaryEdit dataDictionaryEdit; ! /* ! * Component spl ! */ ! static SplashScreen splash; ! /* ! * Construct a new 'NextObjects' object ! */ ! public NextObjects() ! { ! super("nextObjects "); ! /** Initialization **/ ! // Initiliaze the local reference of the object ! nextObjects = this; ! // Load the preferences for the current user ! splash.jProgressBar1.setString("Loading properties"); ! NOTools nOTools = new NOTools(); ! splash.jProgressBar1.setValue(5); ! //panel & logging. ! splash.jProgressBar1.setString("Loading logger"); ! NOLog noLog = new NOLog(); ! splash.jProgressBar1.setValue(10); ! splash.jProgressBar1.setString("Loading Data Dictionary"); ! dataDictionaryEdit = new DataDictionaryEdit(); ! splash.jProgressBar1.setValue(15); ! // Define what to do when closing this window ! this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! // Set icon for nextObjects ! this.setIconImage(Toolkit.getDefaultToolkit().getImage(org.devaki.nextobjects.NextObjects.class.getResource( ! "/org/devaki/nextobjects/icons/icon.png"))); ! // Set size ! int w=640; ! int h=480; ! try { ! w=Integer.parseInt(NOTools.NO_PROPS.getProperty("width")); ! h=Integer.parseInt(NOTools.NO_PROPS.getProperty("heigth")); ! } catch (Exception e) { ! w=640; ! h=480; ! logger.error("Setting default window size."); ! } ! if (w<10 || h< 10) { h=480; w=480; } ! this.setSize(w,h); ! ! // Create the ModelMan object ! splash.jProgressBar1.setString("Loading Model Manager"); ! ModelMan modelMan = new ModelMan(); ! splash.jProgressBar1.setValue(25); ! // Instantiate static EditorFactory ! splash.jProgressBar1.setString("Loading Object's Editors"); ! EditorFactory editorFactory = new EditorFactory(); ! splash.jProgressBar1.setValue(50); ! // Create the InitHome object ! splash.jProgressBar1.setString("Checking User Installation"); ! InitHome initHome = new InitHome(); ! splash.jProgressBar1.setValue(60); ! initHome.checkForTorque(); ! // Dereference the 'InitHome' object in order it to be garbage collected ! initHome = null; ! /** Components **/ ! // PANELS ! // Define a grid bag layout for the main panel ! this.getContentPane().setLayout(new GridBagLayout()); ! // Set divider location of the horizontal split panel ! jSplitPane2.setDividerLocation((int)this.getSize().getHeight() - 220); ! /** Listeners **/ ! // WINDOW ! this.addWindowListener(new WindowAdapter() ! { ! // Define what to do when closing nextObjects ! public void windowClosing(WindowEvent evt) { ModelMan.goodbye(); } ! }); ! /** Assembling components **/ ! // Define the nextObjects menu bar ! splash.jProgressBar1.setString("Building Menu Bars"); ! this.setJMenuBar(this.menuBar); ! splash.jProgressBar1.setValue(70); ! // 'jSplitPane1' ! splash.jProgressBar1.setString("Building Tree View"); ! this.jSplitPane1.setLeftComponent(new NOTreeView()); ! splash.jProgressBar1.setValue(80); ! splash.jProgressBar1.setString("Building Workspace"); ! nOWorkspace= new NOWorkspace(); ! this.jSplitPane1.setRightComponent(nOWorkspace); ! splash.jProgressBar1.setValue(90); ! splash.jProgressBar1.setString("Building Toolbars"); ! // 'jSplitPane2' ! this.jSplitPane2.setTopComponent(this.jSplitPane1); ! this.jSplitPane2.setBottomComponent(noLog); ! // 'jPanelStatusBar' ! this.jPanelStatusBar.add(jLabelStatus, ! new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.HORIZONTAL, ! new Insets(0, 0, 0, 0), 0, 0)); ! // Content Panel ! JPanel toolbarPanel=new JPanel(); ! toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); ! toolbarPanel.add(toolBar1); ! toolbarPanel.add(toolBar2); ! this.getContentPane().add(toolbarPanel, ! new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.HORIZONTAL, ! new Insets(0, 0, 0, 0), 0, 0)); ! this.getContentPane().add(this.jSplitPane2, ! new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.BOTH, ! new Insets(0, 0, 0, 0), 0, 0)); ! this.getContentPane().add(this.jPanelStatusBar, ! new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.HORIZONTAL, ! new Insets(0, 0, 0, 0), 0, 0)); ! NOToolBar1.fixIcons(); ! //SwingUtilities.updateComponentTreeUI(this); ! splash.jProgressBar1.setString("Done"); ! splash.jProgressBar1.setValue(98); ! this.setVisible(true); ! System.gc(); ! logger.info(" _"); ! logger.info("| \\ , _Nextobjects_ O"); ! logger.info("| ] | -_) v / _| |//| |"); ! logger.info("|__/ \\__|\\_/\\__|_|\\\\|_|"); ! splash.jProgressBar1.setValue(100); ! } // End of 'NextObjects()' ! /** ! * main function : nextObjects launcher ! * @param args Arguments passed to the launcher ! */ ! public static void main(String [] args) ! { ! // Create the 'SplashScreen' object ! splash = new SplashScreen(); ! // Make the splash appear ! splash.setVisible(true); ! // Create the 'NextObjects' object and make it appear ! new NextObjects(); ! // Make the splash screen disappear ! splash.setVisible(false); ! // Prepare the splash screen memory range to be garbage collected ! // by dereferencing the 'SplashScreen' object ! splash = null; ! } // End of 'main' ! /** ! * Return a reference to the 'NextObjects' object ! * @return The 'NextObjects' object ! */ ! public static NextObjects getReference() { return nextObjects; } ! /** ! * Return a reference to the 'NextObjects' object ! * @return The 'NextObjects' object ! */ ! public static DataDictionaryEdit getDataDictionaryEdit() ! { ! return dataDictionaryEdit; ! } ! /** ! * Change the text in the status bar ! * @param text Text to display ! */ ! public static void setStatusBarText(String text) ! { ! jLabelStatus.setText(text); ! } } --- 57,365 ---- */ + /** + * Nextobjects is an Integrated Development Tool for Entreprise Applications. + * Nextobjects will help you choose database structure from system analysis + * and design, down to generating strongly designed data layer Object Model. + * + * @author efl...@de... + */ public class NextObjects extends JFrame { ! /** ! * Reference to the instantiated 'NextObjects' object ! */ ! private static NextObjects nextObjects; ! /** ! * Logger ! */ ! private static Category logger = ! Logger.getInstance(NextObjects.class.getName()); ! ! /** ! * Component ! */ ! private static JLabel jLabelStatus = new JLabel(" "); ! /** * Components */ ! private NOMenuBar menuBar = new NOMenuBar(); ! ! /** * Components */ ! private NOToolBar1 toolBar1 = new NOToolBar1(); ! /** ! * Components ! */ ! private NOToolBar2 toolBar2 = new NOToolBar2(); ! /** ! * Components ! */ ! private CustomSplitPane jSplitPane1 = ! new CustomSplitPane(JSplitPane.HORIZONTAL_SPLIT, 220); ! /** ! * Components ! */ ! private CustomSplitPane jSplitPane2 = ! new CustomSplitPane(JSplitPane.VERTICAL_SPLIT, 0); ! /** ! * Components ! */ ! private JPanel jPanelStatusBar = new JPanel(new GridBagLayout()); ! /** ! * Thetabbedpane ! */ ! public NOWorkspace nOWorkspace; + /** + * The treeview + */ + public static DataDictionaryEdit dataDictionaryEdit; ! /** ! * Component spl ! */ ! private static SplashScreen splash; ! /** ! * Construct a new 'NextObjects' object ! */ ! public NextObjects() ! { ! super("nextObjects "); ! /** Initialization **/ ! // Initiliaze the local reference of the object ! nextObjects = this; ! // Load the preferences for the current user ! splash.jProgressBar1.setString("Loading properties"); ! NOTools nOTools = new NOTools(); ! splash.jProgressBar1.setValue(5); ! //panel & logging. ! splash.jProgressBar1.setString("Loading logger"); ! NOLog noLog = new NOLog(); ! splash.jProgressBar1.setValue(10); ! splash.jProgressBar1.setString("Loading Data Dictionary"); ! dataDictionaryEdit = new DataDictionaryEdit(); ! splash.jProgressBar1.setValue(15); ! // Define what to do when closing this window ! this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); ! // Set icon for nextObjects ! this.setIconImage( ! Toolkit.getDefaultToolkit().getImage( ! org.devaki.nextobjects.NextObjects.class.getResource( ! "/org/devaki/nextobjects/icons/icon.png"))); ! // Set size ! int w = 640; ! int h = 480; ! try ! { ! w = Integer.parseInt(NOTools.NO_PROPS.getProperty("width")); ! h = Integer.parseInt(NOTools.NO_PROPS.getProperty("heigth")); ! } catch (Exception e) ! { ! w = 640; ! h = 480; ! logger.error("Setting default window size."); ! } ! if (w < 10 || h < 10) ! { ! h = 480; ! w = 480; ! } ! this.setSize(w, h); ! // Create the ModelMan object ! splash.jProgressBar1.setString("Loading Model Manager"); ! ModelMan modelMan = new ModelMan(); ! splash.jProgressBar1.setValue(25); ! // Instantiate static EditorFactory ! splash.jProgressBar1.setString("Loading Object's Editors"); ! EditorFactory editorFactory = new EditorFactory(); ! splash.jProgressBar1.setValue(50); ! // Create the InitHome object ! splash.jProgressBar1.setString("Checking User Installation"); ! InitHome initHome = new InitHome(); ! splash.jProgressBar1.setValue(60); ! initHome.checkForTorque(); ! // Dereference the 'InitHome' object in order it to be garbage collected ! initHome = null; ! /** Components **/ ! // PANELS ! // Define a grid bag layout for the main panel ! this.getContentPane().setLayout(new GridBagLayout()); ! // Set divider location of the horizontal split panel ! jSplitPane2.setDividerLocation((int) this.getSize().getHeight() - 220); ! /** Listeners **/ ! // WINDOW ! this.addWindowListener(new WindowAdapter() ! { ! // Define what to do when closing nextObjects ! public void windowClosing(WindowEvent evt) ! { ! ModelMan.goodbye(); ! } ! }); ! /** Assembling components **/ + // Define the nextObjects menu bar + splash.jProgressBar1.setString("Building Menu Bars"); + this.setJMenuBar(this.menuBar); + splash.jProgressBar1.setValue(70); + // 'jSplitPane1' + splash.jProgressBar1.setString("Building Tree View"); + this.jSplitPane1.setLeftComponent(new NOTreeView()); + splash.jProgressBar1.setValue(80); + splash.jProgressBar1.setString("Building Workspace"); + nOWorkspace = new NOWorkspace(); + this.jSplitPane1.setRightComponent(nOWorkspace); + splash.jProgressBar1.setValue(90); + splash.jProgressBar1.setString("Building Toolbars"); + // 'jSplitPane2' + this.jSplitPane2.setTopComponent(this.jSplitPane1); + this.jSplitPane2.setBottomComponent(noLog); + // 'jPanelStatusBar' + this.jPanelStatusBar.add( + jLabelStatus, + new GridBagConstraints( + 0, + 0, + 1, + 1, + 1.0, + 0.0, + GridBagConstraints.CENTER, + GridBagConstraints.HORIZONTAL, + new Insets(0, 0, 0, 0), + 0, + 0)); ! // Content Panel ! JPanel toolbarPanel = new JPanel(); ! toolbarPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); ! toolbarPanel.add(toolBar1); ! toolbarPanel.add(toolBar2); ! this.getContentPane().add( ! toolbarPanel, ! new GridBagConstraints( ! 0, ! 0, ! 1, ! 1, ! 1.0, ! 0.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.HORIZONTAL, ! new Insets(0, 0, 0, 0), ! 0, ! 0)); ! this.getContentPane().add( ! this.jSplitPane2, ! new GridBagConstraints( ! 0, ! 1, ! 1, ! 1, ! 1.0, ! 1.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.BOTH, ! new Insets(0, 0, 0, 0), ! 0, ! 0)); ! this.getContentPane().add( ! this.jPanelStatusBar, ! new GridBagConstraints( ! 0, ! 2, ! 1, ! 1, ! 0.0, ! 0.0, ! GridBagConstraints.CENTER, ! GridBagConstraints.HORIZONTAL, ! new Insets(0, 0, 0, 0), ! 0, ! 0)); ! NOToolBar1.fixIcons(); ! //SwingUtilities.updateComponentTreeUI(this); ! splash.jProgressBar1.setString("Done"); ! splash.jProgressBar1.setValue(98); ! this.setVisible(true); ! System.gc(); ! logger.info(" _"); ! logger.info("| \\ , _Nextobjects_ O"); ! logger.info("| ] | -_) v / _| |//| |"); ! logger.info("|__/ \\__|\\_/\\__|_|\\\\|_|"); ! splash.jProgressBar1.setValue(100); ! } // End of 'NextObjects()' ! /** ! * main function : nextObjects launcher ! * @param args Arguments passed to the launcher ! */ ! public static void main(String[] args) ! { ! // Create the 'SplashScreen' object ! splash = new SplashScreen(); ! // Make the splash appear ! splash.setVisible(true); ! // Create the 'NextObjects' object and make it appear ! new NextObjects(); + // Make the splash screen disappear + splash.setVisible(false); ! // Prepare the splash screen memory range to be garbage collected ! // by dereferencing the 'SplashScreen' object ! splash = null; ! } // End of 'main' ! /** ! * Return a reference to the 'NextObjects' object ! * @return The 'NextObjects' object ! */ ! public static NextObjects getReference() ! { ! return nextObjects; ! } ! /** ! * Return a reference to the 'NextObjects' object ! * @return The 'NextObjects' object ! */ ! public static DataDictionaryEdit getDataDictionaryEdit() ! { ! return dataDictionaryEdit; ! } ! ! /** ! * Change the text in the status bar ! * @param text Text to display ! */ ! public static void setStatusBarText(String text) ! { ! jLabelStatus.setText(text); ! } } |
From: <efl...@us...> - 2003-06-02 20:03:49
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util In directory sc8-pr-cvs1:/tmp/cvs-serv28736/src/org/devaki/nextobjects/util Modified Files: MeriseTransform.java ModelMan.java NOImageTransform.java Log Message: made model -> png about to work again + checkstyleS Index: MeriseTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/MeriseTransform.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MeriseTransform.java 31 May 2003 13:42:34 -0000 1.20 --- MeriseTransform.java 2 Jun 2003 20:03:45 -0000 1.21 *************** *** 48,569 **** public class MeriseTransform { ! /* ! * The logger from the log4j project ! */ ! private static Category logger ! = Logger.getInstance(MeriseTransform.class.getName()); ! ! /* ! * Dummy constructor [...1100 lines suppressed...] ! newField = new Column(pAsso.getIdentifierAt(i)); ! newField.setPrimaryKey(true); ! if (pAsso.getCardAt(i) == ConceptualModel._0N_) ! { ! newField.setRequired(false); ! } ! newField.setAutoIncrement(false); // always in that case! ! newTable.getData().addElement(newField); ! newCst = ! new Constraint( ! pDatabase, ! pAsso.getEntityAt(i).getSubsequentTable(), ! newTable); ! newCst.setAnyField(newField); ! newCst.setUniqueField(pAsso.getIdentifierAt(i)); ! ModelMan.addConstraint(pDatabase, newCst); ! } ! ModelMan.addTable(pDatabase, newTable); } } Index: ModelMan.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/ModelMan.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ModelMan.java 31 May 2003 13:42:34 -0000 1.24 --- ModelMan.java 2 Jun 2003 20:03:45 -0000 1.25 *************** *** 280,284 **** pMerise.isVerified = false; pMerise.isSaved = false; - ((Association) pAssocLink.getParentClass()).addAssociationLink( ((Entity) pAssocLink.getChildClass())); --- 280,283 ---- Index: NOImageTransform.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/NOImageTransform.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NOImageTransform.java 24 May 2003 18:50:47 -0000 1.3 --- NOImageTransform.java 2 Jun 2003 20:03:45 -0000 1.4 *************** *** 22,29 **** import java.io.File; - import java.io.FileInputStream; - import java.io.FileOutputStream; - import java.io.ObjectInputStream; - import java.io.ObjectOutputStream; import java.awt.Point; import java.awt.Rectangle; --- 22,25 ---- *************** *** 36,218 **** import org.devaki.nextobjects.workspace.models.ConceptualModel; import org.devaki.nextobjects.workspace.models.objects.BaseObject; public class NOImageTransform { ! //private static BaseModel myModel ! static Category logger = Logger.getInstance(NOImageTransform.class.getName()); ! public NOImageTransform() ! { ! } ! /* ! * Move the ConceptualModel to the upper left corner to get the samllest image. ! * param pPCM ! * @return ! */ ! private static Rectangle resizeAndTranslate(ConceptualModel pCDM) ! { ! Rectangle rect=pCDM.getRectangle(); ! BaseObject[] tmp = pCDM.getModel0bjects(); ! // loop ! for (int j=0;j<tmp.length;j++) ! { ! tmp[j].getObjectView().setLocation( ! new Point( ! tmp[j].getObjectView().getLocation().x-rect.x, ! tmp[j].getObjectView().getLocation().y-rect.y ! ) ! ); ! } ! return rect; ! } ! /* ! * Move the PhysicalModel to the upper left corner to get the samllest image. ! * param pPDM ! * @return ! */ ! private static Rectangle resizeAndTranslate(PhysicalModel pPDM) ! { ! Rectangle rect=pPDM.getRectangle(); ! BaseObject[] tmp = pPDM.getModel0bjects(); ! // loop ! for (int j=0;j<tmp.length;j++) { ! tmp[j].getObjectView().setLocation( ! new Point( ! tmp[j].getObjectView().getLocation().x-rect.x, ! tmp[j].getObjectView().getLocation().y-rect.y ! ) ! ); ! } ! return rect; ! } ! /* ! * Get a Buffered Image for the model ! * @param panel , width, height ! * @return ! */ ! private static BufferedImage getImage(JPanel panel,int width,int height) ! { ! BufferedImage bi = new BufferedImage(width,height, ! BufferedImage.TYPE_4BYTE_ABGR_PRE); ! Graphics2D g2 = (Graphics2D)bi.createGraphics(); ! // We do a null clip to avoid a null pointer when call ! // for getOldClip() later in XXXXView() paints. ! Rectangle rect= new Rectangle(0,0,width,height); ! g2.clip(rect); ! panel.paint(g2); ! //dispose of the graphics content ! g2.dispose(); ! return bi; ! } ! /* ! * Write Conceptual Model the model to a PNG file ! * @param pPDM,file ! * @return ! */ ! public static boolean writeImage(ConceptualModel pCDM,File file) ! { ! //pessimistic ! boolean success=false; ! //clone CDM ! // first I save the erd int temp. ! File tmp=new File (NOTools.TMP_DIR + File.separator + "temp.erd"); ! try ! { ! ObjectOutputStream flux = ! new ObjectOutputStream(new FileOutputStream(tmp)); ! flux.writeObject(pCDM); ! flux.flush(); ! flux.close(); ! } ! catch (Exception ioex) ! { ! logger.error("Unable to save temporary file " + tmp); ! } ! // then reload. ! ConceptualModel anotherMerise=null; ! try ! { ! ObjectInputStream flux=new ObjectInputStream(new FileInputStream(tmp)); ! anotherMerise=(ConceptualModel)flux.readObject(); ! flux.close(); ! } ! catch (Exception ioex) ! { ! logger.error("I can't understand file : " + ioex ); ! } ! Rectangle rect = resizeAndTranslate(anotherMerise); ! ModelMan.resizeModelObjects(anotherMerise); ! BufferedImage bi=getImage(anotherMerise.getConceptualView().drawingArea, ! rect.width,rect.height); ! try { ! success=javax.imageio.ImageIO.write(bi, "PNG",file); ! } catch (Exception e) { ! // most often lacks of jdk1.3 ! e.printStackTrace(); ! logger.error(e.getMessage()); ! } ! System.gc(); ! return success; ! } ! /* ! * Write Physical Model the model to a PNG file ! * @param pPDM,file ! * @return ! */ ! public static boolean writeImage(PhysicalModel pPDM,File file) ! { ! //pessimistic ! boolean success=false; ! //clone PDM ! // first I save the erd int temp. ! File tmp=new File (NOTools.TMP_DIR + File.separator + "temp.pdm"); ! try ! { ! ObjectOutputStream flux = ! new ObjectOutputStream(new FileOutputStream(tmp)); ! flux.writeObject(pPDM); ! flux.flush(); ! flux.close(); ! } ! catch (Exception ioex) ! { ! logger.error("Unable to save temporary file " + tmp); ! } ! // then reload. ! PhysicalModel anotherPDM=null; ! try ! { ! ObjectInputStream flux=new ObjectInputStream(new FileInputStream(tmp)); ! anotherPDM=(PhysicalModel)flux.readObject(); ! flux.close(); ! } ! catch (Exception ioex) ! { ! logger.error("I can't understand file : " + ioex ); ! } ! // that's why we have cloned it. ! Rectangle rect = resizeAndTranslate(anotherPDM); ! ModelMan.resizeModelObjects(anotherPDM); ! // get the buffered image. ! BufferedImage bi=getImage(anotherPDM.getPhysicalView().drawingArea, ! rect.width,rect.height); ! try { ! success=javax.imageio.ImageIO.write(bi, "PNG",file); ! } catch (Exception e) { ! // most often lacks of jdk1.3 ! e.printStackTrace(); ! logger.error(e.getMessage()); ! } ! System.gc(); ! return success; ! } } --- 32,211 ---- import org.devaki.nextobjects.workspace.models.ConceptualModel; import org.devaki.nextobjects.workspace.models.objects.BaseObject; + import org.devaki.nextobjects.workspace.models.graphics.ClassView; + /** + * This class is responsible for drawing models to files. + * + * @author efl...@de... + * + */ public class NOImageTransform { ! /** ! * The Log4J logger ! */ ! private static Category logger = ! Logger.getInstance(NOImageTransform.class.getName()); ! /** ! * Dummy constructor ! */ ! public NOImageTransform() ! { ! } ! /** ! * Move the ConceptualModel to the upper left corner to get the samllest image. ! * @param pCDM the context model ! * @param xOffset the X offset ! * @param yOffset the Y offset ! */ ! private static void translateModel( ! ConceptualModel pCDM, ! int xOffset, ! int yOffset) ! { ! BaseObject[] tmp = pCDM.getModel0bjects(); ! // loop ! for (int j = 0; j < tmp.length; j++) ! { ! if (tmp[j].getObjectView() instanceof ClassView) ! { ! ((ClassView) tmp[j].getObjectView()).setLocation( ! new Point( ! tmp[j].getObjectView().getLocation().x - xOffset, ! tmp[j].getObjectView().getLocation().y - yOffset)); ! } ! } ! } ! /** ! * Move the PhysicalModel to the upper left corner to get the samllest image. ! * @param pPDM the context model ! * @param xOffset the X offset ! * @param yOffset the Y offset ! */ ! private static void translateModel( ! PhysicalModel pPDM, ! int xOffset, ! int yOffset) ! { ! Rectangle rect = pPDM.getRectangle(); ! BaseObject[] tmp = pPDM.getModel0bjects(); ! // loop ! for (int j = 0; j < tmp.length; j++) ! { ! if (tmp[j].getObjectView() instanceof ClassView) ! { ! ((ClassView) tmp[j].getObjectView()).setLocation( ! new Point( ! tmp[j].getObjectView().getLocation().x - xOffset, ! tmp[j].getObjectView().getLocation().y - yOffset)); ! } ! } ! System.out.println(xOffset + " -" + yOffset); ! } ! /** ! * Get a the drawed/sized image to print using the ! * model view drawing area ! * ! * @param panel the panel from the model to paint. ! * @param width the width of the image ! * @param height the height of the image ! * @return bufferedImage ! */ ! private static BufferedImage getImage(JPanel panel, int width, int height) ! { ! ModelMan.resetCurrentObjects(); ! BufferedImage bi = ! new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR_PRE); ! Graphics2D g2 = (Graphics2D) bi.createGraphics(); ! Rectangle rect = new Rectangle(0, 0, width, height); ! panel.paint(g2); ! //dispose of the graphics content ! return bi; ! } ! /** ! * Write Conceptual Model the model to a PNG file ! * @param pCDM the context model ! * @param file the file to write ! * @return success ! */ ! public static boolean writeImage(ConceptualModel pCDM, File file) ! { ! boolean success = false; ! Point oldP = pCDM.getRectangle().getLocation(); ! // this is a hack, the model is moved to top left corner in ! // order to avoid drawing the whole 5000*5000 drawingArea. ! // then the model is returned to old position. ! // by that time it havn't been redrawed ... ! translateModel(pCDM, oldP.x, oldP.y); ! // the rectangle give the offfset. ! Rectangle rect = pCDM.getRectangle(); ! pCDM.getConceptualView().setFullRefresh(true); ! BufferedImage bi = ! getImage( ! pCDM.getConceptualView().drawingArea, ! rect.width, ! rect.height); ! // return to the old offset. ! try ! { ! success = javax.imageio.ImageIO.write(bi, "PNG", file); ! } catch (Exception e) ! { ! logger.error(e.getMessage()); ! // most often lacks of jdk1.4 ! e.printStackTrace(); ! } ! translateModel(pCDM, -oldP.x, -oldP.y); ! return success; ! } ! ! /** ! * Write Physical Model the model to a PNG file ! * @param pPDM the context model ! * @param file the file to write ! * @return success ! */ ! public static boolean writeImage(PhysicalModel pPDM, File file) ! { ! boolean success = false; ! ! Point oldP = pPDM.getRectangle().getLocation(); ! // this is a hack, the model is moved to top left corner in ! // order to avoid drawing the whole 5000*5000 drawingArea. ! // then the model is returned to old position. ! // by that time it havn't been redrawed ... ! translateModel(pPDM, oldP.x, oldP.y); ! // the rectangle give the offfset. ! Rectangle rect = pPDM.getRectangle(); ! ! try ! { ! BufferedImage bi = ! getImage( ! pPDM.getPhysicalView().drawingArea, ! rect.width, ! rect.height); ! success = javax.imageio.ImageIO.write(bi, "PNG", file); ! ! } catch (Exception e) ! { ! logger.error(e.getMessage()); ! // most often lacks of jdk1.4 ! e.printStackTrace(); ! } ! // return to the old offset. ! translateModel(pPDM, -oldP.x, -oldP.y); ! ! return success; ! } } |
From: <efl...@us...> - 2003-06-02 20:03:49
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/constants In directory sc8-pr-cvs1:/tmp/cvs-serv28736/src/org/devaki/nextobjects/constants Modified Files: CstGraphics.java Log Message: made model -> png about to work again + checkstyleS Index: CstGraphics.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/constants/CstGraphics.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CstGraphics.java 11 Feb 2003 12:12:09 -0000 1.2 --- CstGraphics.java 2 Jun 2003 20:03:45 -0000 1.3 *************** *** 24,71 **** import java.awt.Point; - /** ! * <p>Title: CstGraphics</p> ! * <p>Description: Some default values retaled to the graphic models</p> ! * <p>Copyright: GNU Public License</p> ! * <p>Company: devaki.org</p> */ public class CstGraphics { - /********** - * MODELS * - **********/ - // All - public final static Dimension MODEL_DIMENSION = new Dimension(10000, 5000); - public final static Point MODEL_INITIAL_POSITION = new Point(5000, 2500); - public final static Color MODEL_BACKGROUND_COLOR = Color.white; ! /*********** ! * OBJECTS * ! ***********/ ! // All ! public final static Color SELECTION_COLOR = Color.black; ! public final static Dimension MINIMUM_OBJECT_SIZE = new Dimension(30, 30); ! // Entities ! public final static Color DEFAULT_ENTITY_BACKGROUND_COLOR ! = new Color(176, 176, 216); ! public final static Color DEFAULT_ENTITY_BORDER_COLOR = Color.black; ! public final static Dimension DEFAULT_ENTITY_SIZE = new Dimension(80, 60); ! // Associations ! public final static Color DEFAULT_ASSOCIATION_BACKGROUND_COLOR ! = new Color(197, 216, 176); ! public final static Color DEFAULT_ASSOCIATION_BORDER_COLOR = Color.black; ! public final static Dimension DEFAULT_ASSOCIATION_SIZE ! = new Dimension(90, 45); ! // Association Links ! public final static Color DEFAULT_ASSOCIATIONLINK_COLOR = Color.black; ! // Inheritance Links ! public final static Color DEFAULT_INHERITANCELINK_COLOR = Color.black; ! // Tables ! public final static Color DEFAULT_TABLE_BACKGROUND_COLOR ! = new Color(176, 176, 216); ! public final static Color DEFAULT_TABLE_BORDER_COLOR = Color.black; ! public final static Dimension DEFAULT_TABLE_SIZE = new Dimension(80, 60); ! // Constraints ! public final static Color DEFAULT_CONSTRAINT_COLOR = Color.blue; } --- 24,119 ---- import java.awt.Point; /** ! * Description: Some default values retaled to the graphic models ! * @author efl...@de... ! * */ public class CstGraphics { ! /** ! * The model dimension ! */ ! public final static Dimension MODEL_DIMENSION = new Dimension(10000, 5000); ! ! /** ! * The model initial position ! */ ! public final static Point MODEL_INITIAL_POSITION = new Point(5000, 2500); ! ! /** ! * The model background color ! */ ! public final static Color MODEL_BACKGROUND_COLOR = Color.white; ! ! /** ! * The model selection color ! */ ! public final static Color SELECTION_COLOR = Color.black; ! ! /** ! * MINIMUM_OBJECT_SIZE ! */ ! public final static Dimension MINIMUM_OBJECT_SIZE = new Dimension(30, 30); ! ! /** ! * DEFAULT_ENTITY_BACKGROUND_COLOR ! */ ! public final static Color DEFAULT_ENTITY_BACKGROUND_COLOR = ! new Color(176, 176, 216); ! ! /** ! * DEFAULT_ENTITY_BORDER_COLOR ! */ ! public final static Color DEFAULT_ENTITY_BORDER_COLOR = Color.black; ! ! /** ! * DEFAULT_ENTITY_SIZE ! */ ! public final static Dimension DEFAULT_ENTITY_SIZE = new Dimension(80, 60); ! ! /** ! * DEFAULT_ASSOCIATION_BACKGROUND_COLOR ! */ ! public final static Color DEFAULT_ASSOCIATION_BACKGROUND_COLOR = ! new Color(197, 216, 176); ! ! /** ! * DEFAULT_ASSOCIATION_BORDER_COLOR ! */ ! public final static Color DEFAULT_ASSOCIATION_BORDER_COLOR = Color.black; ! ! /** ! * DEFAULT_ASSOCIATION_SIZE ! */ ! public final static Dimension DEFAULT_ASSOCIATION_SIZE = ! new Dimension(90, 45); ! ! /** ! * DEFAULT_ASSOCIATIONLINK_COLOR ! */ ! public final static Color DEFAULT_ASSOCIATIONLINK_COLOR = Color.black; ! ! /** ! * DEFAULT_INHERITANCELINK_COLOR ! */ ! public final static Color DEFAULT_INHERITANCELINK_COLOR = Color.black; ! ! /** ! * DEFAULT_TABLE_BACKGROUND_COLOR ! */ ! public final static Color DEFAULT_TABLE_BACKGROUND_COLOR = ! new Color(176, 176, 216); ! /** ! * DEFAULT_TABLE_BORDER_COLOR ! */ ! public final static Color DEFAULT_TABLE_BORDER_COLOR = Color.black; ! /** ! * DEFAULT_TABLE_SIZE ! */ ! public final static Dimension DEFAULT_TABLE_SIZE = new Dimension(80, 60); ! /** ! * DEFAULT_CONSTRAINT_COLOR ! */ ! public final static Color DEFAULT_CONSTRAINT_COLOR = Color.blue; } |
From: <efl...@us...> - 2003-06-02 20:03:49
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models In directory sc8-pr-cvs1:/tmp/cvs-serv28736/src/org/devaki/nextobjects/workspace/models Modified Files: BaseModel.java Log Message: made model -> png about to work again + checkstyleS Index: BaseModel.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/BaseModel.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BaseModel.java 24 May 2003 18:50:47 -0000 1.9 --- BaseModel.java 2 Jun 2003 20:03:45 -0000 1.10 *************** *** 22,27 **** import java.io.Serializable; import java.awt.Rectangle; - import java.util.Vector; import javax.swing.JPanel; import org.devaki.nextobjects.NextObjects; import org.devaki.nextobjects.ui.components.CustomTreeNode; --- 22,27 ---- import java.io.Serializable; import java.awt.Rectangle; import javax.swing.JPanel; [...1348 lines suppressed...] + + /** + * The model is saved + * @param b is saved + */ + public void setSaved(boolean b) + { + isSaved = b; + } + + /** + * The model is verified + * @param b is verified + */ + public void setVerified(boolean b) + { + isVerified = b; + } } |
From: <efl...@us...> - 2003-05-31 13:42:38
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics In directory sc8-pr-cvs1:/tmp/cvs-serv22383/src/org/devaki/nextobjects/workspace/models/graphics Modified Files: ConceptualView.java PhysicalView.java Log Message: CheckStyle + debug graphics. Index: ConceptualView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/ConceptualView.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ConceptualView.java 31 May 2003 12:00:37 -0000 1.18 --- ConceptualView.java 31 May 2003 13:42:35 -0000 1.19 *************** *** 109,112 **** --- 109,117 ---- */ private boolean fullRefresh = true; + + /** + * The buffered image + */ + transient private BufferedImage bi = null; /** *************** *** 140,144 **** super.paintComponent(g2); Rectangle area; ! BufferedImage bi = null; BufferedImage bi2; Graphics2D big; --- 145,149 ---- super.paintComponent(g2); Rectangle area; ! BufferedImage bi2; Graphics2D big; *************** *** 197,208 **** fullRefresh = false; } ! if (bi!=null) ! { ! g2.drawImage( ! bi, ! (int) jScrollPane.getViewport().getViewPosition().getX(), ! (int) jScrollPane.getViewport().getViewPosition().getY(), ! this); ! } // loop/paint selected objects objects toviewPort panel. --- 202,219 ---- fullRefresh = false; } ! if (bi != null) ! { ! g2.drawImage( ! bi, ! (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getX(), ! (int) jScrollPane ! .getViewport() ! .getViewPosition() ! .getY(), ! this); ! } // loop/paint selected objects objects toviewPort panel. Index: PhysicalView.java =================================================================== RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/workspace/models/graphics/PhysicalView.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** PhysicalView.java 31 May 2003 11:48:34 -0000 1.17 --- PhysicalView.java 31 May 2003 13:42:35 -0000 1.18 *************** *** 96,100 **** * the context model */ ! private PhysicalModel myModel; /** --- 96,100 ---- * the context model */ ! transient private PhysicalModel myModel; /** *************** *** 112,115 **** --- 112,120 ---- */ private boolean fullRefresh = true; + + /** + * the buffered image + */ + transient private BufferedImage bi = null; /** *************** *** 136,140 **** { Rectangle area; - BufferedImage bi = null; BufferedImage bi2; Graphics2D big; --- 141,144 ---- |