svnno****@sourc*****
svnno****@sourc*****
2008年 10月 6日 (月) 22:32:25 JST
Revision: 1997 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=jiemamy&view=rev&rev=1997 Author: daisuke_m Date: 2008-10-06 22:32:25 +0900 (Mon, 06 Oct 2008) Log Message: ----------- jiemamy-event.diconに、各ChangeSupportを登録。 / AbstractModel#adapters を固定でArrayList初期化に変更。 Modified Paths: -------------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/datatype/AbstractDataType.java artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/node/TableModelChangeSupportImpl.java artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/swap/SwapperTest.java Added Paths: ----------- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ArgumentCheckUtil.java -------------- next part -------------- Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java 2008-10-05 04:42:31 UTC (rev 1996) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/AbstractModel.java 2008-10-06 13:32:25 UTC (rev 1997) @@ -17,7 +17,7 @@ import java.util.List; import java.util.UUID; -import org.seasar.framework.container.annotation.tiger.Binding; +import org.seasar.framework.util.tiger.CollectionsUtil; import org.jiemamy.spec.Processor; import org.jiemamy.spec.model.JiemamyModel; @@ -29,8 +29,7 @@ public abstract class AbstractModel implements JiemamyModel { /** 適用可能なアダプタのリスト */ - @Binding("list") - protected List<Object> adapters; + private List<Object> adapters = CollectionsUtil.newArrayList(); /** * モデルID @@ -150,6 +149,17 @@ } /** + * モデルマネージャにモデルの登録を行う。 + */ + protected void initialize() { + if (isInitialized() == false) { + ModelIdManager modelManager = ModelIdManager.getInstance(); + modelManager.register(this); + initialized = true; + } + } + + /** * モデルIDを設定する。 * * <p>モデルIDは、このモデルのライフサイクル(生成から削除まで)を通して一貫しているべきであり、通常このメソッドは @@ -158,18 +168,7 @@ * @param id モデルID * @category accessing */ - public void setId(UUID id) { + void setId(UUID id) { this.id = id; } - - /** - * モデルマネージャにモデルの登録を行う。 - */ - protected void initialize() { - if (isInitialized() == false) { - ModelIdManager modelManager = ModelIdManager.getInstance(); - modelManager.register(this); - initialized = true; - } - } } Modified: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/datatype/AbstractDataType.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/datatype/AbstractDataType.java 2008-10-05 04:42:31 UTC (rev 1996) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/model/datatype/AbstractDataType.java 2008-10-06 13:32:25 UTC (rev 1997) @@ -18,8 +18,6 @@ */ package org.jiemamy.core.model.datatype; -import java.util.ArrayList; - import org.jiemamy.core.model.AbstractModel; import org.jiemamy.spec.model.datatype.DataType; import org.jiemamy.spec.model.datatype.DataTypeAdapter; @@ -31,14 +29,6 @@ public abstract class AbstractDataType extends AbstractModel implements DataType { /** - * コンストラクタ。 - * @category instance creation - */ - public AbstractDataType() { - adapters = (new ArrayList<Object>()); - } - - /** * {@inheritDoc} */ @Override Added: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ArgumentCheckUtil.java =================================================================== --- artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ArgumentCheckUtil.java (rev 0) +++ artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ArgumentCheckUtil.java 2008-10-06 13:32:25 UTC (rev 1997) @@ -0,0 +1,35 @@ +/* + * Copyright 2007-2008 MIYAMOTO Daisuke, jiemamy.org and the Others. + * Created on 2008/10/06 + * + * 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.core.utils; + +/** + * TODO for daisuke + * @author daisuke + */ +public class ArgumentCheckUtil { + + public static void assertNotNull(Object obj) { + if (obj == null) { + throw new NullPointerException(); + } + } + + private ArgumentCheckUtil() { + } +} Property changes on: artemis/trunk/org.jiemamy.core/src/main/java/org/jiemamy/core/utils/ArgumentCheckUtil.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/node/TableModelChangeSupportImpl.java =================================================================== --- artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/node/TableModelChangeSupportImpl.java 2008-10-05 04:42:31 UTC (rev 1996) +++ artemis/trunk/org.jiemamy.event/src/main/java/org/jiemamy/event/model/node/TableModelChangeSupportImpl.java 2008-10-06 13:32:25 UTC (rev 1997) @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +import org.jiemamy.core.utils.ArgumentCheckUtil; import org.jiemamy.event.collectionimpl.ObservableList; import org.jiemamy.spec.event.ModelChangeEvent; import org.jiemamy.spec.event.ModelChangeListener; @@ -135,19 +136,19 @@ * @category instance creation */ public TableModelChangeSupportImpl(TableModel source) { - assert source.hasAdapter(Observable.class); + ArgumentCheckUtil.assertNotNull(source); + source.getAdapter(Observable.class).addModelChangeListener(modelChangeListener); ((ObservableList<CheckConstraintModel>) source.getChecks()).addListener(checksCollectionChangeListener); ((ObservableList<ColumnModel>) source.getColumns()).addListener(columnsCollectionChangeListener); ((ObservableList<IndexModel>) source.getIndexes()).addListener(indexesCollectionChangeListener); - ((ObservableList<ColumnModel>) source.getPrimaryKeyColumns()) - .addListener(primaryKeyColumnsCollectionChangeListener); +// ((ObservableList<ColumnModel>) source.getPrimaryKeyColumns()) +// .addListener(primaryKeyColumnsCollectionChangeListener); } /** * TableModel自身のEventを監視するListenerを追加する。 - * - * @param l {@link TableModelChangeListener} + * @param l {@link TableModelChangeListener} * @see #removeTableModelChangeListener(TableModelChangeListener) */ public void addTableModelChangeListener(TableModelChangeListener l) { @@ -156,8 +157,7 @@ /** * checksのcollectionを監視するListenerに通知されたEventをTableModelの監視Listenerへ通知する。 - * - * @param event {@link ObservableCollectionChangeEvent} + * @param event {@link ObservableCollectionChangeEvent} */ public void fireChecksCollectionChangeEvent( ObservableCollectionChangeEvent<List<CheckConstraintModel>, CheckConstraintModel> event) { @@ -168,8 +168,7 @@ /** * columnsのcollectionを監視するListenerに通知されたEventをTableModelの監視Listenerへ通知する。 - * - * @param event {@link ObservableCollectionChangeEvent} + * @param event {@link ObservableCollectionChangeEvent} */ public void fireColumnsCollectionChangeEvent(ObservableCollectionChangeEvent<List<ColumnModel>, ColumnModel> event) { for (TableModelChangeListener l : listeners) { @@ -179,8 +178,7 @@ /** * indexesのcollectionを監視するListenerに通知されたEventをTableModelの監視Listenerへ通知する。 - * - * @param event {@link ObservableCollectionChangeEvent} + * @param event {@link ObservableCollectionChangeEvent} */ public void fireIndexesCollectionChangeEvent(ObservableCollectionChangeEvent<List<IndexModel>, IndexModel> event) { for (TableModelChangeListener l : listeners) { @@ -190,8 +188,7 @@ /** * TableModel自身を監視するListenerに通知されたEventをTableModelの監視Listenerへ通知する。 - * - * @param event {@link ModelChangeEvent} + * @param event {@link ModelChangeEvent} */ public void fireModelChange(ModelChangeEvent event) { for (TableModelChangeListener l : listeners) { @@ -201,8 +198,7 @@ /** * primaryKeyColumnsのcollectionを監視するListenerに通知されたEventをTableModelの監視Listenerへ通知する。 - * - * @param event {@link ObservableCollectionChangeEvent} + * @param event {@link ObservableCollectionChangeEvent} */ public void firePrimaryKeyColumnsCollectionChangeEvent( ObservableCollectionChangeEvent<List<ColumnModel>, ColumnModel> event) { @@ -213,8 +209,7 @@ /** * TableModel自身のEventを監視するListenerを削除する。 - * - * @param l {@link TableModelChangeListener} + * @param l {@link TableModelChangeListener} * @see #addTableModelChangeListener(TableModelChangeListener) */ public void removeTableModelChangeListener(TableModelChangeListener l) { Modified: artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon =================================================================== --- artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon 2008-10-05 04:42:31 UTC (rev 1996) +++ artemis/trunk/org.jiemamy.event/src/main/resources/jiemamy-event.dicon 2008-10-06 13:32:25 UTC (rev 1997) @@ -29,38 +29,41 @@ <!-- ChangeEventを自動的に発火させるためのsetterInterceptor --> <component name="setterInterceptor" class="org.jiemamy.event.SetterInterceptor"/> - <component class="org.jiemamy.core.model.node.TableModelImpl" instance="prototype"> + <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 name="registerAdapter"> - <arg> - <component class="org.jiemamy.event.model.node.TableModelChangeSupportImpl"> - <arg>#self</arg> - </component> - </arg> + <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> <!-- 自動登録されたModelへのsetterInterceptorの自動登録 --> Modified: artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/swap/SwapperTest.java =================================================================== --- artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/swap/SwapperTest.java 2008-10-05 04:42:31 UTC (rev 1996) +++ artemis/trunk/org.jiemamy.serializer/src/test/java/org/jiemamy/serializer/swap/SwapperTest.java 2008-10-06 13:32:25 UTC (rev 1997) @@ -26,7 +26,7 @@ import org.junit.Test; /** - * {@link Swapper }のテストクラス。 + * {@link Swapper}のテストクラス。 * * @author Keisuke.K */