[Nextobjects-devel] nextobjects/nextobjects/src/org/devaki/nextobjects/util DatabaseLoader.java,1.2,
Status: Alpha
Brought to you by:
eflorent
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"))
{
|