svnno****@sourc*****
svnno****@sourc*****
2008年 10月 7日 (火) 02:02:54 JST
Revision: 2006 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=2006 Author: daisuke_m Date: 2008-10-07 02:02:54 +0900 (Tue, 07 Oct 2008) Log Message: ----------- 公開パッケージ整備 / CreateNewModelProcessorの仲介廃止。JiemamyModelFactoryを直接コール / refactor Modified Paths: -------------- artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java artemis/trunk/org.jiemamy.dialect/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.dialect.mysql/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.dialect.postgresql/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.dialect.sql99/META-INF/MANIFEST.MF artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/AbstractObservable.java artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 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/outlinetree/AbstractModelTreeEditPart.java vesta/trunk/org.jiemamy.eclipse/src/main/resources/jiemamy-eclipse.dicon zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/creator/JiemamyModelFactory.java Added Paths: ----------- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/ResetBendpointProcessorTest.java artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetColorProcessorTest.java artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetConstraintProcessorTest.java Removed Paths: ------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/creator/ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/core/utils/processor/root/presentation/ -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.core/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -246,6 +246,7 @@ org.hamcrest.core, org.hamcrest.internal, org.jiemamy.core, + org.jiemamy.core.appender, org.jiemamy.core.extension.dialect, org.jiemamy.core.extension.dialect.mapping, org.jiemamy.core.extension.dialect.parser, Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/RootModelImpl.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -22,12 +22,13 @@ import org.seasar.framework.container.annotation.tiger.Binding; +import org.jiemamy.core.utils.ArgumentCheckUtil; import org.jiemamy.core.utils.processor.connection.foreignkey.ProvideForeignKeyNameProcessor; import org.jiemamy.core.utils.processor.root.GetConnectionsProcessor; import org.jiemamy.core.utils.processor.root.GetEntityProcessor; import org.jiemamy.core.utils.processor.root.GetNodesProcessor; import org.jiemamy.core.utils.processor.root.ProvideEntityNameProcessor; -import org.jiemamy.creator.CreateNewModelProcessor; +import org.jiemamy.creator.JiemamyModelFactory; import org.jiemamy.spec.exception.CannotAppendException; import org.jiemamy.spec.exception.TooManyElementsException; import org.jiemamy.spec.extension.dialect.IdentifierValidator; @@ -89,6 +90,7 @@ * {@inheritDoc} */ public void appendModel(JiemamyModel jiemamyModel) { + ArgumentCheckUtil.assertNotNull(jiemamyModel); for (JiemamyModelAppender appender : appenders) { if (appender.append(this, jiemamyModel)) { return; @@ -102,7 +104,7 @@ */ @SuppressWarnings("unchecked") public <T extends JiemamyModel>T createJiemamyModel(Class<T> clazz) { - return process(new CreateNewModelProcessor<T>(this, clazz)); + return JiemamyModelFactory.create(clazz); } /** @@ -243,6 +245,7 @@ * {@inheritDoc} */ public void removeModel(JiemamyModel jiemamyModel) { + ArgumentCheckUtil.assertNotNull(jiemamyModel); for (JiemamyModelAppender appender : appenders) { if (appender.remove(this, jiemamyModel)) { return; Modified: artemis/trunk/org.jiemamy.dialect/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.dialect/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.dialect/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -14,5 +14,6 @@ Export-Package: org.jiemamy.dialect, org.jiemamy.dialect.general, org.jiemamy.dialect.general.datatype, + org.jiemamy.dialect.generic, org.jiemamy.dialect.helper, org.jiemamy.dialect.test Modified: artemis/trunk/org.jiemamy.dialect.mysql/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.dialect.mysql/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.dialect.mysql/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -9,7 +9,10 @@ lib/junit-addons-1.4.jar, lib/junit-4.4.jar Bundle-Vendor: Jiemamy Project -Export-Package: org.jiemamy.dialect.mysql,org.jiemamy.dialect.mysql.parser,org.jiemamy.dialect.mysql.parser.expression +Export-Package: org.jiemamy.dialect.mysql, + org.jiemamy.dialect.mysql.datatype, + org.jiemamy.dialect.mysql.parser, + org.jiemamy.dialect.mysql.parser.expression Require-Bundle: org.jiemamy.spec.core, org.jiemamy.core, org.jiemamy.dialect Modified: artemis/trunk/org.jiemamy.dialect.postgresql/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.dialect.postgresql/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.dialect.postgresql/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -9,7 +9,8 @@ lib/junit-addons-1.4.jar, lib/junit-4.4.jar Bundle-Vendor: Jiemamy Project -Export-Package: org.jiemamy.dialect.postgresql +Export-Package: org.jiemamy.dialect.postgresql, + org.jiemamy.dialect.postgresql.datatype Require-Bundle: org.jiemamy.spec.core, org.jiemamy.core, org.jiemamy.dialect Modified: artemis/trunk/org.jiemamy.dialect.sql99/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.dialect.sql99/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.dialect.sql99/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -9,7 +9,9 @@ lib/junit-addons-1.4.jar, lib/junit-4.4.jar Bundle-Vendor: Jiemamy Project -Export-Package: org.jiemamy.dialect.sql99,org.jiemamy.dialect.sql99.parser +Export-Package: org.jiemamy.dialect.sql99, + org.jiemamy.dialect.sql99.datatype, + org.jiemamy.dialect.sql99.parser Require-Bundle: org.jiemamy.spec.core, org.jiemamy.core, org.jiemamy.dialect Modified: artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/AbstractObservable.java =================================================================== --- artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/AbstractObservable.java 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/AbstractObservable.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -64,6 +64,10 @@ * {@inheritDoc} */ public void removeModelChangeListener(ModelChangeListener listener) { + // FIXME lazy instance creationせずに済む方法はないか? + if (listeners == null) { + listeners = CollectionsUtil.newArrayList(); + } listeners.remove(listener); } Modified: artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF =================================================================== --- artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ artemis/trunk/org.jiemamy.serializer/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -20,7 +20,8 @@ org.jiemamy.serializer.model.node.index, org.jiemamy.serializer.model.presentation, org.jiemamy.serializer.model.typedef, - org.jiemamy.serializer.model.typedef.constraint + org.jiemamy.serializer.model.typedef.constraint, + org.jiemamy.serializer.swap Require-Bundle: org.jiemamy.spec.core, org.jiemamy.spec.view, org.jiemamy.core, Added: artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/ResetBendpointProcessorTest.java =================================================================== --- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/ResetBendpointProcessorTest.java (rev 0) +++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/ResetBendpointProcessorTest.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -0,0 +1,108 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org 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.view.utils.processor; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import org.jiemamy.core.MustBeMulti; +import org.jiemamy.core.S2FactoryStrategy; +import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.spec.model.RootModel; +import org.jiemamy.spec.model.connection.ForeignKeyModel; +import org.jiemamy.spec.model.node.TableModel; +import org.jiemamy.spec.view.model.DiagramPresentations; +import org.jiemamy.spec.view.model.geometory.JmPoint; + +/** + * {@link ResetBendpointProcessor}のテストクラス。 + * @author daisuke + */ +public class ResetBendpointProcessorTest { + + protected RootModel rootModel; + + protected TableModel empTableModel; + + protected TableModel deptTableModel; + + protected ForeignKeyModel foreignKeyModel; + + protected ForeignKeyModel selfRefFkModel; + + + /** + * setup + * @throws Exception + */ + @Before + public void setUp() throws Exception { + JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon")); + rootModel = JiemamyModelFactory.createRoot().init(); + + empTableModel = rootModel.createJiemamyModel(TableModel.class).init("T_EMP"); + rootModel.appendModel(empTableModel); + + deptTableModel = rootModel.createJiemamyModel(TableModel.class).init("T_DEPT"); + rootModel.appendModel(deptTableModel); + + foreignKeyModel = + rootModel.createJiemamyModel(ForeignKeyModel.class).init(rootModel, empTableModel, deptTableModel); + selfRefFkModel = + rootModel.createJiemamyModel(ForeignKeyModel.class).init(rootModel, empTableModel, empTableModel); + } + + /** + * teardown + * @throws Exception + */ + @After + public void tearDown() throws Exception { + rootModel = null; + empTableModel = null; + deptTableModel = null; + foreignKeyModel = null; + selfRefFkModel = null; + } + + /** + * ベンドポイントをリセットすると_通常ベンドポイントは0になり_自己参照時には2になる + * @throws Exception + */ + @Test + @Ignore + public void test01_ベンドポイントをリセットすると_通常ベンドポイントは0になり_自己参照時には2になる() throws Exception { + List<JmPoint> bendpoints; + rootModel.getAdapter(DiagramPresentations.class).get(MustBeMulti.ZERO).resetBendpoints(foreignKeyModel); + bendpoints = + rootModel.getAdapter(DiagramPresentations.class).get(0).getConnectionLayouts().get(foreignKeyModel); + assertThat(bendpoints.size(), is(0)); + + rootModel.getAdapter(DiagramPresentations.class).get(MustBeMulti.ZERO).resetBendpoints(selfRefFkModel); + bendpoints = rootModel.getAdapter(DiagramPresentations.class).get(0).getConnectionLayouts().get(selfRefFkModel); + assertThat(bendpoints.size(), is(2)); + } +} Added: artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetColorProcessorTest.java =================================================================== --- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetColorProcessorTest.java (rev 0) +++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetColorProcessorTest.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -0,0 +1,94 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org 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.view.utils.processor; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.nullValue; +import static org.junit.Assert.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.core.MustBeMulti; +import org.jiemamy.core.S2FactoryStrategy; +import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.spec.model.RootModel; +import org.jiemamy.spec.model.node.TableModel; +import org.jiemamy.spec.view.model.DiagramPresentationModel; +import org.jiemamy.spec.view.model.DiagramPresentations; +import org.jiemamy.spec.view.model.geometory.JmColor; + +/** + * {@link SetColorProcessor}のテストクラス。 + * @author daisuke + */ +public class SetColorProcessorTest { + + private RootModel rootModel; + + private TableModel tableModel; + + + /** + * setup + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon")); + rootModel = JiemamyModelFactory.createRoot().init(); + DiagramPresentationModel presentation = + rootModel.createJiemamyModel(DiagramPresentationModel.class).init("テスト"); + rootModel.appendModel(presentation); + + TableModel table = rootModel.createJiemamyModel(TableModel.class).init("T_TEST"); + rootModel.appendModel(table); + } + + /** + * teardown + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + rootModel = null; + tableModel = null; + } + + /** + * tableModelに背景色情報を与えることができる。 + * @throws Exception + */ + @Test + public void test01_tableModelに背景色情報を与えることができる() throws Exception { + JmColor result; + + result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeColors().get(tableModel); + assertThat(result, nullValue()); + + rootModel.getAdapter(DiagramPresentations.class).get(MustBeMulti.ZERO).setColor(tableModel, + new JmColor(10, 20, 30)); + + result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeColors().get(tableModel); + assertThat(result.red, is(10)); + assertThat(result.green, is(20)); + assertThat(result.blue, is(30)); + } +} Added: artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetConstraintProcessorTest.java =================================================================== --- artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetConstraintProcessorTest.java (rev 0) +++ artemis/trunk/org.jiemamy.view/src/test/java/org/jiemamy/view/utils/processor/SetConstraintProcessorTest.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -0,0 +1,93 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org 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.view.utils.processor; + +import static org.hamcrest.core.Is.is; +import static org.hamcrest.core.IsNull.nullValue; +import static org.junit.Assert.assertThat; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import org.jiemamy.core.MustBeMulti; +import org.jiemamy.core.S2FactoryStrategy; +import org.jiemamy.creator.JiemamyModelFactory; +import org.jiemamy.spec.model.RootModel; +import org.jiemamy.spec.model.node.TableModel; +import org.jiemamy.spec.view.model.DiagramPresentationModel; +import org.jiemamy.spec.view.model.DiagramPresentations; +import org.jiemamy.spec.view.model.geometory.JmRectangle; + +/** + * {@link SetConstraintProcessor}のテストクラス。 + * @author daisuke + */ +public class SetConstraintProcessorTest { + + private RootModel rootModel; + + private TableModel tableModel; + + + /** + * setup + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + JiemamyModelFactory.init(new S2FactoryStrategy("jiemamy-view.dicon")); + rootModel = JiemamyModelFactory.createRoot().init(); + DiagramPresentationModel presentation = + rootModel.createJiemamyModel(DiagramPresentationModel.class).init("テスト"); + rootModel.appendModel(presentation); + + TableModel table = rootModel.createJiemamyModel(TableModel.class).init("T_TEST"); + rootModel.appendModel(table); + } + + /** + * teardown + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + rootModel = null; + tableModel = null; + } + + /** + * tableModelに位置サイズ情報を与えることができる。 + * @throws Exception + */ + @Test + public void test01_tableModelに位置サイズ情報を与えることができる() throws Exception { + JmRectangle result; + + result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeLayouts().get(tableModel); + assertThat(result, nullValue()); + + rootModel.getAdapter(DiagramPresentations.class).get(MustBeMulti.ZERO).setConstraint(tableModel, + new JmRectangle(100, 200)); + + result = rootModel.getAdapter(DiagramPresentations.class).get(0).getNodeLayouts().get(tableModel); + assertThat(result.x, is(100)); + assertThat(result.y, is(200)); + } +} Modified: vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF =================================================================== --- vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2008-10-06 15:43:24 UTC (rev 2005) +++ vesta/trunk/org.jiemamy.eclipse/META-INF/MANIFEST.MF 2008-10-06 17:02:54 UTC (rev 2006) @@ -52,7 +52,20 @@ org.jiemamy.dialect.sql99, org.jiemamy.composer Export-Package: org.jiemamy.eclipse, + org.jiemamy.eclipse.action, + org.jiemamy.eclipse.editor, + org.jiemamy.eclipse.editor.command, + org.jiemamy.eclipse.editor.dialog, + org.jiemamy.eclipse.editor.editpart, + org.jiemamy.eclipse.editor.editpart.diagram, + org.jiemamy.eclipse.editor.editpart.outlinetree, + org.jiemamy.eclipse.editor.editpolicy, + org.jiemamy.eclipse.editor.extraprocessor, + org.jiemamy.eclipse.editor.figure, org.jiemamy.eclipse.extension, org.jiemamy.eclipse.extension.validator, - org.jiemamy.eclipse.preference + org.jiemamy.eclipse.preference, + org.jiemamy.eclipse.ui, + org.jiemamy.eclipse.utils, + org.jiemamy.eclipse.wizard Eclipse-LazyStart: true 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 2008-10-06 15:43:24 UTC (rev 2005) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/DiagramEditPartFactory.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -21,6 +21,7 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPartFactory; +import org.jiemamy.core.utils.ArgumentCheckUtil; import org.jiemamy.eclipse.editor.editpart.diagram.ForeignKeyEditPart; import org.jiemamy.eclipse.editor.editpart.diagram.RootEditPart; import org.jiemamy.eclipse.editor.editpart.diagram.StickyEditPart; @@ -43,6 +44,7 @@ * {@inheritDoc} */ public EditPart createEditPart(EditPart context, Object model) { + ArgumentCheckUtil.assertNotNull(model); EditPart part = null; if (model instanceof RootModel) { Modified: vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractModelTreeEditPart.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractModelTreeEditPart.java 2008-10-06 15:43:24 UTC (rev 2005) +++ vesta/trunk/org.jiemamy.eclipse/src/main/java/org/jiemamy/eclipse/editor/editpart/outlinetree/AbstractModelTreeEditPart.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -21,7 +21,7 @@ import org.eclipse.gef.editparts.AbstractTreeEditPart; import org.jiemamy.core.model.AbstractModel; -import org.jiemamy.event.AbstractObservable; +import org.jiemamy.spec.Adaptable; import org.jiemamy.spec.event.ModelChangeEvent; import org.jiemamy.spec.event.ModelChangeListener; import org.jiemamy.spec.event.Observable; @@ -43,7 +43,10 @@ RootModel rootModel = (RootModel) getRoot().getContents().getModel(); rootModel.getAdapter(Observable.class).addModelChangeListener(this); - ((AbstractObservable) getModel()).addModelChangeListener(this); + if (getModel() instanceof Adaptable) { + Adaptable adaptable = (Adaptable) getModel(); + adaptable.getAdapter(Observable.class).addModelChangeListener(this); + } } /** @@ -51,7 +54,10 @@ */ @Override public void deactivate() { - ((AbstractObservable) getModel()).removeModelChangeListener(this); + if (getModel() instanceof Adaptable) { + Adaptable adaptable = (Adaptable) getModel(); + adaptable.getAdapter(Observable.class).removeModelChangeListener(this); + } RootModel rootModel = (RootModel) getRoot().getContents().getModel(); rootModel.getAdapter(Observable.class).removeModelChangeListener(this); Modified: vesta/trunk/org.jiemamy.eclipse/src/main/resources/jiemamy-eclipse.dicon =================================================================== --- vesta/trunk/org.jiemamy.eclipse/src/main/resources/jiemamy-eclipse.dicon 2008-10-06 15:43:24 UTC (rev 2005) +++ vesta/trunk/org.jiemamy.eclipse/src/main/resources/jiemamy-eclipse.dicon 2008-10-06 17:02:54 UTC (rev 2006) @@ -2,8 +2,78 @@ <!DOCTYPE components PUBLIC "-//SEASAR//DTD S2Container 2.4//EN" "http://www.seasar.org/dtd/components24.dtd"> <components> - <include path="jiemamy-view.dicon"/> - <include path="jiemamy-event.dicon"/> + <include path="jiemamy-core.dicon"/> <include path="jiemamy-serializer.dicon"/> <include path="jiemamy-dialect.dicon"/> + + <component name="list" class="org.jiemamy.event.collectionimpl.ObservableList" instance="prototype"/> + <component name="set" class="org.jiemamy.event.collectionimpl.ObservableSet" instance="prototype"/> + <component name="map" class="org.jiemamy.event.collectionimpl.ObservableMap" instance="prototype"/> + + <component name="observableImpl" class="org.jiemamy.event.ObservableImpl" instance="prototype"/> + <component class="org.jiemamy.view.DiagramPresentationModelImpl" instance="prototype"/> + + <component class="org.jiemamy.core.model.RootModelImpl" instance="prototype"> + <initMethod name="registerAdapter"> + <arg>observableImpl</arg> + </initMethod> + <initMethod name="registerAdapter"> + <arg><component class="org.jiemamy.view.DiagramPresentationsImpl"/></arg> + </initMethod> + <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.core.appender.NodeAppender" /></arg> + </initMethod> + <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.core.appender.ConnectionAppender" /></arg> + </initMethod> + <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.core.appender.NodeAppender" /></arg> + </initMethod> + <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.core.appender.ConnectionAppender" /></arg> + </initMethod> + <initMethod name="registerAppender"> + <arg><component class="org.jiemamy.view.DiagramPresentationModelAppender" /></arg> + </initMethod> + </component> + + <!-- ChangeEventを自動的に発火させるためのsetterInterceptor --> + <component name="setterInterceptor" class="org.jiemamy.event.SetterInterceptor"/> + + <component class="org.jiemamy.core.model.node.TableModelImpl" autoBinding="none" instance="prototype"> + <aspect pointcut="set.*">setterInterceptor</aspect> + <initMethod name="registerAdapter"> + <arg>observableImpl</arg> + </initMethod> + <initMethod> + #self.registerAdapter(new org.jiemamy.event.model.node.TableModelChangeSupportImpl(#self)) + </initMethod> + </component> + <component class="org.jiemamy.core.model.ColumnModelImpl" instance="prototype" autoBinding="none"> + <aspect pointcut="set.*">setterInterceptor</aspect> + <initMethod name="registerAdapter"> + <arg>observableImpl</arg> + </initMethod> + <initMethod> + #self.registerAdapter(new org.jiemamy.event.model.ColumnModelChangeSupportImpl(#self)) + </initMethod> + </component> + <component class="org.jiemamy.core.model.index.IndexModelImpl" instance="prototype"> + <aspect pointcut="set.*">setterInterceptor</aspect> + <initMethod name="registerAdapter"> + <arg>observableImpl</arg> + </initMethod> + <initMethod> + #self.registerAdapter(new org.jiemamy.event.model.index.IndexModelChangeSupportImpl(#self)) + </initMethod> + </component> + <component class="org.jiemamy.core.model.constraint.CheckConstraintModelImpl" instance="prototype"> + <aspect pointcut="set.*">setterInterceptor</aspect> + <initMethod name="registerAdapter"> + <arg>observableImpl</arg> + </initMethod> + <initMethod> + #self.registerAdapter(new org.jiemamy.event.model.constraint.CheckConstraintModelChangeSupportImpl(#self)) + </initMethod> + </component> </components> Modified: zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/creator/JiemamyModelFactory.java =================================================================== --- zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/creator/JiemamyModelFactory.java 2008-10-06 15:43:24 UTC (rev 2005) +++ zeus/trunk/org.jiemamy.spec.core/src/main/java/org/jiemamy/creator/JiemamyModelFactory.java 2008-10-06 17:02:54 UTC (rev 2006) @@ -31,6 +31,19 @@ /** + * 与えられたJiemamy関連クラスのインスタンスを生成する。 + * @param <T> 生成するインスタンスの型 + * @param clazz + * @return 生成されたインスタンス + */ + public static <T>T create(Class<T> clazz) { + if (instance == null) { + throw new JiemamyRuntimeException("createRoot()呼び出し前に、init()が必要です。"); + } + return instance.strategy.create(clazz); + } + + /** * 新しい {@link RootModel} のインスタンスを取得する。 * @return {@link RootModel}のインスタンス。 */ @@ -46,19 +59,6 @@ instance = (new JiemamyModelFactory(strategy)); } - /** - * 与えられたJiemamy関連クラスのインスタンスを生成する。 - * @param <T> 生成するインスタンスの型 - * @param clazz - * @return 生成されたインスタンス - */ - static <T>T create(Class<T> clazz) { - if (instance == null) { - throw new JiemamyRuntimeException("createRoot()呼び出し前に、init()が必要です。"); - } - return instance.strategy.create(clazz); - } - /** インスタンス生成戦略 */ private FactoryStrategy strategy;