svnno****@sourc*****
svnno****@sourc*****
2009年 2月 4日 (水) 16:45:14 JST
Revision: 2615 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2615 Author: daisuke_m Date: 2009-02-04 16:45:14 +0900 (Wed, 04 Feb 2009) Log Message: ----------- viewまわりのシリアライズを整備。 Modified Paths: -------------- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/SerializationTest.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidateUtil.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/ResetBendpointProcessor.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/DiagramPresentationModelImpl.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/test/ViewTestModelBuilder.java artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/model/DiagramPresentationModelImplTest.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/FitNodeConstraintAction.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-view.xsd zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml zeus/trunk/jiemamy-spec-view/.classpath zeus/trunk/jiemamy-spec-view/pom.xml zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/DiagramPresentationModel.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/xml/ViewQName.java Added Paths: ----------- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/NodeProfileImpl.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java zeus/trunk/jiemamy-spec-view/src/test/ zeus/trunk/jiemamy-spec-view/src/test/java/ zeus/trunk/jiemamy-spec-view/src/test/java/org/ zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/ zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/ zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/ zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java zeus/trunk/jiemamy-spec-view/src/test/resources/ Removed Paths: ------------- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetColorProcessor.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetConstraintProcessor.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/RemoveFromDiagramProcessor.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetColorProcessor.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetConstraintProcessor.java artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetColorProcessorTest.java artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetConstraintProcessorTest.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/SerializationTest.java =================================================================== --- artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/SerializationTest.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-artemis-test/src/test/java/org/jiemamy/serializer/SerializationTest.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -202,6 +202,11 @@ assertThat(dataSets.size(), is(2)); } + /** + * 往復テスト1(RXRX)。 + * + * @throws Exception + */ @Test public void test03_往復テスト1_RXRX() throws Exception { Jiemamy jiemamy1 = Jiemamy.newInstance(new Artemis(new ArtemisView())); @@ -248,6 +253,11 @@ assertThat(xml2, is(xml1)); } + /** + * 往復テスト2(XRXR)。 + * + * @throws Exception + */ @Test public void test04_往復テスト2_XRXR() throws Exception { Jiemamy jiemamy1 = Jiemamy.newInstance(new Artemis(new ArtemisView())); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomSerializer.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -92,8 +92,8 @@ RootModel rootModel; try { - Document document = buildDom(in); - rootModel = parseDom(document); + Document document = toDom(in); + rootModel = toRootModel(document); } catch (ParserConfigurationException e) { throw new SerializationException(e); } catch (SAXException e) { @@ -113,7 +113,7 @@ logger.debug("serialize"); try { - Document document = buildDom(rootModel); + Document document = toDom(rootModel); DOMSource source = new DOMSource(document); TransformerFactory transFactory = TransformerFactory.newInstance(); @@ -142,7 +142,7 @@ * @throws SAXException * @throws IOException */ - protected Document buildDom(InputStream in) throws ParserConfigurationException, SAXException, IOException { + protected Document toDom(InputStream in) throws ParserConfigurationException, SAXException, IOException { DocumentBuilder documentBuilder = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); Document document = documentBuilder.parse(in); return document; @@ -155,7 +155,7 @@ * @return DOMドキュメント * @throws ParserConfigurationException */ - protected Document buildDom(RootModel rootModel) throws ParserConfigurationException { + protected Document toDom(RootModel rootModel) throws ParserConfigurationException { return new DomBuilder(rootModel).build(); } @@ -165,7 +165,7 @@ * @param document DOMドキュメント * @return {@link RootModel} */ - protected RootModel parseDom(Document document) { + protected RootModel toRootModel(Document document) { return new DomParser(jiemamy, document).parse(); } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidateUtil.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidateUtil.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/utils/ValidateUtil.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -35,7 +35,7 @@ */ public static void injectionSetter(Object targetField) { if (targetField != null) { - throw new IllegalStateException(); + throw new IllegalStateException("duplicate initialize"); } } Added: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/NodeProfileImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/NodeProfileImpl.java (rev 0) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/NodeProfileImpl.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -0,0 +1,74 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/04 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy; + +import java.util.UUID; + +import org.jiemamy.model.AbstractJiemamyElement; +import org.jiemamy.model.NodeProfile; +import org.jiemamy.model.geometory.JmColor; +import org.jiemamy.model.geometory.JmRectangle; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public class NodeProfileImpl extends AbstractJiemamyElement implements NodeProfile { + + /** ノードの色情報 */ + private JmColor color; + + /** ノードのレイアウト情報 */ + private JmRectangle layout; + + + /** + * インスタンスを生成する。 + * + * @param jiemamy + * @param id + */ + public NodeProfileImpl(Jiemamy jiemamy, UUID id) { + super(jiemamy, id); + } + + public JmColor getColor() { + return color; + } + + public JmRectangle getLayout() { + return layout; + } + + /** + * {@inheritDoc} + */ + public void setColor(JmColor color) { + this.color = color; + } + + /** + * {@inheritDoc} + */ + public void setLayout(JmRectangle layout) { + this.layout = layout; + } + +} Property changes on: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/NodeProfileImpl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewDomSerializerEnhancer.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -15,12 +15,14 @@ */ package org.jiemamy; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import javax.xml.parsers.ParserConfigurationException; +import org.apache.commons.lang.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -31,18 +33,21 @@ import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.JiemamyElement; +import org.jiemamy.model.NodeProfile; import org.jiemamy.model.RootModel; import org.jiemamy.model.connection.ConnectionAdapter; import org.jiemamy.model.geometory.JmColor; import org.jiemamy.model.geometory.JmPoint; import org.jiemamy.model.geometory.JmRectangle; import org.jiemamy.model.node.NodeAdapter; +import org.jiemamy.model.node.StickyModel; import org.jiemamy.serializer.JiemamyDomSerializer; import org.jiemamy.utils.DomUtil; import org.jiemamy.utils.IterableNodeList; import org.jiemamy.utils.XpathUtil; import org.jiemamy.utils.enhancer.Invocation; import org.jiemamy.utils.enhancer.InvocationHandler; +import org.jiemamy.utils.model.PresentationUtil; import org.jiemamy.utils.model.RootModelUtil; import org.jiemamy.xml.CoreQName; import org.jiemamy.xml.ViewQName; @@ -85,51 +90,76 @@ } @Override - protected Document buildDom(RootModel rootModel) throws ParserConfigurationException { - Document document = super.buildDom(rootModel); + protected Document toDom(RootModel rootModel) throws ParserConfigurationException { + Document document = super.toDom(rootModel); Element diagramPresentationsElement = DomUtil.newChild(document.getDocumentElement(), ViewQName.DIAGRAM_PRESENTATIONS); DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); + logger.info("diagramPresentations"); for (DiagramPresentationModel presentation : diagramPresentations) { + logger.info(" diagramPresentation: id=" + presentation.getId()); Element presentationElement = DomUtil.newChild(diagramPresentationsElement, ViewQName.DIAGRAM_PRESENTATION); presentationElement.setAttribute("id", presentation.getId().toString()); + logger.info(" name: " + presentation.getName()); DomUtil.newChild(presentationElement, CoreQName.NAME, presentation.getName()); - for (Map.Entry<NodeAdapter, JmRectangle> entry : presentation.getNodeLayouts().entrySet()) { + logger.info(" nodeLayouts"); + Element nodeLayoutsElement = DomUtil.newChild(presentationElement, ViewQName.NODE_LAYOUTS); + for (Map.Entry<NodeAdapter, NodeProfile> entry : presentation.getFigureProfiles().entrySet()) { + logger.info(" nodeLayout"); + Element nodeLayoutElement = DomUtil.newChild(nodeLayoutsElement, ViewQName.NODE_LAYOUT); NodeAdapter node = entry.getKey(); - JmRectangle rectangle = entry.getValue(); - Element nodeElement = DomUtil.newChild(presentationElement, ViewQName.NODE); - if (node.unwrap() != null) { + NodeProfile nodeProfile = entry.getValue(); + Element nodeElement; + if (node.unwrap() == null) { + nodeElement = DomUtil.newChild(nodeLayoutElement, ViewQName.STICKY); + StickyModel stickyModel = (StickyModel) node; + nodeElement.setAttribute("id", stickyModel.getId().toString()); + DomUtil.newChild(nodeElement, ViewQName.CONTENTS, stickyModel.getContents()); + logger.info(" sticky: " + stickyModel.getContents()); + } else { + nodeElement = DomUtil.newChild(nodeLayoutElement, ViewQName.NODE_OBJECT_REF); nodeElement.setAttribute("ref", node.unwrap().getId().toString()); - } else { - nodeElement.setAttribute("ref", ((JiemamyElement) node).getId().toString()); + logger.info(" node ref: " + node.unwrap().getId().toString()); } - nodeElement.setAttribute("x", Integer.toString(rectangle.x)); - nodeElement.setAttribute("y", Integer.toString(rectangle.y)); - nodeElement.setAttribute("width", Integer.toString(rectangle.width)); - nodeElement.setAttribute("height", Integer.toString(rectangle.height)); + Element boundaryElement = DomUtil.newChild(nodeLayoutElement, ViewQName.BOUNDARY); + boundaryElement.setAttribute("x", Integer.toString(nodeProfile.getLayout().x)); + boundaryElement.setAttribute("y", Integer.toString(nodeProfile.getLayout().y)); + boundaryElement.setAttribute("width", Integer.toString(nodeProfile.getLayout().width)); + boundaryElement.setAttribute("height", Integer.toString(nodeProfile.getLayout().height)); + boundaryElement.setAttribute("color", ObjectUtils.toString(nodeProfile.getColor())); + logger.info(" boundary: " + boundaryElement); } - for (Map.Entry<NodeAdapter, JmColor> entry : presentation.getNodeColors().entrySet()) { - NodeAdapter node = entry.getKey(); - JmColor rectangle = entry.getValue(); - // TODO - } + Element connectionLayoutsElement = DomUtil.newChild(presentationElement, ViewQName.CONNECTION_LAYOUTS); + logger.info(" connectionLayouts"); for (Map.Entry<ConnectionAdapter, List<JmPoint>> entry : presentation.getConnectionLayouts().entrySet()) { + logger.info(" connectionLayout"); ConnectionAdapter connection = entry.getKey(); List<JmPoint> points = entry.getValue(); - Element connectionElement = DomUtil.newChild(presentationElement, ViewQName.CONNECTION); - if (connection.unwrap() != null) { - connectionElement.setAttribute("ref", connection.unwrap().getId().toString()); + Element connectionLayoutElement = + DomUtil.newChild(connectionLayoutsElement, ViewQName.CONNECTION_LAYOUT); + if (connection.unwrap() == null) { +// connectionLayoutElement.setAttribute("ref", ((JiemamyElement) connection).getId().toString()); + logger.warn(" Unknown"); + continue; } else { - connectionElement.setAttribute("ref", ((JiemamyElement) connection).getId().toString()); + Element connectionObjectRef = + DomUtil.newChild(connectionLayoutElement, ViewQName.CONNECTION_OBJECT_REF); + connectionObjectRef.setAttribute("ref", connection.unwrap().getId().toString()); + logger.info(" FK"); } - for (JmPoint point : points) { - Element bendpointElement = DomUtil.newChild(connectionElement, ViewQName.BENDPOINT); - bendpointElement.setAttribute("x", Integer.toString(point.x)); - bendpointElement.setAttribute("y", Integer.toString(point.y)); + if (points.size() > 0) { + Element bendpointsElement = DomUtil.newChild(connectionLayoutElement, ViewQName.BENDPOINTS); + logger.info(" bendpoints"); + for (JmPoint point : points) { + Element bendpointElement = DomUtil.newChild(bendpointsElement, ViewQName.BENDPOINT); + bendpointElement.setAttribute("x", Integer.toString(point.x)); + bendpointElement.setAttribute("y", Integer.toString(point.y)); + logger.info(" bendpoint: " + bendpointElement); + } } } } @@ -138,8 +168,8 @@ } @Override - protected RootModel parseDom(Document document) { - RootModel rootModel = super.parseDom(document); + protected RootModel toRootModel(Document document) { + RootModel rootModel = super.toRootModel(document); NodeList dpNodeList = XpathUtil.getNodes(document, "/core:rootModel/view:diagramPresentations/view:diagramPresentation"); Iterable<Node> dpNodeListIterable = new IterableNodeList(dpNodeList); @@ -156,35 +186,74 @@ factory.newModel(DiagramPresentationModel.class, DomUtil.getUUID(dpElement, CoreQName.ID)); presentation.setName(XpathUtil.getText(dpElement, "core:name/text()")); - NodeList nodeNodeList = XpathUtil.getNodes(dpElement, "view:node"); - Iterable<Node> nodeNodeListIterable = new IterableNodeList(nodeNodeList); - for (Node nodeNode : nodeNodeListIterable) { - UUID refId = DomUtil.getUUID(nodeNode, CoreQName.REF); + NodeList nodeLayoutNodeList = XpathUtil.getNodes(dpElement, "view:nodeLayouts/view:nodeLayout"); + Iterable<Node> nodeLayoutNodeListIterable = new IterableNodeList(nodeLayoutNodeList); + for (Node nodeLayoutNode : nodeLayoutNodeListIterable) { + NodeAdapter nodeAdapter; + Node objectRefNode = XpathUtil.getNode(nodeLayoutNode, "view:nodeObjectRef"); + if (objectRefNode != null) { + UUID refId = DomUtil.getUUID(objectRefNode, CoreQName.REF); + JiemamyElement jElement = RootModelUtil.findJiemamyElement(rootModel, refId); + if (jElement == null) { + logger.error("null element: " + refId.toString()); + continue; + } + nodeAdapter = jElement.getAdapter(NodeAdapter.class); + if (nodeAdapter == null) { + logger.error("null node: " + jElement.getId().toString()); + continue; + } + } else { + Node stickytNode = XpathUtil.getNode(nodeLayoutNode, "view:sticky"); + StickyModel stickyModel = + factory.newModel(StickyModel.class, DomUtil.getUUID(stickytNode, CoreQName.ID)); + stickyModel.setContents(XpathUtil.getTextContent(stickytNode, "view:contents")); + nodeAdapter = stickyModel; + } + int x = Integer.valueOf(XpathUtil.getAttr(nodeLayoutNode, "view:boundary/@x").getValue()); + int y = Integer.valueOf(XpathUtil.getAttr(nodeLayoutNode, "view:boundary/@y").getValue()); + int width = Integer.valueOf(XpathUtil.getAttr(nodeLayoutNode, "view:boundary/@width").getValue()); + int height = Integer.valueOf(XpathUtil.getAttr(nodeLayoutNode, "view:boundary/@height").getValue()); + JmRectangle rect = new JmRectangle(x, y, width, height); + JmColor color = JmColor.parse(XpathUtil.getAttr(nodeLayoutNode, "view:boundary/@color").getValue()); + + PresentationUtil.setLayout(presentation, nodeAdapter, rect); + PresentationUtil.setColor(presentation, nodeAdapter, color); + } + presentation.setName(XpathUtil.getTextContent(dpElement, "core:name")); + + NodeList connectionLayoutNodeList = + XpathUtil.getNodes(dpElement, "view:connectionLayouts/view:connectionLayout"); + Iterable<Node> connectionLayoutNodeListIterable = new IterableNodeList(connectionLayoutNodeList); + for (Node connectionLayoutNode : connectionLayoutNodeListIterable) { + ConnectionAdapter connectionAdapter; + Node objectRefNode = XpathUtil.getNode(connectionLayoutNode, "view:connectionObjectRef"); + UUID refId = DomUtil.getUUID(objectRefNode, CoreQName.REF); JiemamyElement jElement = RootModelUtil.findJiemamyElement(rootModel, refId); if (jElement == null) { logger.error("null element: " + refId.toString()); continue; } - NodeAdapter nodeAdapter = jElement.getAdapter(NodeAdapter.class); - if (nodeAdapter == null) { - logger.error("null node: " + jElement.getId().toString()); + connectionAdapter = jElement.getAdapter(ConnectionAdapter.class); + if (connectionAdapter == null) { + logger.error("null connection: " + jElement.getId().toString()); continue; } - JmRectangle rect = new JmRectangle(// - Integer.valueOf(XpathUtil.getAttr(nodeNode, "@x").getValue()), // - Integer.valueOf(XpathUtil.getAttr(nodeNode, "@y").getValue()), // - Integer.valueOf(XpathUtil.getAttr(nodeNode, "@width").getValue()), // - Integer.valueOf(XpathUtil.getAttr(nodeNode, "@height").getValue())); - presentation.setConstraint(nodeAdapter, rect); + List<JmPoint> bendpoints = new ArrayList<JmPoint>(); + + NodeList bendpointNodeList = + XpathUtil.getNodes(connectionLayoutNode, "view:bendpoints/view:bendpoint"); + Iterable<Node> bendpointNodeListIterable = new IterableNodeList(bendpointNodeList); + for (Node bendpointNode : bendpointNodeListIterable) { + int x = Integer.valueOf(XpathUtil.getAttr(bendpointNode, "@x").getValue()); + int y = Integer.valueOf(XpathUtil.getAttr(bendpointNode, "@y").getValue()); + bendpoints.add(new JmPoint(x, y)); + } + presentation.getConnectionLayouts().put(connectionAdapter, bendpoints); } - presentation.setName(XpathUtil.getText(dpElement, "core:name/text()")); - // TODO -// presentation.setBendpoints(connection, bendpoints); - rootModel.getAdapter(DiagramPresentations.class).add(presentation); } - // TODO return rootModel; } } Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/ViewFactoryExtensionEnhancer.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -21,21 +21,19 @@ import java.util.HashSet; import java.util.List; import java.util.TreeMap; -import java.util.TreeSet; import java.util.UUID; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentationModelImpl; import org.jiemamy.model.DiagramPresentationsImpl; +import org.jiemamy.model.NodeProfile; import org.jiemamy.model.RootModel; import org.jiemamy.model.DiagramPresentationModel.DisplayItem; import org.jiemamy.model.attribute.constraint.ForeignKeyModel; import org.jiemamy.model.connection.ConnectionAdapter; import org.jiemamy.model.connection.ConnectionAdapterImpl; import org.jiemamy.model.entity.EntityModel; -import org.jiemamy.model.geometory.JmColor; import org.jiemamy.model.geometory.JmPoint; -import org.jiemamy.model.geometory.JmRectangle; import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.model.node.NodeAdapterImpl; import org.jiemamy.model.node.StickyModel; @@ -83,10 +81,12 @@ DiagramPresentationModelImpl presentation = new DiagramPresentationModelImpl(jiemamy, id); presentation.setConnectionLayouts(new HashMap<ConnectionAdapter, List<JmPoint>>()); presentation.setDisplayTargetSet(new HashSet<DisplayItem>()); - presentation.setNodeColors(new HashMap<NodeAdapter, JmColor>()); - presentation.setNodeLayouts(new TreeMap<NodeAdapter, JmRectangle>(NodeComparator.INSTANCE)); - presentation.setNodes(new TreeSet<NodeAdapter>(NodeComparator.INSTANCE)); + presentation.setNodeLayouts(new TreeMap<NodeAdapter, NodeProfile>(NodeComparator.INSTANCE)); product = clazz.cast(presentation); + } else if (clazz == NodeProfile.class) { + assert product == null; + NodeProfileImpl nodeProfile = new NodeProfileImpl(jiemamy, id); + product = clazz.cast(nodeProfile); } else if (clazz == StickyModel.class) { assert product == null; StickyModelImpl stickyModel = new StickyModelImpl(jiemamy, id); Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetColorProcessor.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetColorProcessor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetColorProcessor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,59 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/01 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.geometory.JmColor; -import org.jiemamy.model.node.NodeAdapter; - -/** - * ノードの背景色を取得する。 - * @author daisuke - */ -public class GetColorProcessor extends AbstractProcessor<RootModel, JmColor, RuntimeException> { - - private int index; - - private NodeAdapter node; - - - /** - * インスタンスを生成する。 - * @param index - * @param node - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public GetColorProcessor(int index, NodeAdapter node) { - Validate.notNull(node); - this.index = index; - this.node = node; - } - - /** - * {@inheritDoc} - */ - public JmColor process(RootModel rootModel) { - Validate.notNull(rootModel); - return rootModel.getAdapter(DiagramPresentations.class).get(index).getNodeColors().get(node); - } - -} Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetConstraintProcessor.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetConstraintProcessor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/GetConstraintProcessor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,59 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/01 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.geometory.JmRectangle; -import org.jiemamy.model.node.NodeAdapter; - -/** - * 位置サイズ情報を取得する。 - * @author daisuke - */ -public class GetConstraintProcessor extends AbstractProcessor<RootModel, JmRectangle, RuntimeException> { - - private int index; - - private NodeAdapter node; - - - /** - * インスタンスを生成する。 - * @param index - * @param node - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public GetConstraintProcessor(int index, NodeAdapter node) { - Validate.notNull(node); - this.index = index; - this.node = node; - } - - /** - * {@inheritDoc} - */ - public JmRectangle process(RootModel rootModel) { - Validate.notNull(rootModel); - return rootModel.getAdapter(DiagramPresentations.class).get(index).getNodeLayouts().get(node); - } - -} Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/RemoveFromDiagramProcessor.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/RemoveFromDiagramProcessor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/RemoveFromDiagramProcessor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,59 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/01 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.node.NodeAdapter; - -/** - * ノードをダイアグラムから削除する。 - * @author daisuke - */ -public class RemoveFromDiagramProcessor extends AbstractProcessor<RootModel, Void, RuntimeException> { - - private int index; - - private NodeAdapter node; - - - /** - * インスタンスを生成する。 - * @param index - * @param node - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public RemoveFromDiagramProcessor(int index, NodeAdapter node) { - Validate.notNull(node); - this.index = index; - this.node = node; - } - - /** - * {@inheritDoc} - */ - public Void process(RootModel rootModel) { - Validate.notNull(rootModel); - rootModel.getAdapter(DiagramPresentations.class).get(index).getNodeLayouts().remove(node); - return null; - } - -} Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/ResetBendpointProcessor.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/ResetBendpointProcessor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/ResetBendpointProcessor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -23,6 +23,7 @@ import org.apache.commons.lang.Validate; import org.jiemamy.model.DiagramPresentationModel; +import org.jiemamy.model.NodeProfile; import org.jiemamy.model.connection.ConnectionAdapter; import org.jiemamy.model.geometory.JmPoint; import org.jiemamy.model.geometory.JmRectangle; @@ -63,7 +64,8 @@ if (connection.isSelfConnection()) { // 自己コネクション時の、bendpoint自動作成 - JmRectangle rect = diagramPresentation.getNodeLayouts().get(connection.getSource()); + NodeProfile profile = diagramPresentation.getFigureProfiles().get(connection.getSource()); + JmRectangle rect = profile.getLayout(); if (rect == null) { throw new IllegalStateException("表示されていないノードのコネクションを操作しようとしました。"); Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetColorProcessor.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetColorProcessor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetColorProcessor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,65 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/01 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.geometory.JmColor; -import org.jiemamy.model.node.NodeAdapter; - -/** - * ノードの背景色を設定する。 - * @author daisuke - */ -public class SetColorProcessor extends AbstractProcessor<RootModel, Void, RuntimeException> { - - private int index; - - private NodeAdapter node; - - private JmColor color; - - - /** - * インスタンスを生成する。 - * @param index - * @param node - * @param color - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public SetColorProcessor(int index, NodeAdapter node, JmColor color) { - Validate.notNull(node); - Validate.notNull(color); - this.index = index; - this.node = node; - this.color = color; - } - - /** - * {@inheritDoc} - */ - public Void process(RootModel rootModel) { - Validate.notNull(rootModel); - rootModel.getAdapter(DiagramPresentations.class).get(index).getNodeColors().put(node, color); - return null; - } - -} Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetConstraintProcessor.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetConstraintProcessor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/internal/processor/SetConstraintProcessor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,65 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/01 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import org.apache.commons.lang.Validate; - -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.geometory.JmRectangle; -import org.jiemamy.model.node.NodeAdapter; - -/** - * 位置サイズ情報を設定する。 - * @author daisuke - */ -public class SetConstraintProcessor extends AbstractProcessor<RootModel, JmRectangle, RuntimeException> { - - private int index; - - private NodeAdapter node; - - private JmRectangle constraint; - - - /** - * インスタンスを生成する。 - * @param index - * @param node - * @param constraint - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public SetConstraintProcessor(int index, NodeAdapter node, JmRectangle constraint) { - Validate.notNull(node); - Validate.notNull(constraint); - this.index = index; - this.node = node; - this.constraint = constraint; - } - - /** - * {@inheritDoc} - */ - public JmRectangle process(RootModel rootModel) { - Validate.notNull(rootModel); - rootModel.getAdapter(DiagramPresentations.class).get(index).getNodeLayouts().put(node, constraint); - return null; - } - -} Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/DiagramPresentationModelImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/DiagramPresentationModelImpl.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/DiagramPresentationModelImpl.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -18,9 +18,6 @@ */ package org.jiemamy.model; -import java.util.AbstractCollection; -import java.util.Collection; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -31,10 +28,7 @@ import org.jiemamy.Jiemamy; import org.jiemamy.internal.processor.ResetBendpointProcessor; import org.jiemamy.model.connection.ConnectionAdapter; -import org.jiemamy.model.entity.EntityModel; -import org.jiemamy.model.geometory.JmColor; import org.jiemamy.model.geometory.JmPoint; -import org.jiemamy.model.geometory.JmRectangle; import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.utils.ProcessorUtil; import org.jiemamy.utils.ValidateUtil; @@ -57,30 +51,15 @@ * * 表示されるノードであれば矩形情報を持ち、非表示であればエントリを持たない。 */ - private Map<NodeAdapter, JmRectangle> nodeLayouts; + private Map<NodeAdapter, NodeProfile> nodeProfiles; /** - * ノードの色情報 - * - * デフォルト色のノードであれば、エントリを持たない。 - * THINK JiemamyRectangleに持たせてしまうべき? ColorとRectangleは分離しているべき? - */ - private Map<NodeAdapter, JmColor> nodeColors; - - /** * コネクションのベンドポイント情報 * * ベンドポイントがあれば座標のリストを持ち、なければエントリを持たない。 */ private Map<ConnectionAdapter, List<JmPoint>> connectionLayouts; - /** ノードの集合 */ - private Collection<NodeAdapter> nodes; - - private final Collection<EntityModel> entities; - - private Collection<NodeAdapter> nodesProxy = new NodesProxy(); - /** * インスタンスを生成する。 @@ -90,7 +69,6 @@ */ public DiagramPresentationModelImpl(Jiemamy jiemamy, UUID id) { super(jiemamy, id); - entities = jiemamy.getFactory().getRootModel().getEntities(); } /** @@ -112,36 +90,22 @@ /** * {@inheritDoc} */ - public String getName() { - return name; + public Map<NodeAdapter, NodeProfile> getFigureProfiles() { + assert nodeProfiles != null; + return nodeProfiles; } /** * {@inheritDoc} */ - public Map<NodeAdapter, JmColor> getNodeColors() { - assert nodeColors != null; - return nodeColors; + public String getName() { + return name; } /** * {@inheritDoc} */ - public Map<NodeAdapter, JmRectangle> getNodeLayouts() { - assert nodeLayouts != null; - return nodeLayouts; - } - - /** - * {@inheritDoc} - */ - public Collection<NodeAdapter> getNodes() { - return nodesProxy; - } - - /** - * {@inheritDoc} - */ + @Deprecated public void resetBendpoints(ConnectionAdapter connection) { Validate.notNull(connection); ProcessorUtil.process(this, new ResetBendpointProcessor(connection)); @@ -150,27 +114,16 @@ /** * {@inheritDoc} */ + @Deprecated public void setBendpoints(ConnectionAdapter connection, List<JmPoint> bendpoints) { assert connectionLayouts != null; Validate.notNull(connection); Validate.notNull(bendpoints); - connectionLayouts.get(connection).clear(); - connectionLayouts.get(connection).addAll(bendpoints); + connectionLayouts.put(connection, bendpoints); } /** - * {@inheritDoc} - */ - public void setColor(NodeAdapter node, JmColor color) { - assert nodeColors != null; - Validate.notNull(node); - Validate.notNull(color); - - nodeColors.put(node, color); - } - - /** * コネクションのベンドポイント情報を設定する。 * @param connectionLayouts コネクションのベンドポイント情報 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 @@ -182,17 +135,6 @@ } /** - * {@inheritDoc} - */ - public void setConstraint(NodeAdapter node, JmRectangle constraint) { - assert nodeLayouts != null; - Validate.notNull(node); - Validate.notNull(constraint); - - nodeLayouts.put(node, constraint); - } - - /** * 表示モードを設定する。 * @param displayTargetSet 表示モード * @throws IllegalArgumentException 引数に{@code null}を与えた場合 @@ -211,112 +153,14 @@ } /** - * ノードの色情報を設定する。 - * @param nodeColors ノードの色情報 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - public void setNodeColors(Map<NodeAdapter, JmColor> nodeColors) { - Validate.notNull(nodeColors); - ValidateUtil.injectionSetter(this.nodeColors); - this.nodeColors = nodeColors; - } - - /** * ノードのレイアウト情報を設定する。 - * @param nodeLayouts ノードのレイアウト情報 + * @param nodeProfiles ノードのレイアウト情報 * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ - public void setNodeLayouts(Map<NodeAdapter, JmRectangle> nodeLayouts) { - Validate.notNull(nodeLayouts); - ValidateUtil.injectionSetter(this.nodeLayouts); - this.nodeLayouts = nodeLayouts; + public void setNodeLayouts(Map<NodeAdapter, NodeProfile> nodeProfiles) { + Validate.notNull(nodeProfiles); + ValidateUtil.injectionSetter(this.nodeProfiles); + this.nodeProfiles = nodeProfiles; } - /** - * ノードの集合を設定する。 - * - * @param nodes ノードの集合 - */ - public void setNodes(Collection<NodeAdapter> nodes) { - Validate.notNull(nodes); - ValidateUtil.injectionSetter(this.nodes); - this.nodes = nodes; - } - - - private class NodesProxy extends AbstractCollection<NodeAdapter> implements Collection<NodeAdapter> { - - /** - * {@inheritDoc} - */ - @Override - public boolean add(NodeAdapter o) { - if (o.unwrap() != null) { - throw new IllegalArgumentException(); - } - - return nodes.add(o); - } - - /** - * {@inheritDoc} - * - * <p>注意:エンティティノードはクリアされない。</p> - */ - @Override - public void clear() { - nodes.clear(); - } - - /** - * {@inheritDoc} - */ - @Override - public Iterator<NodeAdapter> iterator() { - return new Itr(); - } - - /** - * {@inheritDoc} - */ - @Override - public int size() { - return entities.size() + nodes.size(); - } - - - private class Itr implements Iterator<NodeAdapter> { - - private Iterator<NodeAdapter> nodeItr = nodes.iterator(); - - private Iterator<EntityModel> entityItr = entities.iterator(); - - - /** - * {@inheritDoc} - */ - public boolean hasNext() { - return nodeItr.hasNext() || entityItr.hasNext(); - } - - /** - * {@inheritDoc} - */ - public NodeAdapter next() { - if (entityItr.hasNext()) { - EntityModel entityModel = entityItr.next(); - return entityModel.getAdapter(NodeAdapter.class); - } - return nodeItr.next(); - } - - /** - * {@inheritDoc} - */ - public void remove() { - throw new UnsupportedOperationException(); - } - - } - } } Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/test/ViewTestModelBuilder.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/test/ViewTestModelBuilder.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/test/ViewTestModelBuilder.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -25,11 +25,13 @@ import org.jiemamy.OfficialSpecs; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; +import org.jiemamy.model.NodeProfile; import org.jiemamy.model.connection.ConnectionAdapter; import org.jiemamy.model.geometory.JmPoint; import org.jiemamy.model.geometory.JmRectangle; import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.model.node.StickyModel; +import org.jiemamy.utils.model.PresentationUtil; /** * Jiemamy VIEW仕様範囲を含めたJiemamyテストモデル1(EMP-DEPTテーブル)を組み立てるビルダ。 @@ -146,28 +148,30 @@ DiagramPresentationModel presentation = factory.newModel(DiagramPresentationModel.class, uuid.get("1deca0e8-6153-47ad-abe8-ac764f768d96")); presentation.setName("全部表示する"); - presentation.getNodeLayouts().put(tableEmp.getAdapter(NodeAdapter.class), new JmRectangle(360, 60)); - presentation.getNodeLayouts().put(tableDept.getAdapter(NodeAdapter.class), new JmRectangle(60, 60)); - presentation.getNodeLayouts().put(viewHighSal.getAdapter(NodeAdapter.class), new JmRectangle(60, 270)); - presentation.getNodeLayouts().put(sticky, new JmRectangle(360, 270)); + PresentationUtil.setLayout(presentation, tableEmp.getAdapter(NodeAdapter.class), new JmRectangle(360, 60)); + PresentationUtil.setLayout(presentation, tableDept.getAdapter(NodeAdapter.class), new JmRectangle(60, 60)); + PresentationUtil.setLayout(presentation, viewHighSal.getAdapter(NodeAdapter.class), + new JmRectangle(60, 270)); + PresentationUtil.setLayout(presentation, sticky, new JmRectangle(360, 270)); List<JmPoint> bendpoints = new ArrayList<JmPoint>(); - JmRectangle rect = presentation.getNodeLayouts().get(tableEmp.getAdapter(NodeAdapter.class)); + NodeProfile nodeProf = presentation.getFigureProfiles().get(tableEmp.getAdapter(NodeAdapter.class)); + JmRectangle rect = nodeProf.getLayout(); bendpoints.add(0, new JmPoint(Math.max(rect.x - offset, 0), rect.y)); bendpoints.add(1, new JmPoint(rect.x, Math.max(rect.y - offset, 0))); presentation.getConnectionLayouts().put(fkEmpEmp.getAdapter(ConnectionAdapter.class), bendpoints); presentation.getConnectionLayouts().put(fkEmpDept.getAdapter(ConnectionAdapter.class), new ArrayList<JmPoint>()); // bendpount無し - presentation.getNodes().add(sticky); rootModel.getAdapter(DiagramPresentations.class).add(presentation); // ダイアグラム表現の生成・追加(2) presentation = factory.newModel(DiagramPresentationModel.class, uuid.get("53c7cdb7-1512-46c7-8ee3-aadec6007896")); presentation.setName("一部表示する"); - presentation.getNodeLayouts().put(tableEmp.getAdapter(NodeAdapter.class), new JmRectangle(60, 60)); - presentation.getNodeLayouts().put(viewHighSal.getAdapter(NodeAdapter.class), new JmRectangle(270, 270)); - presentation.getConnectionLayouts().put(fkEmpDept.getAdapter(ConnectionAdapter.class), + PresentationUtil.setLayout(presentation, tableEmp.getAdapter(NodeAdapter.class), new JmRectangle(60, 60)); + PresentationUtil.setLayout(presentation, viewHighSal.getAdapter(NodeAdapter.class), new JmRectangle(270, + 270)); + PresentationUtil.setLayout(presentation, fkEmpDept.getAdapter(ConnectionAdapter.class), new ArrayList<JmPoint>()); // bendpount無し rootModel.getAdapter(DiagramPresentations.class).add(presentation); } Added: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java (rev 0) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -0,0 +1,88 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/04 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.utils.model; + +import java.util.List; + +import org.jiemamy.JiemamyFactory; +import org.jiemamy.model.DiagramPresentationModel; +import org.jiemamy.model.NodeProfile; +import org.jiemamy.model.connection.ConnectionAdapter; +import org.jiemamy.model.geometory.JmColor; +import org.jiemamy.model.geometory.JmPoint; +import org.jiemamy.model.geometory.JmRectangle; +import org.jiemamy.model.node.NodeAdapter; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public class PresentationUtil { + + /** + * TODO for daisuke + * + * @param presentation + * @param nodeAdapter + * @param color + */ + public static void setColor(DiagramPresentationModel presentation, NodeAdapter nodeAdapter, JmColor color) { + NodeProfile nodeProfile = presentation.getFigureProfiles().get(nodeAdapter); + if (nodeProfile == null) { + JiemamyFactory factory = presentation.getJiemamy().getFactory(); + nodeProfile = factory.newModel(NodeProfile.class); + presentation.getFigureProfiles().put(nodeAdapter, nodeProfile); + } + nodeProfile.setColor(color); + } + + /** + * TODO for daisuke + * + * @param presentation + * @param adapter + * @param bendpoints + */ + public static void setLayout(DiagramPresentationModel presentation, ConnectionAdapter adapter, + List<JmPoint> bendpoints) { + presentation.getConnectionLayouts().put(adapter, bendpoints); + } + + /** + * TODO for daisuke + * + * @param presentation + * @param nodeAdapter + * @param rect + */ + public static void setLayout(DiagramPresentationModel presentation, NodeAdapter nodeAdapter, JmRectangle rect) { + NodeProfile nodeProfile = presentation.getFigureProfiles().get(nodeAdapter); + if (nodeProfile == null) { + JiemamyFactory factory = presentation.getJiemamy().getFactory(); + nodeProfile = factory.newModel(NodeProfile.class); + presentation.getFigureProfiles().put(nodeAdapter, nodeProfile); + } + nodeProfile.setLayout(rect); + + } + + private PresentationUtil() { + } +} Property changes on: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/utils/model/PresentationUtil.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetColorProcessorTest.java =================================================================== --- artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetColorProcessorTest.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetColorProcessorTest.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,102 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/10 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.jiemamy.Artemis; -import org.jiemamy.ArtemisView; -import org.jiemamy.Jiemamy; -import org.jiemamy.JiemamyFactory; -import org.jiemamy.Migration; -import org.jiemamy.model.DiagramPresentationModel; -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.entity.TableModel; -import org.jiemamy.model.geometory.JmColor; -import org.jiemamy.model.node.NodeAdapter; - -/** - * {@link SetColorProcessor}のテストクラス。 - * @author daisuke - */ -public class SetColorProcessorTest { - - private JiemamyFactory factory; - - private RootModel rootModel; - - private TableModel tableModel; - - - /** - * setup - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - Jiemamy jiemamy = Jiemamy.newInstance(new Artemis(new ArtemisView())); - factory = jiemamy.getFactory(); - rootModel = factory.getRootModel(); - DiagramPresentationModel presentation = factory.newModel(DiagramPresentationModel.class); - presentation.setName("テスト"); - rootModel.getAdapter(DiagramPresentations.class).add(presentation); - - tableModel = factory.newModel(TableModel.class); - tableModel.setName("T_TEST"); - rootModel.getEntities().add(tableModel); - } - - /** - * teardown - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - rootModel = null; - tableModel = null; - factory = null; - } - - /** - * tableModelに背景色情報を与えることができる。 - * @throws Exception - */ - @Test - public void test01_tableModelに背景色情報を与えることができる() throws Exception { - JmColor result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeColors().get(tableModel); - assertThat(result, is(nullValue())); - - NodeAdapter node = tableModel.getAdapter(NodeAdapter.class); - DiagramPresentationModel diagramPresentationModel = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); - diagramPresentationModel.setColor(node, new JmColor(10, 20, 30)); - - result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeColors().get(node); - assertThat(result.red, is(10)); - assertThat(result.green, is(20)); - assertThat(result.blue, is(30)); - } -} Deleted: artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetConstraintProcessorTest.java =================================================================== --- artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetConstraintProcessorTest.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/internal/processor/SetConstraintProcessorTest.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -1,101 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/10 - * - * This file is part of Jiemamy. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ -package org.jiemamy.internal.processor; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import org.jiemamy.Artemis; -import org.jiemamy.ArtemisView; -import org.jiemamy.Jiemamy; -import org.jiemamy.JiemamyFactory; -import org.jiemamy.Migration; -import org.jiemamy.model.DiagramPresentationModel; -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.entity.TableModel; -import org.jiemamy.model.geometory.JmRectangle; -import org.jiemamy.model.node.NodeAdapter; - -/** - * {@link SetConstraintProcessor}のテストクラス。 - * @author daisuke - */ -public class SetConstraintProcessorTest { - - private JiemamyFactory factory; - - private RootModel rootModel; - - private TableModel tableModel; - - - /** - * setup - * @throws java.lang.Exception - */ - @Before - public void setUp() throws Exception { - Jiemamy jiemamy = Jiemamy.newInstance(new Artemis(new ArtemisView())); - factory = jiemamy.getFactory(); - rootModel = factory.getRootModel(); - DiagramPresentationModel presentation = factory.newModel(DiagramPresentationModel.class); - presentation.setName("テスト"); - rootModel.getAdapter(DiagramPresentations.class).add(presentation); - - tableModel = factory.newModel(TableModel.class); - tableModel.setName("T_TEST"); - rootModel.getEntities().add(tableModel); - } - - /** - * teardown - * @throws java.lang.Exception - */ - @After - public void tearDown() throws Exception { - rootModel = null; - tableModel = null; - factory = null; - } - - /** - * tableModelに位置サイズ情報を与えることができる。 - * @throws Exception - */ - @Test - public void test01_tableModelに位置サイズ情報を与えることができる() throws Exception { - JmRectangle result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeLayouts().get(tableModel); - assertThat(result, is(nullValue())); - - NodeAdapter node = tableModel.getAdapter(NodeAdapter.class); - DiagramPresentationModel diagramPresentationModel = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); - diagramPresentationModel.setConstraint(node, new JmRectangle(100, 200)); - - result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeLayouts().get(node); - assertThat(result.x, is(100)); - assertThat(result.y, is(200)); - } -} Modified: artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/model/DiagramPresentationModelImplTest.java =================================================================== --- artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/model/DiagramPresentationModelImplTest.java 2009-02-03 23:04:12 UTC (rev 2614) +++ artemis/trunk/jiemamy-view/src/test/java/org/jiemamy/model/DiagramPresentationModelImplTest.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -76,14 +76,12 @@ */ @Test public void test01_各プロパティが正常に初期化されていること() throws Exception { - assertThat(presentation.getNodeLayouts(), is(notNullValue())); - assertThat(presentation.getNodeColors(), is(notNullValue())); + assertThat(presentation.getFigureProfiles(), is(notNullValue())); assertThat(presentation.getConnectionLayouts(), is(notNullValue())); assertThat(presentation.getDisplayTargetSet(), is(notNullValue())); assertThat(presentation.getName(), is("testPresentation")); - assertThat(presentation.getNodeLayouts().size(), is(0)); - assertThat(presentation.getNodeColors().size(), is(0)); + assertThat(presentation.getFigureProfiles().size(), is(0)); assertThat(presentation.getConnectionLayouts().size(), is(0)); assertThat(presentation.getDisplayTargetSet().size(), is(0)); } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/AutoLayoutAction.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -37,12 +37,14 @@ import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.editpart.diagram.AbstractNodeEditPart; +import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.connection.ConnectionAdapter; import org.jiemamy.model.geometory.JmPoint; import org.jiemamy.model.geometory.JmRectangle; import org.jiemamy.model.node.NodeAdapter; +import org.jiemamy.utils.model.PresentationUtil; /** * 自動レイアウトアクション。 @@ -169,8 +171,7 @@ private int oldY; - private Map<ConnectionAdapter, List<JmPoint>> oldBendpoints = - new HashMap<ConnectionAdapter, List<JmPoint>>(); + private Map<ConnectionAdapter, List<JmPoint>> oldBendpoints = new HashMap<ConnectionAdapter, List<JmPoint>>(); /** @@ -186,11 +187,11 @@ this.x = x; this.y = y; oldX = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - target).x; + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles() + .get(target).getLayout().x; oldY = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - target).y; + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles() + .get(target).getLayout().y; } /** @@ -198,8 +199,10 @@ */ @Override public void execute() { - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().put(target, - new JmRectangle(x, y, -1, -1)); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + PresentationUtil.setLayout(presentation, target, new JmRectangle(x, y, -1, -1)); +// PresentationUtil.setColor(presentation, target, color); oldBendpoints.clear(); for (ConnectionAdapter conn : target.getSourceConnections()) { List<JmPoint> points = @@ -219,8 +222,9 @@ rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getConnectionLayouts() .put(conn, oldBendpoints.get(conn)); } - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().put(target, - new JmRectangle(oldX, oldY, -1, -1)); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + PresentationUtil.setLayout(presentation, target, new JmRectangle(oldX, oldY, -1, -1)); } } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/FitNodeConstraintAction.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/FitNodeConstraintAction.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/action/FitNodeConstraintAction.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -24,6 +24,7 @@ import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.command.ChangeNodeConstraintCommand; +import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.geometory.JmRectangle; @@ -54,10 +55,11 @@ if (model instanceof NodeAdapter) { NodeAdapter nodeAdapter = (NodeAdapter) model; CommandStack stack = getViewer().getEditDomain().getCommandStack(); - JmRectangle constraint = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - nodeAdapter); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmRectangle constraint = presentation.getFigureProfiles().get(nodeAdapter).getLayout(); + JmRectangle newConstraint = new JmRectangle(constraint.x, constraint.y, -1, -1); Command command = new ChangeNodeConstraintCommand(rootModel, nodeAdapter, newConstraint, getViewer()); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeColorCommand.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -52,8 +52,8 @@ this.rootModel = rootModel; this.nodeAdapter = nodeAdapter; oldColor = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeColors().get( - nodeAdapter); + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles().get( + nodeAdapter).getColor(); this.newColor = newColor; } @@ -62,8 +62,8 @@ */ @Override public void execute() { - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeColors().put(nodeAdapter, - newColor); + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles().get( + nodeAdapter).setColor(newColor); } /** @@ -71,7 +71,7 @@ */ @Override public void undo() { - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeColors().put(nodeAdapter, - oldColor); + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles().get( + nodeAdapter).setColor(oldColor); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/ChangeNodeConstraintCommand.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -65,8 +65,8 @@ this.rootModel = rootModel; this.nodeAdapter = nodeAdapter; oldConstraint = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - nodeAdapter); + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles().get( + nodeAdapter).getLayout(); constraint = rectangle; this.viewer = viewer; @@ -95,8 +95,8 @@ @Override public void execute() { // 本体の移動 - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().put(nodeAdapter, - constraint); + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles().get( + nodeAdapter).setLayout(constraint); // ベンドポイントの移動 shiftBendpoints(false); @@ -110,8 +110,8 @@ */ @Override public void undo() { - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().put(nodeAdapter, - constraint); + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getFigureProfiles().get( + nodeAdapter).setLayout(oldConstraint); shiftBendpoints(true); shiftPosition(true); } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateNodeCommand.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -59,12 +59,10 @@ public void execute() { DiagramPresentationModel diagramPresentationModel = rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); - if (nodeAdapter.unwrap() == null) { - diagramPresentationModel.getNodes().add(nodeAdapter); - } else { + if (nodeAdapter.unwrap() != null) { rootModel.getEntities().add(nodeAdapter.unwrap()); } - diagramPresentationModel.getNodeLayouts().put(nodeAdapter, ConvertUtil.convert(rectangle)); + diagramPresentationModel.getFigureProfiles().get(nodeAdapter).setLayout(ConvertUtil.convert(rectangle)); } /** @@ -74,11 +72,9 @@ public void undo() { DiagramPresentationModel diagramPresentationModel = rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); - if (nodeAdapter.unwrap() == null) { - diagramPresentationModel.getNodes().remove(nodeAdapter); - } else { + if (nodeAdapter.unwrap() != null) { rootModel.getEntities().remove(nodeAdapter.unwrap()); } - diagramPresentationModel.getNodeLayouts().put(nodeAdapter, ConvertUtil.convert(rectangle)); + diagramPresentationModel.getFigureProfiles().get(nodeAdapter).setLayout(ConvertUtil.convert(rectangle)); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/DeleteNodeCommand.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -85,9 +85,7 @@ public void undo() { DiagramPresentationModel diagramPresentationModel = rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); - if (targetNode.unwrap() == null) { - diagramPresentationModel.getNodes().add(targetNode); - } else { + if (targetNode.unwrap() != null) { rootModel.getEntities().add(targetNode.unwrap()); } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/MovePositionCommand.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -69,17 +69,17 @@ DiagramPresentationModel diagramPresentationModel = rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); - for (NodeAdapter node : diagramPresentationModel.getNodes()) { + for (NodeAdapter node : diagramPresentationModel.getFigureProfiles().keySet()) { // エンティティの移動 - JmRectangle rect = diagramPresentationModel.getNodeLayouts().get(node); + JmRectangle rect = diagramPresentationModel.getFigureProfiles().get(node).getLayout(); JmRectangle newRect; if (negative) { newRect = new JmRectangle(rect.x - shift.x, rect.y - shift.y, rect.width, rect.height); } else { newRect = new JmRectangle(rect.x + shift.x, rect.y + shift.y, rect.width, rect.height); } - diagramPresentationModel.getNodeLayouts().put(node, newRect); + diagramPresentationModel.getFigureProfiles().get(node).setLayout(newRect); // ベンドポイントの移動 for (ConnectionAdapter connection : node.getSourceConnections()) { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/RootEditPart.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -167,7 +167,7 @@ protected List<NodeAdapter> getModelChildren() { // THINK 詰め替えしていいのかなぁ。 return CollectionsUtil.newArrayList(((RootModel) getModel()).getAdapter(DiagramPresentations.class).get( - Migration.DIAGRAM_INDEX).getNodes()); + Migration.DIAGRAM_INDEX).getFigureProfiles().keySet()); } private void setConnectionRouter(IFigure figure) { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/StickyEditPart.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -32,6 +32,7 @@ import org.jiemamy.eclipse.editor.figure.StickyFigure; import org.jiemamy.eclipse.utils.ConvertUtil; import org.jiemamy.event.ModelChangeEvent; +import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.geometory.JmColor; @@ -137,9 +138,9 @@ StickyModel stickyModel = (StickyModel) getModel(); GraphicalEditPart editPart = (GraphicalEditPart) getParent(); - JmRectangle constraint = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - stickyModel); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmRectangle constraint = presentation.getFigureProfiles().get(stickyModel).getLayout(); editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint)); updateFigure(getFigure()); @@ -155,9 +156,9 @@ StickyModel stickyModel = (StickyModel) getModel(); StickyFigure stickyFigure = (StickyFigure) figure; - JmColor color = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeColors().get( - stickyModel); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmColor color = presentation.getFigureProfiles().get(stickyModel).getColor(); stickyFigure.setContents(stickyModel.getContents()); stickyFigure.setBgColor(ConvertUtil.convert(color)); } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -38,6 +38,7 @@ import org.jiemamy.eclipse.utils.ConvertUtil; import org.jiemamy.event.ModelChangeEvent; import org.jiemamy.exception.TooManyElementsException; +import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.DiagramPresentationModel.DisplayItem; @@ -158,9 +159,9 @@ EntityModel entityModel = (EntityModel) getModel(); GraphicalEditPart editPart = (GraphicalEditPart) getParent(); - JmRectangle constraint = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - entityModel); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmRectangle constraint = presentation.getFigureProfiles().get(entityModel).getLayout(); editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint)); updateFigure(getFigure()); @@ -178,9 +179,9 @@ String labelString = ProcessorUtil.process(rootModel, new LabelStringProcessor(tableModel, DisplayTarget.NAME, DisplayPlace.FIGURE)); - JmColor color = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeColors().get( - tableModel); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmColor color = presentation.getFigureProfiles().get(tableModel).getColor(); tableFigure.setTableName(labelString); tableFigure.setBgColor(ConvertUtil.convert(color)); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -33,6 +33,7 @@ import org.jiemamy.eclipse.editor.figure.ViewFigure; import org.jiemamy.eclipse.utils.ConvertUtil; import org.jiemamy.event.ModelChangeEvent; +import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.entity.EntityModel; @@ -128,9 +129,9 @@ EntityModel entityModel = (EntityModel) getModel(); GraphicalEditPart editPart = (GraphicalEditPart) getParent(); - JmRectangle constraint = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeLayouts().get( - entityModel); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmRectangle constraint = presentation.getFigureProfiles().get(entityModel).getLayout(); editPart.setLayoutConstraint(this, getFigure(), ConvertUtil.convert(constraint)); updateFigure(getFigure()); @@ -148,9 +149,9 @@ String labelString = ProcessorUtil.process(rootModel, new LabelStringProcessor(viewModel, DisplayTarget.NAME, DisplayPlace.FIGURE)); - JmColor color = - rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodeColors().get( - viewModel); + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + JmColor color = presentation.getFigureProfiles().get(viewModel).getColor(); viewFigure.setEntityName(labelString); viewFigure.setBgColor(ConvertUtil.convert(color)); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java 2009-02-03 23:04:12 UTC (rev 2614) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/RootTreeEditPart.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -24,6 +24,7 @@ import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.ModelContainer; import org.jiemamy.event.ModelChangeEvent; +import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.RootModel; import org.jiemamy.model.datatype.DomainModel; @@ -65,7 +66,9 @@ ModelContainer viewContainer = new ModelContainer("outline.views"); ModelContainer domainContainer = new ModelContainer("outline.domains"); - for (NodeAdapter node : rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX).getNodes()) { + DiagramPresentationModel presentation = + rootModel.getAdapter(DiagramPresentations.class).get(Migration.DIAGRAM_INDEX); + for (NodeAdapter node : presentation.getFigureProfiles().keySet()) { if (node instanceof TableModel) { tableContainer.getChildren().add(node); } else if (node instanceof ViewModel) { Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-view.xsd =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-view.xsd 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-core/src/main/resources/jiemamy-view.xsd 2009-02-04 07:45:14 UTC (rev 2615) @@ -28,41 +28,72 @@ <xsd:complexType> <xsd:sequence> <xsd:element ref="core:name" /> - <xsd:element name="nodes" minOccurs="0"> + <xsd:element name="nodeLayouts" minOccurs="0"> <xsd:complexType> <xsd:sequence minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="sticky" maxOccurs="unbounded" /> + <xsd:element ref="nodeLayout" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> </xsd:element> - <xsd:element name="connections" minOccurs="0"> + <xsd:element name="connectionLayouts" minOccurs="0"> <xsd:complexType> <xsd:choice minOccurs="0" maxOccurs="unbounded"> - <xsd:element ref="connection"/> + <xsd:element ref="connectionLayout" maxOccurs="unbounded" /> </xsd:choice> </xsd:complexType> </xsd:element> - <xsd:element ref="node" maxOccurs="unbounded" /> - <xsd:element ref="connection" maxOccurs="unbounded" /> </xsd:sequence> <xsd:attribute name="id" type="core:uuidType" use="required" /> </xsd:complexType> </xsd:element> - <xsd:element name="node"> + <xsd:element name="nodeLayout"> <xsd:complexType> - <xsd:attribute name="ref" type="core:uuidRefType" use="required" /> - <xsd:attribute name="x" type="overMinusOneType" default="-1" /> - <xsd:attribute name="y" type="overMinusOneType" default="-1" /> - <xsd:attribute name="width" type="overMinusOneType" default="-1" /> - <xsd:attribute name="height" type="overMinusOneType" default="-1" /> - <xsd:attribute name="color" type="colorType" /> + <xsd:sequence> + <xsd:choice> + <xsd:element ref="nodeObjectRef"/> + <xsd:element ref="sticky"/> + </xsd:choice> + <xsd:element name="boundary"> + <xsd:complexType> + <xsd:attribute name="x" type="overMinusOneType" default="-1" /> + <xsd:attribute name="y" type="overMinusOneType" default="-1" /> + <xsd:attribute name="width" type="overMinusOneType" default="-1" /> + <xsd:attribute name="height" type="overMinusOneType" default="-1" /> + <xsd:attribute name="color" type="colorType" /> + </xsd:complexType> + </xsd:element> + </xsd:sequence> </xsd:complexType> </xsd:element> - <xsd:element name="connection"> + <xsd:element name="connectionLayout"> <xsd:complexType> <xsd:sequence> + <xsd:choice> + <xsd:element ref="connectionObjectRef"/> + </xsd:choice> + <xsd:element ref="bendpoints" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + + + <xsd:element name="nodeObjectRef"> + <xsd:complexType> + <xsd:attribute name="ref" type="core:uuidType" use="required" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="connectionObjectRef"> + <xsd:complexType> + <xsd:attribute name="ref" type="core:uuidType" use="required" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="bendpoints"> + <xsd:complexType> + <xsd:sequence> <xsd:element name="bendpoint" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:attribute name="x" type="overMinusOneType" default="-1" /> @@ -70,11 +101,9 @@ </xsd:complexType> </xsd:element> </xsd:sequence> - <xsd:attribute name="ref" type="core:uuidRefType" use="required" /> </xsd:complexType> </xsd:element> - - + <xsd:element name="sticky"> <xsd:annotation> <xsd:documentation source="description" xml:lang="en">sticky</xsd:documentation> Modified: zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-core/src/main/resources/sample.xml 2009-02-04 07:45:14 UTC (rev 2615) @@ -490,26 +490,56 @@ <view:diagramPresentations xmlns:view="http://jiemamy.org/xml/ns/view"> <view:diagramPresentation id="1deca0e8-6153-47ad-abe8-ac764f768d96"> <name>全部表示する</name> - <view:nodes> - <view:sticky id="43beb884-2562-4480-8030-bb797f701783"> - <view:contents>メモーー</view:contents> - </view:sticky> - </view:nodes> - <view:node height="-1" ref="9f522e56-809c-45fd-8416-39201014218b" width="-1" x="360" y="60" color="#ff00ff"/> - <view:node height="-1" ref="d7489ed6-0add-443d-95cf-234376eb0455" width="-1" x="60" y="60" color="#ff00ff"/> - <view:node height="-1" ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4" width="-1" x="60" y="270" color="#ff00ff"/> - <view:node height="-1" ref="43beb884-2562-4480-8030-bb797f701783" width="-1" x="360" y="270" color="#ff00ff"/> - <view:connection ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"> - <view:bendpoint x="310" y="60"/> - <view:bendpoint x="360" y="10"/> - </view:connection> - <view:connection ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> + <view:nodeLayouts> + <view:nodeLayout> + <view:sticky id="43beb884-2562-4480-8030-bb797f701783"> + <view:contents>メモーー</view:contents> + </view:sticky> + <view:boundary color="#ff00ff" height="-1" width="-1" x="360" y="270"/> + </view:nodeLayout> + <view:nodeLayout> + <view:nodeObjectRef ref="9f522e56-809c-45fd-8416-39201014218b"/> + <view:boundary color="#ff00ff" height="-1" width="-1" x="360" y="60"/> + </view:nodeLayout> + <view:nodeLayout> + <view:nodeObjectRef ref="d7489ed6-0add-443d-95cf-234376eb0455"/> + <view:boundary color="#ff00ff" height="-1" width="-1" x="60" y="60"/> + </view:nodeLayout> + <view:nodeLayout> + <view:nodeObjectRef ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4"/> + <view:boundary color="#ff00ff" height="-1" width="-1" x="60" y="270"/> + </view:nodeLayout> + </view:nodeLayouts> + <view:connectionLayouts> + <view:connectionLayout> + <view:connectionObjectRef ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> + </view:connectionLayout> + <view:connectionLayout> + <view:connectionObjectRef ref="e43d3c43-33c8-4b02-aa42-83f2d868cfe6"/> + <view:bendpoints> + <view:bendpoint x="310" y="60"/> + <view:bendpoint x="360" y="10"/> + </view:bendpoints> + </view:connectionLayout> + </view:connectionLayouts> </view:diagramPresentation> <view:diagramPresentation id="53c7cdb7-1512-46c7-8ee3-aadec6007896"> <name>一部表示する</name> - <view:node height="-1" ref="9f522e56-809c-45fd-8416-39201014218b" width="-1" x="60" y="60" color="#ff00ff"/> - <view:node height="-1" ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4" width="-1" x="270" y="270" color="#ff00ff"/> - <view:connection ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> + <view:nodeLayouts> + <view:nodeLayout> + <view:nodeObjectRef ref="9f522e56-809c-45fd-8416-39201014218b"/> + <view:boundary color="#ff00ff" height="-1" width="-1" x="60" y="60"/> + </view:nodeLayout> + <view:nodeLayout> + <view:nodeObjectRef ref="516f7961-cb7b-48e2-990b-7fb0c750c3a4"/> + <view:boundary color="#ff00ff" height="-1" width="-1" x="270" y="270"/> + </view:nodeLayout> + </view:nodeLayouts> + <view:connectionLayouts> + <view:connectionLayout> + <view:connectionObjectRef ref="e7dd92b4-1d97-4be6-bab6-fa9fe26eb6ed"/> + </view:connectionLayout> + </view:connectionLayouts> </view:diagramPresentation> </view:diagramPresentations> </rootModel> Modified: zeus/trunk/jiemamy-spec-view/.classpath =================================================================== --- zeus/trunk/jiemamy-spec-view/.classpath 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-view/.classpath 2009-02-04 07:45:14 UTC (rev 2615) @@ -2,6 +2,8 @@ <classpath> <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/main/resources"/> + <classpathentry kind="src" path="src/test/java"/> + <classpathentry kind="src" path="src/test/resources"/> <classpathentry kind="con" path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> <classpathentry combineaccessrules="false" kind="src" path="/jiemamy-irenka"/> Modified: zeus/trunk/jiemamy-spec-view/pom.xml =================================================================== --- zeus/trunk/jiemamy-spec-view/pom.xml 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-view/pom.xml 2009-02-04 07:45:14 UTC (rev 2615) @@ -32,6 +32,18 @@ </scm> <dependencies> <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-library</artifactId> + <version>1.1</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>${project.groupId}</groupId> <artifactId>jiemamy-spec-core</artifactId> <version>${project.version}</version> Modified: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/DiagramPresentationModel.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/DiagramPresentationModel.java 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/DiagramPresentationModel.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -18,15 +18,12 @@ */ package org.jiemamy.model; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; import org.jiemamy.model.connection.ConnectionAdapter; -import org.jiemamy.model.geometory.JmColor; import org.jiemamy.model.geometory.JmPoint; -import org.jiemamy.model.geometory.JmRectangle; import org.jiemamy.model.node.NodeAdapter; /** @@ -48,29 +45,16 @@ Set<DisplayItem> getDisplayTargetSet(); /** - * プレゼンテーション名を取得する。 - * @return プレゼンテーション名 - */ - String getName(); - - /** - * ノードの色情報を取得する。 - * @return ノードの色情報 - */ - Map<NodeAdapter, JmColor> getNodeColors(); - - /** * ノードのレイアウト情報を取得する。 * @return ノードのレイアウト情報 */ - Map<NodeAdapter, JmRectangle> getNodeLayouts(); + Map<NodeAdapter, NodeProfile> getFigureProfiles(); /** - * TODO for daisuke - * - * @return + * プレゼンテーション名を取得する。 + * @return プレゼンテーション名 */ - Collection<NodeAdapter> getNodes(); + String getName(); /** * ベンドポイントを初期化する。 @@ -82,6 +66,7 @@ * @param connection 設定対象コネクション * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ + @Deprecated void resetBendpoints(ConnectionAdapter connection); /** @@ -93,25 +78,10 @@ * @param bendpoints ベンドポイント情報のリスト * @throws IllegalArgumentException 引数に{@code null}を与えた場合 */ + @Deprecated void setBendpoints(ConnectionAdapter connection, List<JmPoint> bendpoints); /** - * ノードの背景色情報を設定する。 - * @param node 設定対象ノード - * @param color 背景色情報 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - void setColor(NodeAdapter node, JmColor color); - - /** - * ノードの位置サイズ情報を設定する。 - * @param node 設定対象ノード - * @param constraint 位置サイズ情報 - * @throws IllegalArgumentException 引数に{@code null}を与えた場合 - */ - void setConstraint(NodeAdapter node, JmRectangle constraint); - - /** * プレゼンテーション名を設定する。 * @param name プレゼンテーション名 */ Added: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java (rev 0) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -0,0 +1,47 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/04 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.model; + +import org.jiemamy.model.geometory.JmColor; +import org.jiemamy.model.geometory.JmRectangle; + +/** + * ノードの見た目情報。 + * + * @author daisuke + */ +public interface NodeProfile extends JiemamyElement { + + /** + * ノードの色情報を取得する。 + * @return ノードの色情報 + */ + JmColor getColor(); + + /** + * ノードのレイアウト情報を取得する。 + * @return ノードのレイアウト情報 + */ + JmRectangle getLayout(); + + void setColor(JmColor color); + + void setLayout(JmRectangle layout); + +} Property changes on: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/NodeProfile.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/geometory/JmColor.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -37,6 +37,25 @@ private static final int MIN = -1; + + /** + * TODO for daisuke + * + * @param value + * @return + */ + public static JmColor parse(String value) { + if (value == null || value.length() != 7) { + return null; + } + int red = Integer.valueOf(value.substring(1, 3), 16); + int green = Integer.valueOf(value.substring(3, 5), 16); + int blue = Integer.valueOf(value.substring(5, 7), 16); + + return new JmColor(red, green, blue); + } + + /** 赤 */ public final int red; @@ -105,11 +124,14 @@ } /** - * {@inheritDoc} + * #xxxxxx形式の文字列として出力を行う。 */ @Override public String toString() { - return "#" + Integer.toHexString(red) + Integer.toHexString(green) + Integer.toHexString(blue); + if (red == DEFAULT || green == DEFAULT || blue == DEFAULT) { + return ""; + } + return String.format("#%02x%02x%02x", red, green, blue); } /** Modified: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/xml/ViewQName.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/xml/ViewQName.java 2009-02-03 23:04:12 UTC (rev 2614) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/xml/ViewQName.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -34,12 +34,36 @@ DIAGRAM_PRESENTATION(CoreNamespace.NS_VIEW, "diagramPresentation"), /***/ - NODE(CoreNamespace.NS_VIEW, "node"), + NODE_LAYOUTS(CoreNamespace.NS_VIEW, "nodeLayouts"), /***/ - CONNECTION(CoreNamespace.NS_VIEW, "connection"), + NODE_LAYOUT(CoreNamespace.NS_VIEW, "nodeLayout"), /***/ + NODE_OBJECT_REF(CoreNamespace.NS_VIEW, "nodeObjectRef"), + + /***/ + STICKY(CoreNamespace.NS_VIEW, "sticky"), + + /***/ + CONTENTS(CoreNamespace.NS_VIEW, "contents"), + + /***/ + BOUNDARY(CoreNamespace.NS_VIEW, "boundary"), + + /***/ + CONNECTION_LAYOUTS(CoreNamespace.NS_VIEW, "connectionLayouts"), + + /***/ + CONNECTION_LAYOUT(CoreNamespace.NS_VIEW, "connectionLayout"), + + /***/ + CONNECTION_OBJECT_REF(CoreNamespace.NS_VIEW, "connectionObjectRef"), + + /***/ + BENDPOINTS(CoreNamespace.NS_VIEW, "bendpoints"), + + /***/ BENDPOINT(CoreNamespace.NS_VIEW, "bendpoint"); /** XML仕様における完全修飾名 */ Added: zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java (rev 0) +++ zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java 2009-02-04 07:45:14 UTC (rev 2615) @@ -0,0 +1,71 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/04 + * + * This file is part of Jiemamy. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package org.jiemamy.model.geometory; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * TODO for daisuke + * + * @author daisuke + */ +public class JmColorTest { + + /** + * TODO for daisuke + * + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + } + + /** + * TODO for daisuke + * + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + } + + @Test + public void test01_toString() throws Exception { + assertThat(new JmColor(0, 0, 0).toString(), is("#000000")); + assertThat(new JmColor(0, 1, 2).toString(), is("#000102")); + assertThat(new JmColor(10, 11, 12).toString(), is("#0a0b0c")); + assertThat(new JmColor(0x10, 0x11, 0x12).toString(), is("#101112")); + assertThat(new JmColor(255, 255, 255).toString(), is("#ffffff")); + assertThat(new JmColor(255, 255, 255).toString(), is("#ffffff")); + } + + @Test + public void test02_parse() throws Exception { + assertThat(JmColor.parse("#000000"), is(new JmColor(0, 0, 0))); + assertThat(JmColor.parse("#000102"), is(new JmColor(0, 1, 2))); + assertThat(JmColor.parse("#0a0b0c"), is(new JmColor(10, 11, 12))); + assertThat(JmColor.parse("#101112"), is(new JmColor(0x10, 0x11, 0x12))); + assertThat(JmColor.parse("#ffffff"), is(new JmColor(255, 255, 255))); + } +} Property changes on: zeus/trunk/jiemamy-spec-view/src/test/java/org/jiemamy/model/geometory/JmColorTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain