Author: rozagh
Date: 2012-07-26 14:13:13 -0700 (Thu, 26 Jul 2012)
New Revision: 30005
Added:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnEdit.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTask.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTaskFactoryImpl.java
Removed:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnEdit.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTask.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTaskFactoryImpl.java
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
Log:
fixes #1291 adding option to copy ata to all the rows in column or selected
rows only.
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
2012-07-26 21:10:28 UTC (rev 30004)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -133,7 +133,7 @@
import org.cytoscape.task.internal.session.OpenSessionTaskFactoryImpl;
import org.cytoscape.task.internal.session.SaveSessionAsTaskFactoryImpl;
import org.cytoscape.task.internal.session.SaveSessionTaskFactoryImpl;
-import
org.cytoscape.task.internal.table.CopyValueToEntireColumnTaskFactoryImpl;
+import org.cytoscape.task.internal.table.CopyValueToColumnTaskFactoryImpl;
import org.cytoscape.task.internal.table.DeleteColumnTaskFactoryImpl;
import org.cytoscape.task.internal.table.DeleteTableTaskFactoryImpl;
import org.cytoscape.task.internal.table.MapGlobalToLocalTableTaskFactoryImpl;
@@ -281,7 +281,10 @@
ApplyPreferredLayoutTaskFactoryImpl
applyPreferredLayoutTaskFactory = new
ApplyPreferredLayoutTaskFactoryImpl(cyLayoutsServiceRef,cyPropertyServiceRef);
DeleteColumnTaskFactoryImpl deleteColumnTaskFactory = new
DeleteColumnTaskFactoryImpl(undoSupportServiceRef);
RenameColumnTaskFactoryImpl renameColumnTaskFactory = new
RenameColumnTaskFactoryImpl(undoSupportServiceRef, tunableSetterServiceRef);
- CopyValueToEntireColumnTaskFactoryImpl
copyValueToEntireColumnTaskFactory = new
CopyValueToEntireColumnTaskFactoryImpl(undoSupportServiceRef);
+
+ CopyValueToColumnTaskFactoryImpl
copyValueToEntireColumnTaskFactory = new
CopyValueToColumnTaskFactoryImpl(undoSupportServiceRef, false);
+ CopyValueToColumnTaskFactoryImpl
copyValueToSelectedRowsInColumnTaskFactory = new
CopyValueToColumnTaskFactoryImpl(undoSupportServiceRef, true);
+
DeleteTableTaskFactoryImpl deleteTableTaskFactory = new
DeleteTableTaskFactoryImpl(cyTableManagerServiceRef);
ExportVizmapTaskFactoryImpl exportVizmapTaskFactory = new
ExportVizmapTaskFactoryImpl(vizmapWriterManagerServiceRef,visualMappingManagerServiceRef,
tunableSetterServiceRef);
ConnectSelectedNodesTaskFactoryImpl
connectSelectedNodesTaskFactory = new
ConnectSelectedNodesTaskFactoryImpl(undoSupportServiceRef, cyEventHelperRef,
visualMappingManagerServiceRef, cyNetworkViewManagerServiceRef);
@@ -946,6 +949,10 @@
registerService(bc,deleteTableTaskFactory,TableTaskFactory.class, new
Properties());
registerService(bc,deleteTableTaskFactory,DeleteTableTaskFactory.class, new
Properties());
+ Properties copyValueToSelectedRowsInColumnTaskFactoryProps =
new Properties();
+
copyValueToSelectedRowsInColumnTaskFactoryProps.setProperty(TITLE,"Copy to
current selection");
+
registerService(bc,copyValueToSelectedRowsInColumnTaskFactory,TableCellTaskFactory.class,
copyValueToSelectedRowsInColumnTaskFactoryProps);
+
// Register as 3 types of service.
Properties connectSelectedNodesTaskFactoryProps = new
Properties();
connectSelectedNodesTaskFactoryProps.setProperty(IN_MENU_BAR,"false");
Copied:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnEdit.java
(from rev 29888,
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnEdit.java)
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnEdit.java
(rev 0)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnEdit.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -0,0 +1,47 @@
+package org.cytoscape.task.internal.table;
+
+
+import java.util.Collection;
+
+import org.cytoscape.model.CyColumn;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.work.undo.AbstractCyEdit;
+
+
+/** An undoable edit that will undo and redo the copying of a value to an
entire column. */
+final class CopyValueToColumnEdit extends AbstractCyEdit {
+ private final CyTable table;
+ private final String columnName;
+ private final Class<?> columnType;
+ private final Object value;
+ private SaveColumn savedColumn;
+
+ CopyValueToColumnEdit(final CyColumn column, final Object value) {
+ super("Copy Value to Entire Column");
+
+ this.table = column.getTable();
+ this.columnName = column.getName();
+ this.columnType = column.getType();
+ this.value = value;
+ this.savedColumn = new SaveColumn(table, columnName);
+
+ }
+
+ public void redo() {
+ ;
+
+ savedColumn = new SaveColumn(table, columnName);
+
+ final Collection<CyRow> rows = table.getAllRows();
+ for (final CyRow row : rows)
+ row.set(columnName, value);
+ }
+
+ public void undo() {
+ ;
+
+ savedColumn.restoreColumn(table, columnName);
+ savedColumn = null;
+ }
+}
Copied:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTask.java
(from rev 29888,
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTask.java)
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTask.java
(rev 0)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTask.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -0,0 +1,78 @@
+/*
+ Copyright (c) 2010-2011, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.task.internal.table;
+
+
+import java.util.List;
+
+import org.cytoscape.model.CyColumn;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.task.AbstractTableCellTask;
+import org.cytoscape.work.TaskMonitor;
+import org.cytoscape.work.undo.UndoSupport;
+
+
+final class CopyValueToColumnTask extends AbstractTableCellTask {
+ private final UndoSupport undoSupport;
+ private final boolean selectedOnly;
+
+ CopyValueToColumnTask(final UndoSupport undoSupport, final CyColumn
column,
+ final Object primaryKeyValue, final boolean
selectedOnly)
+ {
+ super(column, primaryKeyValue);
+ this.undoSupport = undoSupport;
+ this.selectedOnly = selectedOnly;
+ }
+
+ @Override
+ public void run(final TaskMonitor taskMonitor) throws Exception {
+ taskMonitor.setTitle("Copying...");
+
+ final CyRow sourceRow =
column.getTable().getRow(primaryKeyValue);
+ final String columnName = column.getName();
+ final Object sourceValue = sourceRow.getRaw(columnName);
+
+ undoSupport.postEdit(
+ new CopyValueToColumnEdit(column, sourceValue));
+
+ final List<CyRow> rows = column.getTable().getAllRows();
+ final int total = rows.size() - 1;
+ int count = 0;
+ for (final CyRow row : rows) {
+ if (row == sourceRow)
+ continue;
+ if (selectedOnly && !row.get(CyNetwork.SELECTED,
Boolean.class))
+ continue;
+ row.set(columnName, sourceValue);
+ if ((++count % 1000) == 0)
+ taskMonitor.setProgress((100.0 * count) /
total);
+ }
+ }
+}
\ No newline at end of file
Copied:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTaskFactoryImpl.java
(from rev 29888,
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTaskFactoryImpl.java)
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTaskFactoryImpl.java
(rev 0)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToColumnTaskFactoryImpl.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2010-2011, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.task.internal.table;
+
+
+import org.cytoscape.model.CyColumn;
+import org.cytoscape.task.AbstractTableCellTaskFactory;
+import org.cytoscape.work.TaskIterator;
+import org.cytoscape.work.undo.UndoSupport;
+
+
+public final class CopyValueToColumnTaskFactoryImpl extends
AbstractTableCellTaskFactory {
+ private final UndoSupport undoSupport;
+ private final boolean selectedOnly;
+
+ public CopyValueToColumnTaskFactoryImpl(final UndoSupport undoSupport,
boolean selectedOnly) {
+ this.undoSupport = undoSupport;
+ this.selectedOnly = selectedOnly;
+ }
+
+ @Override
+ public TaskIterator createTaskIterator(CyColumn column, Object
primaryKeyValue) {
+ if (column == null)
+ throw new IllegalStateException("\"column\" was not
set.");
+ if (primaryKeyValue == null)
+ throw new IllegalStateException("\"primaryKeyValue\"
was not set.");
+ return new TaskIterator(new CopyValueToColumnTask(undoSupport,
column,
+
primaryKeyValue, selectedOnly));
+ }
+}
Deleted:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnEdit.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnEdit.java
2012-07-26 21:10:28 UTC (rev 30004)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnEdit.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -1,47 +0,0 @@
-package org.cytoscape.task.internal.table;
-
-
-import java.util.Collection;
-
-import org.cytoscape.model.CyColumn;
-import org.cytoscape.model.CyRow;
-import org.cytoscape.model.CyTable;
-import org.cytoscape.work.undo.AbstractCyEdit;
-
-
-/** An undoable edit that will undo and redo the copying of a value to an
entire column. */
-final class CopyValueToEntireColumnEdit extends AbstractCyEdit {
- private final CyTable table;
- private final String columnName;
- private final Class<?> columnType;
- private final Object value;
- private SaveColumn savedColumn;
-
- CopyValueToEntireColumnEdit(final CyColumn column, final Object value) {
- super("Copy Value to Entire Column");
-
- this.table = column.getTable();
- this.columnName = column.getName();
- this.columnType = column.getType();
- this.value = value;
- this.savedColumn = new SaveColumn(table, columnName);
-
- }
-
- public void redo() {
- ;
-
- savedColumn = new SaveColumn(table, columnName);
-
- final Collection<CyRow> rows = table.getAllRows();
- for (final CyRow row : rows)
- row.set(columnName, value);
- }
-
- public void undo() {
- ;
-
- savedColumn.restoreColumn(table, columnName);
- savedColumn = null;
- }
-}
Deleted:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTask.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTask.java
2012-07-26 21:10:28 UTC (rev 30004)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTask.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -1,73 +0,0 @@
-/*
- Copyright (c) 2010-2011, The Cytoscape Consortium (www.cytoscape.org)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.task.internal.table;
-
-
-import java.util.List;
-
-import org.cytoscape.model.CyColumn;
-import org.cytoscape.model.CyTable;
-import org.cytoscape.model.CyRow;
-import org.cytoscape.task.AbstractTableCellTask;
-import org.cytoscape.work.TaskMonitor;
-import org.cytoscape.work.undo.UndoSupport;
-
-
-final class CopyValueToEntireColumnTask extends AbstractTableCellTask {
- private final UndoSupport undoSupport;
-
- CopyValueToEntireColumnTask(final UndoSupport undoSupport, final
CyColumn column,
- final Object primaryKeyValue)
- {
- super(column, primaryKeyValue);
- this.undoSupport = undoSupport;
- }
-
- @Override
- public void run(final TaskMonitor taskMonitor) throws Exception {
- taskMonitor.setTitle("Copying...");
-
- final CyRow sourceRow =
column.getTable().getRow(primaryKeyValue);
- final String columnName = column.getName();
- final Object sourceValue = sourceRow.getRaw(columnName);
-
- undoSupport.postEdit(
- new CopyValueToEntireColumnEdit(column, sourceValue));
-
- final List<CyRow> rows = column.getTable().getAllRows();
- final int total = rows.size() - 1;
- int count = 0;
- for (final CyRow row : rows) {
- if (row == sourceRow)
- continue;
- row.set(columnName, sourceValue);
- if ((++count % 1000) == 0)
- taskMonitor.setProgress((100.0 * count) /
total);
- }
- }
-}
\ No newline at end of file
Deleted:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTaskFactoryImpl.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTaskFactoryImpl.java
2012-07-26 21:10:28 UTC (rev 30004)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/table/CopyValueToEntireColumnTaskFactoryImpl.java
2012-07-26 21:13:13 UTC (rev 30005)
@@ -1,53 +0,0 @@
-/*
- Copyright (c) 2010-2011, The Cytoscape Consortium (www.cytoscape.org)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.task.internal.table;
-
-
-import org.cytoscape.model.CyColumn;
-import org.cytoscape.task.AbstractTableCellTaskFactory;
-import org.cytoscape.work.TaskIterator;
-import org.cytoscape.work.undo.UndoSupport;
-
-
-public final class CopyValueToEntireColumnTaskFactoryImpl extends
AbstractTableCellTaskFactory {
- private final UndoSupport undoSupport;
-
- public CopyValueToEntireColumnTaskFactoryImpl(final UndoSupport
undoSupport) {
- this.undoSupport = undoSupport;
- }
-
- @Override
- public TaskIterator createTaskIterator(CyColumn column, Object
primaryKeyValue) {
- if (column == null)
- throw new IllegalStateException("\"column\" was not
set.");
- if (primaryKeyValue == null)
- throw new IllegalStateException("\"primaryKeyValue\"
was not set.");
- return new TaskIterator(new
CopyValueToEntireColumnTask(undoSupport, column,
-
primaryKeyValue));
- }
-}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.