Author: rozagh
Date: 2012-05-04 16:32:23 -0700 (Fri, 04 May 2012)
New Revision: 29124
Modified:
core3/api/trunk/swing-util-api/src/main/java/org/cytoscape/util/swing/internal/FileUtilImpl.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/TunableAbstractCyWriter.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/ViewWriter.java
Log:
fixes #673 The AbstractTunableWriter checks if the file is modified or not. If
the file is modified it shows that the may not have overwriting for overwriting
on the correct file. However, if the file is entered correctly it should have
already been checked by the file chooser.
Also, FileUtil should not check the file type and it is the task of writer and
readers to check the file type.
Modified:
core3/api/trunk/swing-util-api/src/main/java/org/cytoscape/util/swing/internal/FileUtilImpl.java
===================================================================
---
core3/api/trunk/swing-util-api/src/main/java/org/cytoscape/util/swing/internal/FileUtilImpl.java
2012-05-04 23:30:20 UTC (rev 29123)
+++
core3/api/trunk/swing-util-api/src/main/java/org/cytoscape/util/swing/internal/FileUtilImpl.java
2012-05-04 23:32:23 UTC (rev 29124)
@@ -155,8 +155,9 @@
final File[] results = new File[1];
String newFileName = chooser.getFile();
- if (load_save_custom == SAVE)
- newFileName =
addFileExt(filters, newFileName);
+ //We need to do this check in the
writers/readers
+ //if (load_save_custom == SAVE)
+ // newFileName =
addFileExt(filters, newFileName);
results[0] = new
File(chooser.getDirectory() + File.separator + newFileName);
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/TunableAbstractCyWriter.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/TunableAbstractCyWriter.java
2012-05-04 23:30:20 UTC (rev 29123)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/TunableAbstractCyWriter.java
2012-05-04 23:32:23 UTC (rev 29124)
@@ -47,11 +47,31 @@
@Override
public final ValidationState getValidationState(final Appendable msg) {
+ if(getExportFileFormat()==null){
+ try {
+ msg.append("Select a file type!");
+ } catch (final Exception e) {
+ /* Intentionally empty! */
+ }
+ return ValidationState.INVALID;
+ }
+
+ if(outputFile==null){
+ try {
+ msg.append("Enter the file address!");
+ } catch (final Exception e) {
+ /* Intentionally empty! */
+ }
+ return ValidationState.INVALID;
+ }
+
+ boolean isFileChanged = false;
// Make sure we have the right extension, if not, then force it:
- if (!fileExtensionIsOk(outputFile))
+ if (!fileExtensionIsOk(outputFile)){
outputFile = addOrReplaceExtension(outputFile);
-
- if (outputFile.exists()) {
+ isFileChanged = true;
+ }
+ if (isFileChanged && outputFile.exists()) {
try {
msg.append("File already exists, are you sure
you want to overwrite it?");
} catch (final Exception e) {
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/ViewWriter.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/ViewWriter.java
2012-05-04 23:30:20 UTC (rev 29123)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/export/ViewWriter.java
2012-05-04 23:32:23 UTC (rev 29124)
@@ -48,9 +48,8 @@
return writerManager.getWriter(view,re,filter,file);
}
- @Tunable(description="Save Image As:", params="input=false",
dependsOn="options!=")
+ @Tunable(description="Save Image As:",
params="fileCategory=image;input=false", dependsOn="options!=")
public File getOutputFile() {
- System.out.println("ViewWriter.getOutputFile()");
return outputFile;
}
--
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.