svnno****@sourc*****
svnno****@sourc*****
2009年 3月 17日 (火) 04:52:23 JST
Revision: 2892 http://svn.sourceforge.jp/view?root=jiemamy&view=rev&rev=2892 Author: daisuke_m Date: 2009-03-17 04:52:22 +0900 (Tue, 17 Mar 2009) Log Message: ----------- インデックスまわりの整備。 Modified Paths: -------------- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/index/IndexColumnModelImpl.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDataSetTab.java vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/index/IndexColumnModel.java -------------- next part -------------- Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java 2009-03-16 19:30:51 UTC (rev 2891) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/editcommand/CommandProcessorImpl.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -37,12 +37,16 @@ import org.jiemamy.editcommand.impl.AddDataSetToRootCommand; import org.jiemamy.editcommand.impl.AddDomainToRootCommand; import org.jiemamy.editcommand.impl.AddEntityToRootCommand; +import org.jiemamy.editcommand.impl.AddIndexColumnCommand; +import org.jiemamy.editcommand.impl.AddIndexCommand; import org.jiemamy.editcommand.impl.ModifyModelPropertyCommand; import org.jiemamy.editcommand.impl.RemoveAttributeCommand; import org.jiemamy.editcommand.impl.RemoveColumnFromColumnRefListCommand; import org.jiemamy.editcommand.impl.RemoveDataSetFromRootCommand; import org.jiemamy.editcommand.impl.RemoveDomainFromRootCommand; import org.jiemamy.editcommand.impl.RemoveEntityFromRootCommand; +import org.jiemamy.editcommand.impl.RemoveIndexColumnCommand; +import org.jiemamy.editcommand.impl.RemoveIndexCommand; import org.jiemamy.editcommand.impl.SwapListElementCommand; import org.jiemamy.editcommand.impl.UpdateForeignKeyMappingCommand; import org.jiemamy.exception.JiemamyRuntimeException; @@ -58,6 +62,8 @@ import org.jiemamy.model.datatype.DomainModel; import org.jiemamy.model.entity.EntityModel; import org.jiemamy.model.entity.TableModel; +import org.jiemamy.model.index.IndexColumnModel; +import org.jiemamy.model.index.IndexModel; /** * コマンドを実行するクラス。 @@ -138,6 +144,24 @@ processAddToCollection(command); } + /** + * {@link IndexColumnModel}を{@link IndexModel}に追加するEDITコマンドを実行する。 + * + * @param command コマンド + */ + public void process(AddIndexColumnCommand command) { + processAddToCollection(command); + } + + /** + * {@link IndexModel}を{@link TableModel}に追加するEDITコマンドを実行する。 + * + * @param command コマンド + */ + public void process(AddIndexCommand command) { + processAddToCollection(command); + } + public void process(Command command) { Validate.notNull(command); // HACK 実行時に無理矢理ディスパッチする…。 @@ -231,6 +255,24 @@ } /** + * {@link IndexModel}から{@link IndexColumnModel}を削除するEDITコマンドを実行する。 + * + * @param command コマンド + */ + public void process(RemoveIndexColumnCommand command) { + processRemoveFromCollection(command); + } + + /** + * {@link TableModel}から{@link IndexModel}を削除するEDITコマンドを実行する。 + * + * @param command コマンド + */ + public void process(RemoveIndexCommand command) { + processRemoveFromCollection(command); + } + + /** * リスト要素の入れ替えを行うEDITコマンドを実行する。 * * @param command コマンド Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/index/IndexColumnModelImpl.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/index/IndexColumnModelImpl.java 2009-03-16 19:30:51 UTC (rev 2891) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/model/index/IndexColumnModelImpl.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -60,12 +60,12 @@ return sortOrder; } - public void setColumn(ColumnRef columnRef) { + public void setColumnRef(ColumnRef columnRef) { this.columnRef = columnRef; } - public void setSortType(SortOrder sortType) { - this.sortOrder = sortType; + public void setSortType(SortOrder sortOrder) { + this.sortOrder = sortOrder; } @Override Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java 2009-03-16 19:30:51 UTC (rev 2891) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/serializer/JiemamyDomParser.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -493,7 +493,7 @@ factory.newModel(IndexColumnModel.class, DomUtil.getUUID(node, CoreQName.ID)); Node columnRefNode = XpathUtil.getNode(node, "core:columnRef"); ColumnRef columnRef = new ColumnRefImpl(jiemamy, DomUtil.getUUID(columnRefNode, CoreQName.REF)); - indexColumnModel.setColumn(columnRef); + indexColumnModel.setColumnRef(columnRef); indexModel.getIndexColumns().add(indexColumnModel); } tableModel.getIndexes().add(indexModel); Modified: artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java =================================================================== --- artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java 2009-03-16 19:30:51 UTC (rev 2891) +++ artemis/trunk/jiemamy-core/src/main/java/org/jiemamy/test/TestModelBuilder.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -753,7 +753,7 @@ empNameIndex = factory.newModel(IndexModel.class, uuid.get("9abc9e01-4cdb-42fe-a495-93b56af35a1d")); IndexColumnModel indexColumnModel = factory.newModel(IndexColumnModel.class, uuid.get("52d2b6aa-fff7-4c33-af13-f4d0b63e8e58")); - indexColumnModel.setColumn(factory.newReference(empEmpName)); + indexColumnModel.setColumnRef(factory.newReference(empEmpName)); empNameIndex.getIndexColumns().add(indexColumnModel); tableEmp.getIndexes().add(empNameIndex); } Modified: vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDataSetTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDataSetTab.java 2009-03-16 19:30:51 UTC (rev 2891) +++ vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/root/RootEditDialogDataSetTab.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -122,31 +122,12 @@ public void commandExecuted(Command command) { logger.debug(LogMarker.LIFECYCLE, "DataSetContentProvider: commandExecuted"); -// if (evt.getPropertyName().equals(TableModel.P_ENTITY_TABLE_CHECKS)) { dataSetEditor.refreshTable(); -// } else if (evt.getPropertyName().equals(CheckConstraint.P_CHECK_NAME)) { -// checkEditArea.refreshTable(); -// } else if (evt.getPropertyName().equals(CheckConstraint.P_CHECK_DEFINITION)) { -// checkEditArea.refreshTable(); -// } else if (evt.getSource() instanceof CheckConstraint) { -// checkEditArea.refreshTable(); -// if (evt.getPropertyName().equals(CheckConstraint.P_CREATE)) { -// // nothing to do -// } else if (evt.getPropertyName().equals(CheckConstraint.P_DELETE)) { -// ((AbstractModel) evt.getSource()).removePropertyChangeListener(this); -// } else if (evt.getPropertyName().equals(CheckConstraint.P_REVERT)) { -// ((AbstractModel) evt.getSource()).addPropertyChangeListener(this); -// } -// } } @Override public void dispose() { logger.debug(LogMarker.LIFECYCLE, "DataSetContentProvider: disposed"); -// tableModel.removePropertyChangeListener(this); -// for (CheckConstraint check : tableModel.getChecks()) { -// ((AbstractModel) check).removePropertyChangeListener(this); -// } super.dispose(); } @@ -162,19 +143,6 @@ this.viewer = viewer; -// if (oldInput != null) { -// tableModel.removePropertyChangeListener(this); -// for (CheckConstraint check : tableModel.getChecks()) { -// ((AbstractModel) check).removePropertyChangeListener(this); -// } -// } -// if (newInput != null) { -// tableModel.addPropertyChangeListener(this); -// for (CheckConstraint check : tableModel.getChecks()) { -// ((AbstractModel) check).addPropertyChangeListener(this); -// } -// } - super.inputChanged(viewer, oldInput, newInput); } @@ -344,8 +312,6 @@ @Override protected void disableEditorControls() { txtDataSetName.setText(StringUtils.EMPTY); - btnEdit.setText(StringUtils.EMPTY); - txtDataSetName.setEnabled(false); btnEdit.setEnabled(false); } Modified: vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java =================================================================== --- vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java 2009-03-16 19:30:51 UTC (rev 2891) +++ vesta/trunk/org.jiemamy.eclipse.ui/src/main/java/org/jiemamy/eclipse/editor/dialog/table/TableEditDialogIndexTab.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -377,9 +377,9 @@ radSortNone.setSelection(false); radSortAsc.setSelection(false); radSortDesc.setSelection(false); - if (indexColumnModel.getSortOrder().equals(SortOrder.ASC)) { + if (SortOrder.ASC.equals(indexColumnModel.getSortOrder())) { radSortAsc.setSelection(true); - } else if (indexColumnModel.getSortOrder().equals(SortOrder.DESC)) { + } else if (SortOrder.DESC.equals(indexColumnModel.getSortOrder())) { radSortDesc.setSelection(true); } else { radSortNone.setSelection(true); @@ -398,8 +398,8 @@ JiemamyFactory factory = jiemamy.getFactory(); IndexColumnModel indexColumnModel = factory.newModel(IndexColumnModel.class); - // FIXME facadeで操作 - indexColumnModel.setColumn(factory.newReference(dialog.getResult())); + ColumnRef columnRef = factory.newReference(dialog.getResult()); + jiemamyFacade.changeModelProperty(indexColumnModel, IndexColumnProperty.columnRef, columnRef); IndexModel indexModel = tableModel.getIndexes().get(indexIndex); if (index < 0 || index > table.getItemCount()) { @@ -705,7 +705,7 @@ txtIndexName.setEnabled(true); chkIsUniqueIndex.setEnabled(true); - txtIndexName.setText(indexModel.getName()); + txtIndexName.setText(JiemamyPropertyUtil.careNull(indexModel.getName())); chkIsUniqueIndex.setSelection(indexModel.isUnique()); // 現在値の設定 Modified: zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/index/IndexColumnModel.java =================================================================== --- zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/index/IndexColumnModel.java 2009-03-16 19:30:51 UTC (rev 2891) +++ zeus/trunk/jiemamy-spec-core/src/main/java/org/jiemamy/model/index/IndexColumnModel.java 2009-03-16 19:52:22 UTC (rev 2892) @@ -53,7 +53,7 @@ * @param column インデックス対象カラム * @since 0.2 */ - void setColumn(ColumnRef column); + void setColumnRef(ColumnRef column); /** * カラムソート方式を設定する。