svnno****@sourc*****
svnno****@sourc*****
2009年 2月 28日 (土) 16:26:28 JST
Revision: 2747 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2747 Author: daisuke_m Date: 2009-02-28 16:26:28 +0900 (Sat, 28 Feb 2009) Log Message: ----------- コネクション作成時の再描画を色々試みたが、未だ成功せず。 Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractCommand.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/AbstractConstraintModel.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/entity/AbstractEntityModel.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/node/NodeAdapterImpl.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmConnectionEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmNodeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.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/utils/LabelStringUtil.java Added Paths: ----------- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionToDiagramCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeToDiagramCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteConnectionFromDiagramCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteNodeFromDiagramCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityNodeEditPart.java zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java Removed Paths: ------------- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddProfileToDiaglamCommand.java artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteProfileFromDiaglamCommand.java vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractCommand.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractCommand.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/impl/AbstractCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -18,6 +18,9 @@ */ package org.jiemamy.editcommand.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.jiemamy.editcommand.Command; import org.jiemamy.editcommand.CommandProcessor; @@ -28,8 +31,20 @@ */ public abstract class AbstractCommand implements Command { + private static Logger logger = LoggerFactory.getLogger(AbstractCommand.class); + + + /** + * インスタンスを生成する。 + */ + public AbstractCommand() { + logger.debug("construct: " + this); + } + public void execute(CommandProcessor commandProcessor) { + logger.info("command executed before: " + this); commandProcessor.process(this); + logger.info("command executed after: " + this); } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/RootModelImpl.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -23,8 +23,6 @@ import java.util.UUID; import org.apache.commons.lang.Validate; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; import org.jiemamy.Jiemamy; import org.jiemamy.model.dataset.DataSetModel; @@ -182,7 +180,8 @@ @Override public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + return getClass().getName() + "@" + System.identityHashCode(this); +// return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/ColumnModelImpl.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -20,9 +20,6 @@ import java.util.UUID; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - import org.jiemamy.Jiemamy; import org.jiemamy.model.attribute.constraint.ColumnCheckModel; import org.jiemamy.model.attribute.constraint.NotNullConstraintModel; @@ -114,7 +111,8 @@ @Override public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + return "Column " + getName(); +// return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/AbstractConstraintModel.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/AbstractConstraintModel.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/attribute/constraint/AbstractConstraintModel.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -41,4 +41,8 @@ super(jiemamy, id); } + @Override + public String toString() { + return "Constraint " + getName(); + } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/datatype/DomainModelImpl.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -144,4 +144,8 @@ this.notNull = notNull; } + @Override + public String toString() { + return "Domain " + getName(); + } } Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/entity/AbstractEntityModel.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/entity/AbstractEntityModel.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/entity/AbstractEntityModel.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -97,4 +97,8 @@ this.name = name; } + @Override + public String toString() { + return "Entity " + getName(); + } } Added: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionToDiagramCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionToDiagramCommand.java (rev 0) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionToDiagramCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -0,0 +1,88 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/22 + * + * 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.editcommand; + +import org.jiemamy.editcommand.impl.AbstractCommand; +import org.jiemamy.model.DiagramPresentations; +import org.jiemamy.model.JiemamyElement; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.connection.ConnectionAdapter; +import org.jiemamy.model.node.NodeAdapter; + +/** + * {@link RootModel}に登録された{@link DiagramPresentations}アダプタに{@link ConnectionAdapter}を追加するコマンド。 + * + * @see DeleteConnectionFromDiagramCommand + * @author shin1ogawa + */ +public class AddConnectionToDiagramCommand extends AbstractCommand { + + private final RootModel rootModel; + + private final ConnectionAdapter connectionAdapter; + + private final int diagramIndex; + + + /** + * インスタンスを生成する。 + * + * @param rootModel {@link DiagramPresentations}がアダプトされた{@link RootModel} + * @param diagramIndex ダイアグラムエディタのタブインデックス + * @param connectionAdapter ノードを識別するための{@link NodeAdapter} + */ + public AddConnectionToDiagramCommand(RootModel rootModel, int diagramIndex, ConnectionAdapter connectionAdapter) { + this.rootModel = rootModel; + this.diagramIndex = diagramIndex; + this.connectionAdapter = connectionAdapter; + } + + /** + * @return the diagramIndex + */ + public int getDiagramIndex() { + return diagramIndex; + } + + public Command getNegateCommand() { + return new DeleteConnectionFromDiagramCommand(rootModel, getDiagramIndex(), connectionAdapter); + } + + /** + * @return ノードを識別するための{@link NodeAdapter} + */ + public ConnectionAdapter getNodeAdapter() { + return connectionAdapter; + } + + /** + * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} + */ + public RootModel getRootModel() { + return rootModel; + } + + /** + * {@inheritDoc} + */ + public JiemamyElement getTarget() { + return getRootModel(); + } + +} Property changes on: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddConnectionToDiagramCommand.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeToDiagramCommand.java (from rev 2746, artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddProfileToDiaglamCommand.java) =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeToDiagramCommand.java (rev 0) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeToDiagramCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -0,0 +1,100 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/22 + * + * 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.editcommand; + +import org.jiemamy.editcommand.impl.AbstractCommand; +import org.jiemamy.model.DiagramPresentations; +import org.jiemamy.model.JiemamyElement; +import org.jiemamy.model.NodeProfile; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.node.NodeAdapter; + +/** + * {@link RootModel}に登録された{@link DiagramPresentations}アダプタに{@link NodeProfile}を追加するコマンド。 + * + * @see DeleteNodeFromDiagramCommand + * @author shin1ogawa + */ +public class AddNodeToDiagramCommand extends AbstractCommand { + + private final RootModel rootModel; + + private final NodeAdapter nodeAdapter; + + private final NodeProfile nodeProfile; + + private final int diagramIndex; + + + /** + * インスタンスを生成する。 + * + * @param rootModel {@link DiagramPresentations}がアダプトされた{@link RootModel} + * @param diagramIndex ダイアグラムエディタのタブインデックス + * @param nodeAdapter ノードを識別するための{@link NodeAdapter} + * @param nodeProfile ノードの見た目の情報を保持する{@link NodeProfile} + */ + public AddNodeToDiagramCommand(RootModel rootModel, int diagramIndex, NodeAdapter nodeAdapter, + NodeProfile nodeProfile) { + this.rootModel = rootModel; + this.diagramIndex = diagramIndex; + this.nodeAdapter = nodeAdapter; + this.nodeProfile = nodeProfile; + } + + /** + * @return the diagramIndex + */ + public int getDiagramIndex() { + return diagramIndex; + } + + public Command getNegateCommand() { + return new DeleteNodeFromDiagramCommand(rootModel, getDiagramIndex(), nodeAdapter); + } + + /** + * @return ノードを識別するための{@link NodeAdapter} + */ + public NodeAdapter getNodeAdapter() { + return nodeAdapter; + } + + /** + * @return ノードの見た目の情報を保持する{@link NodeProfile} + */ + public NodeProfile getNodeProfile() { + return nodeProfile; + } + + /** + * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} + */ + public RootModel getRootModel() { + return rootModel; + } + + /** + * {@inheritDoc} + */ + public JiemamyElement getTarget() { + return getRootModel(); + } + +} Property changes on: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddNodeToDiagramCommand.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddProfileToDiaglamCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddProfileToDiaglamCommand.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/AddProfileToDiaglamCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -1,99 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2009/02/22 - * - * 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.editcommand; - -import org.jiemamy.editcommand.impl.AbstractCommand; -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.JiemamyElement; -import org.jiemamy.model.NodeProfile; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.node.NodeAdapter; - -/** - * {@link RootModel}に登録された{@link DiagramPresentations}アダプタに{@link NodeProfile}を追加するコマンド。 - * - * @author shin1ogawa - * @see DeleteProfileFromDiaglamCommand - */ -public class AddProfileToDiaglamCommand extends AbstractCommand { - - private final RootModel root; - - private final NodeAdapter nodeAdapter; - - private final NodeProfile nodeProfile; - - private final int diagramIndex; - - - /** - * インスタンスを生成する。 - * - * @param root {@link DiagramPresentations}がアダプトされた{@link RootModel} - * @param diagramIndex ダイアグラムエディタのタブインデックス - * @param nodeAdapter ノードを識別するための{@link NodeAdapter} - * @param nodeProfile ノードの見た目の情報を保持する{@link NodeProfile} - */ - public AddProfileToDiaglamCommand(RootModel root, int diagramIndex, NodeAdapter nodeAdapter, NodeProfile nodeProfile) { - this.root = root; - this.diagramIndex = diagramIndex; - this.nodeAdapter = nodeAdapter; - this.nodeProfile = nodeProfile; - } - - /** - * @return the diagramIndex - */ - public int getDiagramIndex() { - return diagramIndex; - } - - public Command getNegateCommand() { - return new DeleteProfileFromDiaglamCommand(root, getDiagramIndex(), nodeAdapter); - } - - /** - * @return ノードを識別するための{@link NodeAdapter} - */ - public NodeAdapter getNodeAdapter() { - return nodeAdapter; - } - - /** - * @return ノードの見た目の情報を保持する{@link NodeProfile} - */ - public NodeProfile getNodeProfile() { - return nodeProfile; - } - - /** - * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} - */ - public RootModel getRoot() { - return root; - } - - /** - * {@inheritDoc} - */ - public JiemamyElement getTarget() { - return getRoot(); - } - -} Added: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteConnectionFromDiagramCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteConnectionFromDiagramCommand.java (rev 0) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteConnectionFromDiagramCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -0,0 +1,88 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/22 + * + * 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.editcommand; + +import org.jiemamy.editcommand.impl.AbstractCommand; +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.node.NodeAdapter; + +/** + * {@link RootModel}に登録された{@link DiagramPresentations}アダプタから{@link NodeProfile}を削除するコマンド。 + * + * @see AddConnectionToDiagramCommand + * @author shin1ogawa + */ +public class DeleteConnectionFromDiagramCommand extends AbstractCommand { + + private final RootModel root; + + private final ConnectionAdapter connectionAdapter; + + private final int diagramIndex; + + + /** + * インスタンスを生成する。 + * + * @param root {@link DiagramPresentations}がアダプトされた{@link RootModel} + * @param diagramIndex ダイアグラムエディタのタブインデックス + * @param connectionAdapter ノードを識別するための{@link NodeAdapter} + */ + public DeleteConnectionFromDiagramCommand(RootModel root, int diagramIndex, ConnectionAdapter connectionAdapter) { + this.root = root; + this.diagramIndex = diagramIndex; + this.connectionAdapter = connectionAdapter; + } + + /** + * @return the diagramIndex + */ + public int getDiagramIndex() { + return diagramIndex; + } + + public Command getNegateCommand() { + return new AddConnectionToDiagramCommand(root, getDiagramIndex(), connectionAdapter); + } + + /** + * @return ノードを識別するための{@link NodeAdapter} + */ + public ConnectionAdapter getNodeAdapter() { + return connectionAdapter; + } + + /** + * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} + */ + public RootModel getRoot() { + return root; + } + + /** + * {@inheritDoc} + */ + public JiemamyElement getTarget() { + return getRoot(); + } +} Property changes on: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteConnectionFromDiagramCommand.java ___________________________________________________________________ Added: svn:mime-type + text/plain Copied: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteNodeFromDiagramCommand.java (from rev 2746, artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteProfileFromDiaglamCommand.java) =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteNodeFromDiagramCommand.java (rev 0) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteNodeFromDiagramCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -0,0 +1,104 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/22 + * + * 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.editcommand; + +import org.jiemamy.editcommand.impl.AbstractCommand; +import org.jiemamy.model.DiagramPresentations; +import org.jiemamy.model.JiemamyElement; +import org.jiemamy.model.NodeProfile; +import org.jiemamy.model.RootModel; +import org.jiemamy.model.node.NodeAdapter; + +/** + * {@link RootModel}に登録された{@link DiagramPresentations}アダプタから{@link NodeProfile}を削除するコマンド。 + * + * @see AddNodeToDiagramCommand + * @author shin1ogawa + */ +public class DeleteNodeFromDiagramCommand extends AbstractCommand { + + private final RootModel root; + + private final NodeAdapter nodeAdapter; + + private final int diagramIndex; + + private NodeProfile nodeProfile; + + + /** + * インスタンスを生成する。 + * + * @param root {@link DiagramPresentations}がアダプトされた{@link RootModel} + * @param diagramIndex ダイアグラムエディタのタブインデックス + * @param nodeAdapter ノードを識別するための{@link NodeAdapter} + */ + public DeleteNodeFromDiagramCommand(RootModel root, int diagramIndex, NodeAdapter nodeAdapter) { + this.root = root; + this.diagramIndex = diagramIndex; + this.nodeAdapter = nodeAdapter; + } + + /** + * @return the diagramIndex + */ + public int getDiagramIndex() { + return diagramIndex; + } + + public Command getNegateCommand() { + return new AddNodeToDiagramCommand(root, getDiagramIndex(), nodeAdapter, getNodeProfile()); + } + + /** + * @return ノードを識別するための{@link NodeAdapter} + */ + public NodeAdapter getNodeAdapter() { + return nodeAdapter; + } + + /** + * @return ノードの見た目の情報を保持する{@link NodeProfile} + */ + public NodeProfile getNodeProfile() { + return nodeProfile; + } + + /** + * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} + */ + public RootModel getRoot() { + return root; + } + + /** + * {@inheritDoc} + */ + public JiemamyElement getTarget() { + return getRoot(); + } + + /** + * @param nodeProfile ノードの見た目の情報を保持する{@link NodeProfile} + */ + public void setNodeProfile(NodeProfile nodeProfile) { + this.nodeProfile = nodeProfile; + } + +} Property changes on: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteNodeFromDiagramCommand.java ___________________________________________________________________ Added: svn:mime-type + text/plain Deleted: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteProfileFromDiaglamCommand.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteProfileFromDiaglamCommand.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/editcommand/DeleteProfileFromDiaglamCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -1,104 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2009/02/22 - * - * 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.editcommand; - -import org.jiemamy.editcommand.impl.AbstractCommand; -import org.jiemamy.model.DiagramPresentations; -import org.jiemamy.model.JiemamyElement; -import org.jiemamy.model.NodeProfile; -import org.jiemamy.model.RootModel; -import org.jiemamy.model.node.NodeAdapter; - -/** - * {@link RootModel}に登録された{@link DiagramPresentations}アダプタから{@link NodeProfile}を削除するコマンド。 - * - * @see AddProfileToDiaglamCommand - * @author shin1ogawa - */ -public class DeleteProfileFromDiaglamCommand extends AbstractCommand { - - private final RootModel root; - - private final NodeAdapter nodeAdapter; - - private final int diagramIndex; - - private NodeProfile nodeProfile; - - - /** - * インスタンスを生成する。 - * - * @param root {@link DiagramPresentations}がアダプトされた{@link RootModel} - * @param diagramIndex ダイアグラムエディタのタブインデックス - * @param nodeAdapter ノードを識別するための{@link NodeAdapter} - */ - public DeleteProfileFromDiaglamCommand(RootModel root, int diagramIndex, NodeAdapter nodeAdapter) { - this.root = root; - this.diagramIndex = diagramIndex; - this.nodeAdapter = nodeAdapter; - } - - /** - * @return the diagramIndex - */ - public int getDiagramIndex() { - return diagramIndex; - } - - public Command getNegateCommand() { - return new AddProfileToDiaglamCommand(root, getDiagramIndex(), nodeAdapter, getNodeProfile()); - } - - /** - * @return ノードを識別するための{@link NodeAdapter} - */ - public NodeAdapter getNodeAdapter() { - return nodeAdapter; - } - - /** - * @return ノードの見た目の情報を保持する{@link NodeProfile} - */ - public NodeProfile getNodeProfile() { - return nodeProfile; - } - - /** - * @return {@link DiagramPresentations}がアダプトされた{@link RootModel} - */ - public RootModel getRoot() { - return root; - } - - /** - * {@inheritDoc} - */ - public JiemamyElement getTarget() { - return getRoot(); - } - - /** - * @param nodeProfile ノードの見た目の情報を保持する{@link NodeProfile} - */ - public void setNodeProfile(NodeProfile nodeProfile) { - this.nodeProfile = nodeProfile; - } - -} Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/facade/JiemamyViewFacadeImpl.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -18,19 +18,25 @@ */ package org.jiemamy.facade; +import java.util.ArrayList; import java.util.Map; import org.jiemamy.EventBroker; import org.jiemamy.Jiemamy; -import org.jiemamy.editcommand.AddProfileToDiaglamCommand; +import org.jiemamy.editcommand.AddConnectionToDiagramCommand; +import org.jiemamy.editcommand.AddNodeToDiagramCommand; import org.jiemamy.editcommand.Command; import org.jiemamy.editcommand.CommandProcessor; import org.jiemamy.editcommand.CommandProcessorImpl; -import org.jiemamy.editcommand.DeleteProfileFromDiaglamCommand; +import org.jiemamy.editcommand.DeleteConnectionFromDiagramCommand; +import org.jiemamy.editcommand.DeleteNodeFromDiagramCommand; import org.jiemamy.editcommand.impl.ModifyModelPropertyCommand; import org.jiemamy.model.DiagramPresentationModel; import org.jiemamy.model.DiagramPresentations; import org.jiemamy.model.NodeProfile; +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; @@ -56,6 +62,14 @@ commandProcessor = new ViewCommandProcessorImpl(jiemamy.getEventBroker()); } + public void addConnectionProfile(int diagramIndex, ConnectionAdapter connectionAdapter) { + RootModel rootModel = jiemamy.getFactory().getRootModel(); + Command command = new AddConnectionToDiagramCommand(rootModel, diagramIndex, connectionAdapter); + command.execute(commandProcessor); + undoStack.push(command.getNegateCommand()); + redoStack.push(command); + } + /** * TODO for shin1ogawa * @@ -63,10 +77,9 @@ * @param nodeAdapter ノードに対応する{@link NodeAdapter} * @param nodeProfile 追加する{@link NodeProfile} */ - public void addNodeProfile(int diagramIndex, final NodeAdapter nodeAdapter, final NodeProfile nodeProfile) { - Command command = - new AddProfileToDiaglamCommand(jiemamy.getFactory().getRootModel(), diagramIndex, nodeAdapter, - nodeProfile); + public void addNodeProfile(int diagramIndex, NodeAdapter nodeAdapter, NodeProfile nodeProfile) { + RootModel rootModel = jiemamy.getFactory().getRootModel(); + Command command = new AddNodeToDiagramCommand(rootModel, diagramIndex, nodeAdapter, nodeProfile); command.execute(commandProcessor); undoStack.push(command.getNegateCommand()); redoStack.push(command); @@ -80,8 +93,8 @@ * @param constraint */ public void changeNodeConstraint(int diagramIndex, NodeAdapter nodeAdapter, JmRectangle constraint) { - DiagramPresentations diagramPresentations = - jiemamy.getFactory().getRootModel().getAdapter(DiagramPresentations.class); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(diagramIndex); Map<NodeAdapter, NodeProfile> figureProfiles = diagramPresentationModel.getFigureProfiles(); if (figureProfiles.containsKey(nodeAdapter) == false) { @@ -102,8 +115,8 @@ * @param nodeAdapter ノードに対応する{@link NodeAdapter} */ public void deleteNodeProfile(int diagramIndex, final NodeAdapter nodeAdapter) { - final Command command = - new DeleteProfileFromDiaglamCommand(jiemamy.getFactory().getRootModel(), diagramIndex, nodeAdapter); + RootModel rootModel = jiemamy.getFactory().getRootModel(); + Command command = new DeleteNodeFromDiagramCommand(rootModel, diagramIndex, nodeAdapter); command.execute(commandProcessor); undoStack.push(command.getNegateCommand()); redoStack.push(command); @@ -131,9 +144,21 @@ * * @param command */ - public void process(AddProfileToDiaglamCommand command) { - DiagramPresentationModel diagramPresentationModel = - command.getRoot().getAdapter(DiagramPresentations.class).get(command.getDiagramIndex()); + public void process(AddConnectionToDiagramCommand command) { + DiagramPresentations diagramPresentations = command.getRootModel().getAdapter(DiagramPresentations.class); + DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(command.getDiagramIndex()); + diagramPresentationModel.getConnectionLayouts().put(command.getNodeAdapter(), new ArrayList<JmPoint>()); + eventBroker.fireCommandProcessed(command); + } + + /** + * TODO for shin1ogawa + * + * @param command + */ + public void process(AddNodeToDiagramCommand command) { + DiagramPresentations diagramPresentations = command.getRootModel().getAdapter(DiagramPresentations.class); + DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(command.getDiagramIndex()); diagramPresentationModel.getFigureProfiles().put(command.getNodeAdapter(), command.getNodeProfile()); eventBroker.fireCommandProcessed(command); } @@ -143,14 +168,25 @@ * * @param command */ - public void process(DeleteProfileFromDiaglamCommand command) { - DiagramPresentationModel diagramPresentationModel = - command.getRoot().getAdapter(DiagramPresentations.class).get(command.getDiagramIndex()); + public void process(DeleteConnectionFromDiagramCommand command) { + DiagramPresentations diagramPresentations = command.getRoot().getAdapter(DiagramPresentations.class); + DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(command.getDiagramIndex()); + diagramPresentationModel.getConnectionLayouts().remove(command.getNodeAdapter()); + eventBroker.fireCommandProcessed(command); + } + + /** + * TODO for shin1ogawa + * + * @param command + */ + public void process(DeleteNodeFromDiagramCommand command) { + DiagramPresentations diagramPresentations = command.getRoot().getAdapter(DiagramPresentations.class); + DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(command.getDiagramIndex()); NodeProfile nodeProfile = diagramPresentationModel.getFigureProfiles().get(command.getNodeAdapter()); command.setNodeProfile(nodeProfile); diagramPresentationModel.getFigureProfiles().remove(command.getNodeAdapter()); eventBroker.fireCommandProcessed(command); } - } } Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/connection/ConnectionAdapterImpl.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -20,9 +20,6 @@ import java.util.List; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - import org.jiemamy.internal.processor.IsCyclicProcessor; import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.model.attribute.ColumnRef; @@ -77,7 +74,8 @@ @Override public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + return super.toString() + " S=" + getSource() + ", T=" + getTarget(); +// return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } public ForeignKeyModel unwrap() { Modified: artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/node/NodeAdapterImpl.java =================================================================== --- artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/node/NodeAdapterImpl.java 2009-02-27 10:00:14 UTC (rev 2746) +++ artemis/trunk/jiemamy-view/src/main/java/org/jiemamy/model/node/NodeAdapterImpl.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -23,8 +23,6 @@ import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.Validate; -import org.apache.commons.lang.builder.ToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; import org.jiemamy.exception.IllegalImplementationException; import org.jiemamy.model.attribute.constraint.ForeignKeyModel; @@ -114,7 +112,8 @@ @Override public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); + return "NodeAdapter " + wrapped.getName(); +// return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); } public EntityModel unwrap() { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/command/CreateConnectionCommand.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -18,7 +18,6 @@ */ package org.jiemamy.eclipse.editor.command; -import java.util.Collection; import java.util.List; import org.eclipse.draw2d.geometry.Dimension; @@ -27,6 +26,7 @@ import org.jiemamy.Jiemamy; import org.jiemamy.JiemamyFactory; +import org.jiemamy.Migration; import org.jiemamy.ReferenceResolver; import org.jiemamy.eclipse.JiemamyPlugin; import org.jiemamy.facade.JiemamyViewFacadeImpl; @@ -36,12 +36,10 @@ import org.jiemamy.model.attribute.constraint.ForeignKeyModel; import org.jiemamy.model.attribute.constraint.LocalKeyModel; import org.jiemamy.model.connection.ConnectionAdapter; -import org.jiemamy.model.entity.EntityModel; import org.jiemamy.model.entity.TableModel; import org.jiemamy.model.entity.ViewModel; import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.model.node.StickyModel; -import org.jiemamy.utils.model.EntityUtil; import org.jiemamy.utils.model.TableUtil; /** @@ -99,15 +97,16 @@ return false; } - if (connection.unwrap() != null) { - // 循環参照の禁止(ターゲットの親に自分がいたら、参照不可) - - Collection<EntityModel> refs = EntityUtil.getReferenceEntities(target.unwrap(), true); - if (refs.contains(source.unwrap())) { - LogUtil.log(JiemamyPlugin.getDefault(), "attempt to create cyclic connection"); // RESOURCE - return false; - } - } + // THINK 違うキー同士で参照してる可能性は?ど +// if (connection.unwrap() != null) { +// // 循環参照の禁止(ターゲットの親に自分がいたら、参照不可) +// +// Collection<EntityModel> refs = EntityUtil.getReferenceEntities(target.unwrap(), true); +// if (refs.contains(source.unwrap())) { +// LogUtil.log(JiemamyPlugin.getDefault(), "attempt to create cyclic connection"); // RESOURCE +// return false; +// } +// } return true; } @@ -139,6 +138,9 @@ } jiemamyFacade.addForeignKey(sourceTable, foreignKeyModel); + jiemamyFacade.addConnectionProfile(Migration.DIAGRAM_INDEX, connection); + } else { + // TODO wrapping connectionしか対応していない。 } // DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); @@ -176,6 +178,9 @@ public void undo() { if (connection.unwrap() != null) { jiemamyFacade.undo(); + jiemamyFacade.undo(); + } else { + // TODO wrapping connectionしか対応していない。 } } } Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -21,6 +21,8 @@ import org.eclipse.core.runtime.Status; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jiemamy.eclipse.JiemamyPlugin; import org.jiemamy.eclipse.editor.editpart.diagram.ForeignKeyEditPart; @@ -36,6 +38,7 @@ import org.jiemamy.model.entity.ViewModel; import org.jiemamy.model.node.NodeAdapter; import org.jiemamy.model.node.StickyModel; +import org.jiemamy.utils.LogMarker; /** * ダイアグラム用EditPartファクトリ。 @@ -43,7 +46,11 @@ */ public class DiagramEditPartFactory implements EditPartFactory { + private static Logger logger = LoggerFactory.getLogger(DiagramEditPartFactory.class); + + public EditPart createEditPart(EditPart context, Object model) { + logger.debug(LogMarker.LIFECYCLE, "createEditPart for " + model); EditPart part = null; if (model instanceof RootModel) { Deleted: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -1,59 +0,0 @@ -/* - * Copyright 2007-2009 Jiemamy Project and the Others. - * Created on 2008/08/03 - * - * 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.eclipse.editor.editpart.diagram; - -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.jface.viewers.TextCellEditor; - -import org.jiemamy.eclipse.editor.figure.EntityFigure; -import org.jiemamy.eclipse.editor.tools.NodeCellEditorLocator; -import org.jiemamy.model.JiemamyElement; -import org.jiemamy.model.entity.EntityModel; -import org.jiemamy.model.node.NodeAdapter; - -/** - * {@link EntityModel}に対するDiagram用EditPart(コントローラ)の抽象クラス。 - * - * @author daisuke - */ -public abstract class AbstractEntityEditPart extends AbstractJmNodeEditPart { - - /** - * インスタンスを生成する。 - * - * @param model - */ - public AbstractEntityEditPart(NodeAdapter model) { - super(model); - } - - public JiemamyElement getTargetModel() { - NodeAdapter node = getModel(); - EntityModel entity = node.unwrap(); - return entity; - } - - @Override - protected DirectEditManager getDirectEditManager() { - EntityFigure figure = (EntityFigure) getFigure(); - CellEditorLocator locator = new NodeCellEditorLocator(figure.getEntityNameLabel()); - return new EntityDirectEditManager(this, TextCellEditor.class, locator); - } -} Copied: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityNodeEditPart.java (from rev 2743, vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityEditPart.java) =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityNodeEditPart.java (rev 0) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityNodeEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -0,0 +1,59 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2008/08/03 + * + * 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.eclipse.editor.editpart.diagram; + +import org.eclipse.gef.tools.CellEditorLocator; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.jface.viewers.TextCellEditor; + +import org.jiemamy.eclipse.editor.figure.EntityFigure; +import org.jiemamy.eclipse.editor.tools.NodeCellEditorLocator; +import org.jiemamy.model.JiemamyElement; +import org.jiemamy.model.entity.EntityModel; +import org.jiemamy.model.node.NodeAdapter; + +/** + * {@link EntityModel}のNodeに対するDiagram用EditPart(コントローラ)の抽象クラス。 + * + * @author daisuke + */ +public abstract class AbstractEntityNodeEditPart extends AbstractJmNodeEditPart { + + /** + * インスタンスを生成する。 + * + * @param model + */ + public AbstractEntityNodeEditPart(NodeAdapter model) { + super(model); + } + + public JiemamyElement getTargetModel() { + NodeAdapter node = getModel(); + EntityModel entity = node.unwrap(); + return entity; + } + + @Override + protected DirectEditManager getDirectEditManager() { + EntityFigure figure = (EntityFigure) getFigure(); + CellEditorLocator locator = new NodeCellEditorLocator(figure.getEntityNameLabel()); + return new EntityDirectEditManager(this, TextCellEditor.class, locator); + } +} Property changes on: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractEntityNodeEditPart.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmConnectionEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmConnectionEditPart.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmConnectionEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -27,6 +27,8 @@ import org.eclipse.gef.EditPolicy; import org.eclipse.gef.editparts.AbstractConnectionEditPart; import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.editpolicy.JmBendpointEditPolicy; @@ -46,6 +48,9 @@ */ public abstract class AbstractJmConnectionEditPart extends AbstractConnectionEditPart implements CommandListener { + private static Logger logger = LoggerFactory.getLogger(AbstractJmConnectionEditPart.class); + + /** * インスタンスを生成する。 * @@ -60,6 +65,7 @@ super.activate(); ConnectionAdapter model = getModel(); model.unwrap().getJiemamy().getEventBroker().addListener(this); + logger.debug("activate"); } public void commandExecuted(Command command) { @@ -71,6 +77,7 @@ ConnectionAdapter model = getModel(); model.unwrap().getJiemamy().getEventBroker().removeListener(this); super.deactivate(); + logger.debug("deactivate"); } @Override Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmNodeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmNodeEditPart.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/AbstractJmNodeEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -20,8 +20,8 @@ import java.util.Collection; import java.util.List; +import java.util.Map; -import org.apache.commons.collections15.IteratorUtils; import org.eclipse.draw2d.ChopboxAnchor; import org.eclipse.draw2d.ConnectionAnchor; import org.eclipse.draw2d.IFigure; @@ -35,6 +35,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.jiemamy.Migration; import org.jiemamy.eclipse.editor.editpart.DoubleClickSupport; import org.jiemamy.eclipse.editor.editpart.EditDialogSupport; import org.jiemamy.eclipse.editor.editpolicy.JmComponentEditPolicy; @@ -42,9 +43,13 @@ import org.jiemamy.eclipse.editor.editpolicy.JmGraphicalNodeEditPolicy; import org.jiemamy.editcommand.Command; import org.jiemamy.editcommand.CommandListener; +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.node.NodeAdapter; +import org.jiemamy.utils.CollectionsUtil; import org.jiemamy.utils.LogMarker; /** @@ -70,9 +75,10 @@ @Override public void activate() { super.activate(); + RootModel rootModel = (RootModel) getRoot().getContents().getModel(); rootModel.getJiemamy().getEventBroker().addListener(this); -// NodeAdapter nodeAdapter = (NodeAdapter) getModel(); + logger.debug("activate"); } public void commandExecuted(Command command) { @@ -83,8 +89,9 @@ public void deactivate() { RootModel rootModel = (RootModel) getRoot().getContents().getModel(); rootModel.getJiemamy().getEventBroker().removeListener(this); -// NodeAdapter entityModel = (NodeAdapter) getModel(); + super.deactivate(); + logger.debug("deactivate"); } public void doubleClicked() { @@ -149,16 +156,40 @@ @SuppressWarnings("unchecked") // TODO キャスト安全性の根拠提示 protected List getModelSourceConnections() { + RootModel rootModel = (RootModel) getRoot().getContents().getModel(); + DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); + DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(Migration.DIAGRAM_INDEX); + Map<ConnectionAdapter, List<JmPoint>> connectionLayouts = diagramPresentationModel.getConnectionLayouts(); + + List<ConnectionAdapter> result = CollectionsUtil.newArrayList(); Collection<ConnectionAdapter> connections = getModel().getSourceConnections(); - return IteratorUtils.toList(connections.iterator()); + for (ConnectionAdapter connectionAdapter : connections) { + if (connectionLayouts.containsKey(connectionAdapter)) { + result.add(connectionAdapter); + } + } + logger.debug(getModel() + " sourceConnections = " + result); + return result; } @Override @SuppressWarnings("unchecked") // TODO キャスト安全性の根拠提示 protected List getModelTargetConnections() { - Collection<ConnectionAdapter> connections = (getModel()).getTargetConnections(); - return IteratorUtils.toList(connections.iterator()); + RootModel rootModel = (RootModel) getRoot().getContents().getModel(); + DiagramPresentations diagramPresentations = rootModel.getAdapter(DiagramPresentations.class); + DiagramPresentationModel diagramPresentationModel = diagramPresentations.get(Migration.DIAGRAM_INDEX); + Map<ConnectionAdapter, List<JmPoint>> connectionLayouts = diagramPresentationModel.getConnectionLayouts(); + + List<ConnectionAdapter> result = CollectionsUtil.newArrayList(); + Collection<ConnectionAdapter> connections = getModel().getTargetConnections(); + for (ConnectionAdapter connectionAdapter : connections) { + if (connectionLayouts.containsKey(connectionAdapter)) { + result.add(connectionAdapter); + } + } + logger.debug(getModel() + " targetConnections = " + result); + return result; } /** Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ForeignKeyEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -59,6 +59,7 @@ */ public ForeignKeyEditPart(ConnectionAdapter connection) { super(connection); + logger.debug(LogMarker.LIFECYCLE, "construct"); } public void doubleClicked() { 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-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/TableEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -54,7 +54,7 @@ * テーブルモデルに対するDiagram用EditPart(コントローラ)。 * @author daisuke */ -public class TableEditPart extends AbstractEntityEditPart { +public class TableEditPart extends AbstractEntityNodeEditPart { private static Logger logger = LoggerFactory.getLogger(TableEditPart.class); 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-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/diagram/ViewEditPart.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -50,7 +50,7 @@ * * @author daisuke */ -public class ViewEditPart extends AbstractEntityEditPart { +public class ViewEditPart extends AbstractEntityNodeEditPart { private static Logger logger = LoggerFactory.getLogger(ViewEditPart.class); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java 2009-02-27 10:00:14 UTC (rev 2746) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/utils/LabelStringUtil.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -28,12 +28,14 @@ import org.jiemamy.model.RootModel; import org.jiemamy.model.attribute.ColumnModel; import org.jiemamy.model.attribute.constraint.ForeignKeyModel; +import org.jiemamy.model.attribute.constraint.PrimaryKeyModel; import org.jiemamy.model.datatype.DataType; import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.entity.EntityModel; import org.jiemamy.model.sql.Separator; import org.jiemamy.model.sql.Token; import org.jiemamy.utils.model.DataTypeUtil; +import org.jiemamy.utils.model.KeyConstraintUtil; import org.jiemamy.utils.model.RootModelUtil; /** @@ -93,17 +95,30 @@ } else if (targetElement instanceof ColumnModel) { ColumnModel columnModel = (ColumnModel) targetElement; return columnModel.getName(); + } else if (targetElement instanceof PrimaryKeyModel) { + PrimaryKeyModel primaryKeyModel = (PrimaryKeyModel) targetElement; + StringBuilder sb = new StringBuilder("PK "); + if (primaryKeyModel.getName() != null) { + sb.append(" "); + sb.append(primaryKeyModel.getName()); + } + sb.append("("); + sb.append(KeyConstraintUtil.toStringKeyColumns(primaryKeyModel)); + sb.append(")"); + return sb.toString(); } else if (targetElement instanceof ForeignKeyModel) { ForeignKeyModel foreignKeyModel = (ForeignKeyModel) targetElement; - StringBuilder sb = new StringBuilder("FK"); + StringBuilder sb = new StringBuilder("FK "); if (foreignKeyModel.getName() != null) { - sb.append(" ("); + sb.append(" "); sb.append(foreignKeyModel.getName()); - sb.append(")"); } + sb.append("("); + sb.append(KeyConstraintUtil.toStringKeyColumns(foreignKeyModel)); + sb.append(")"); return sb.toString(); } - return "unknown"; + return "unknown label: " + targetElement.getClass().getName(); } private LabelStringUtil() { Added: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java =================================================================== --- zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java (rev 0) +++ zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java 2009-02-28 07:26:28 UTC (rev 2747) @@ -0,0 +1,53 @@ +/* + * Copyright 2007-2009 Jiemamy Project and the Others. + * Created on 2009/02/28 + * + * 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 java.util.List; + +import org.jiemamy.model.geometory.JmColor; +import org.jiemamy.model.geometory.JmPoint; + +/** + * コネクションの見た目情報。 + * + * @author daisuke + */ +public interface ConnectionProfile extends JiemamyElement { + + /** + * コネクションのレイアウト情報を取得する。 + * + * @return コネクションのレイアウト情報 + */ + List<JmPoint> getBendpoints(); + + /** + * コネクションの色情報を取得する。 + * + * @return コネクションの色情報 + */ + JmColor getColor(); + + /** + * コネクションの色情報を設定する。 + * + * @param color コネクションの色情報 + */ + void setColor(JmColor color); +} Property changes on: zeus/trunk/jiemamy-spec-view/src/main/java/org/jiemamy/model/ConnectionProfile.java ___________________________________________________________________ Added: svn:mime-type + text/plain