Author: kono
Date: 2012-08-07 11:17:26 -0700 (Tue, 07 Aug 2012)
New Revision: 30110
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/task/ImportOntologyAndAnnotationAction.java
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/AttributeMappingParametersHandler.java
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/NetworkTableMappingParametersHandler.java
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/DataSourceSelectDialog.java
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/OntologyPanelBuilder.java
Log:
Local file can be registered to the resource list.
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/task/ImportOntologyAndAnnotationAction.java
===================================================================
---
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/task/ImportOntologyAndAnnotationAction.java
2012-08-07 17:04:19 UTC (rev 30109)
+++
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/task/ImportOntologyAndAnnotationAction.java
2012-08-07 18:17:26 UTC (rev 30110)
@@ -22,6 +22,7 @@
import org.cytoscape.property.bookmark.BookmarksUtil;
import org.cytoscape.tableimport.internal.ui.ImportTablePanel;
import org.cytoscape.tableimport.internal.util.CytoscapeServices;
+import org.cytoscape.util.swing.FileUtil;
import org.cytoscape.work.TaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,6 +43,7 @@
private final CyNetworkManager manager;
private final CyTableFactory tableFactory;
private final CyTableManager tableManager;
+ private final FileUtil fileUtil;
public ImportOntologyAndAnnotationAction(final InputStreamTaskFactory
factory)
{
@@ -56,6 +58,7 @@
this.manager = CytoscapeServices.cyNetworkManager;
this.tableFactory = CytoscapeServices.cyTableFactory;
this.tableManager = CytoscapeServices.cyTableManager;
+ this.fileUtil = CytoscapeServices.fileUtil;
}
@Override
@@ -66,7 +69,7 @@
ontologyPanel =
new
ImportTablePanel(ImportTablePanel.ONTOLOGY_AND_ANNOTATION_IMPORT,
null, null, bookmarksProp,
bkUtil, taskManager,
- factory, manager,
tableFactory, tableManager);
+ factory, manager,
tableFactory, tableManager, fileUtil);
dialog.add(ontologyPanel, BorderLayout.CENTER);
dialog.pack();
dialog.setLocationRelativeTo(null);
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/AttributeMappingParametersHandler.java
===================================================================
---
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/AttributeMappingParametersHandler.java
2012-08-07 17:04:19 UTC (rev 30109)
+++
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/AttributeMappingParametersHandler.java
2012-08-07 18:17:26 UTC (rev 30110)
@@ -16,6 +16,8 @@
import org.cytoscape.tableimport.internal.reader.AttributeMappingParameters;
import org.cytoscape.tableimport.internal.reader.TextTableReader.ObjectType;
import org.cytoscape.tableimport.internal.ui.ImportTablePanel;
+import org.cytoscape.tableimport.internal.util.CytoscapeServices;
+import org.cytoscape.util.swing.FileUtil;
import org.cytoscape.work.Tunable;
import org.cytoscape.work.swing.AbstractGUITunableHandler;
@@ -27,6 +29,7 @@
private ImportTablePanel importTablePanel;
AttributeMappingParameters amp;
+ private final FileUtil fileUtil;
protected AttributeMappingParametersHandler(final Field field, final
Object obj, final Tunable t,
final int dialogType, final CyTableManager
tableManager) {
@@ -35,7 +38,7 @@
this.dialogType = dialogType;
this.tableManager = tableManager;
//importTablePanel = null;
-
+ this.fileUtil = CytoscapeServices.fileUtil;
init();
@@ -47,6 +50,7 @@
super(getter, setter, instance, tunable);
this.dialogType = dialogType;
this.tableManager = tableManager;
+ this.fileUtil = CytoscapeServices.fileUtil;
init();
@@ -69,7 +73,7 @@
importTablePanel =
new ImportTablePanel(dialogType, amp.is,
amp.fileType, null,null,
null, null,
- null, null, null,
tableManager);
+ null, null, null,
tableManager, fileUtil);
} catch (Exception e) {
throw new IllegalStateException("Could not initialize
ImportTablePanel.", e);
}
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/NetworkTableMappingParametersHandler.java
===================================================================
---
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/NetworkTableMappingParametersHandler.java
2012-08-07 17:04:19 UTC (rev 30109)
+++
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/tunable/NetworkTableMappingParametersHandler.java
2012-08-07 18:17:26 UTC (rev 30110)
@@ -19,6 +19,7 @@
import org.cytoscape.work.swing.AbstractGUITunableHandler;
import org.cytoscape.tableimport.internal.util.CytoscapeServices;
+import org.cytoscape.util.swing.FileUtil;
import org.osgi.service.event.Event;
import java.util.Map;
import java.util.HashMap;
@@ -30,13 +31,14 @@
private ImportTablePanel importTablePanel;
private NetworkTableMappingParameters ntmp;
+ private final FileUtil fileUtil;
protected NetworkTableMappingParametersHandler(Field field,Object
instance, Tunable tunable,
final int dialogType, final CyTableManager
tableManager) {
super(field, instance, tunable);
this.dialogType = dialogType;
this.tableManager = tableManager;
-
+ this.fileUtil = CytoscapeServices.fileUtil;
init();
}
@@ -46,7 +48,7 @@
super(getter, setter, instance, tunable);
this.dialogType = dialogType;
this.tableManager = tableManager;
-
+ this.fileUtil = CytoscapeServices.fileUtil;
init();
}
@@ -66,7 +68,7 @@
importTablePanel =
new ImportTablePanel(dialogType, ntmp.is,
ntmp.fileType, null,null,
null, null,
- null, null, null,
tableManager);
+ null, null, null,
tableManager, fileUtil);
final Map<String,String> props = new HashMap<String,String>();
props.put("action", "show import table dialog");
CytoscapeServices.eventAdmin.postEvent(new
Event("org/cytoscape/gettingstarted", props));
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/DataSourceSelectDialog.java
===================================================================
---
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/DataSourceSelectDialog.java
2012-08-07 17:04:19 UTC (rev 30109)
+++
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/DataSourceSelectDialog.java
2012-08-07 18:17:26 UTC (rev 30110)
@@ -1,4 +1,3 @@
-
/*
Copyright (c) 2006, 2007, The Cytoscape Consortium (www.cytoscape.org)
@@ -32,76 +31,50 @@
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.tableimport.internal.ui;
-//import cytoscape.util.CyFileFilter;
-//import cytoscape.util.FileUtil;
-
-import java.awt.Frame;
-
+import java.awt.Dialog;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
import java.io.File;
-
import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
import javax.swing.JDialog;
+import org.cytoscape.util.swing.FileChooserFilter;
+import org.cytoscape.util.swing.FileUtil;
-/*
- * OntologySourceSelectDialog.java
- *
- * Created on 2006/08/04, 17:32
- */
-
/**
*
- * @author kono
*/
public class DataSourceSelectDialog extends JDialog {
+
+ private static final long serialVersionUID = -2750086123978509461L;
+
private int sourceType;
private String sourceName;
private String sourceFileName;
private String sourceUrlString;
- /**
- *
- */
- public final static int ANNOTATION_TYPE = 1;
+ private final FileUtil fileUtil;
- /**
- *
- */
+ public final static int ANNOTATION_TYPE = 1;
public final static int ONTOLOGY_TYPE = 2;
- /** Creates new form OntologySourceSelectDialog */
- public DataSourceSelectDialog(Frame parent, boolean modal) {
- this(ANNOTATION_TYPE, parent, modal);
- }
-
- /**
- * Creates a new DataSourceSelectDialog object.
- *
- * @param sourceType DOCUMENT ME!
- * @param parent DOCUMENT ME!
- * @param modal DOCUMENT ME!
- */
- public DataSourceSelectDialog(int sourceType, Frame parent, boolean
modal) {
+ public DataSourceSelectDialog(int sourceType, Window parent,
Dialog.ModalityType modal, final FileUtil fileUtil) {
super(parent, modal);
this.sourceType = sourceType;
sourceName = null;
sourceUrlString = null;
sourceFileName = null;
+ this.fileUtil = fileUtil;
initComponents();
}
- /**
- * This method is called from within the constructor to initialize the
form.
- * WARNING: Do NOT modify this code. The content of this method is
always
- * regenerated by the Form Editor.
- */
-
- // <editor-fold defaultstate="collapsed" desc=" Generated Code">
private void initComponents() {
titleLabel = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
@@ -120,38 +93,38 @@
ontologyNameTextField.setToolTipText("Add data source from
local file system...");
ontologyNameTextField.addActionListener(new
java.awt.event.ActionListener() {
- public void
actionPerformed(java.awt.event.ActionEvent evt) {
-
ontologyNameTextFieldActionPerformed(evt);
- }
- });
+ public void actionPerformed(java.awt.event.ActionEvent
evt) {
+ ontologyNameTextFieldActionPerformed(evt);
+ }
+ });
dataSourceTextField.setText("http://");
dataSourceTextField.setToolTipText("http, ftp, and file are
supported.");
cancelButton.setText("Cancel");
cancelButton.addActionListener(new
java.awt.event.ActionListener() {
- public void
actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed(evt);
- }
- });
+ public void actionPerformed(java.awt.event.ActionEvent
evt) {
+ cancelButtonActionPerformed(evt);
+ }
+ });
addButton.setText("Add");
addButton.setMaximumSize(new java.awt.Dimension(75, 25));
addButton.setMinimumSize(new java.awt.Dimension(75, 25));
addButton.setPreferredSize(new java.awt.Dimension(75, 25));
addButton.addActionListener(new java.awt.event.ActionListener()
{
- public void
actionPerformed(java.awt.event.ActionEvent evt) {
- addButtonActionPerformed(evt);
- }
- });
+ public void actionPerformed(java.awt.event.ActionEvent
evt) {
+ addButtonActionPerformed(evt);
+ }
+ });
browseButton.setText("Browse Local Files");
browseButton.setToolTipText("Add data source from local file
system...");
browseButton.addActionListener(new
java.awt.event.ActionListener() {
- public void
actionPerformed(java.awt.event.ActionEvent evt) {
- browseButtonActionPerformed(evt);
- }
- });
+ public void actionPerformed(java.awt.event.ActionEvent
evt) {
+ browseButtonActionPerformed(evt);
+ }
+ });
nameLabel.setText("Data Source Name:");
@@ -159,74 +132,70 @@
org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
-
layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-
.add(layout.createSequentialGroup().addContainerGap()
-
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-
.add(jSeparator1,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
- 681,
Short.MAX_VALUE)
-
.add(titleLabel)
-
.add(org.jdesktop.layout.GroupLayout.TRAILING,
-
layout.createSequentialGroup()
-
.add(addButton,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-
.add(cancelButton)
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
-
.add(layout.createSequentialGroup()
-
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-
.add(sourceLabel)
-
.add(nameLabel))
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
-
.add(layout.createSequentialGroup()
-
.add(dataSourceTextField,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
378,
-
Short.MAX_VALUE)
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-
.add(browseButton,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
169,
-
Short.MAX_VALUE))
-
.add(ontologyNameTextField,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
553,
-
Short.MAX_VALUE))))
- .addContainerGap()));
-
layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
-
.add(layout.createSequentialGroup().addContainerGap()
-
.add(titleLabel).add(8, 8, 8)
- .add(jSeparator1,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
-
.add(nameLabel)
-
.add(ontologyNameTextField,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
-
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
-
.add(sourceLabel)
-
.add(dataSourceTextField,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
-
.add(browseButton))
-
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
Short.MAX_VALUE)
-
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
-
.add(addButton,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
-
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
-
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
-
.add(cancelButton)).addContainerGap()));
+
layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
+ layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout
+
.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 681,
Short.MAX_VALUE)
+ .add(titleLabel)
+
.add(org.jdesktop.layout.GroupLayout.TRAILING,
+
layout.createSequentialGroup()
+
.add(addButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+
.add(cancelButton)
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
+ .add(layout
+
.createSequentialGroup()
+
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+
.add(sourceLabel).add(nameLabel))
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+
.add(layout
+
.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
+
.add(layout
+
.createSequentialGroup()
+
.add(dataSourceTextField,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 378,
+
Short.MAX_VALUE)
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+
.add(browseButton,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 169,
+
Short.MAX_VALUE))
+
.add(ontologyNameTextField,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
553,
+
Short.MAX_VALUE)))).addContainerGap()));
+
layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(
+ layout.createSequentialGroup()
+ .addContainerGap()
+ .add(titleLabel)
+ .add(8, 8, 8)
+ .add(jSeparator1,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout
+
.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(nameLabel)
+
.add(ontologyNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout
+
.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+
.add(sourceLabel)
+
.add(dataSourceTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(browseButton))
+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .add(layout
+
.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(addButton,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
+
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
+
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(cancelButton))
+ .addContainerGap()));
pack();
} // </editor-fold>
@@ -248,28 +217,26 @@
setVisible(false);
}
- private void browseButtonActionPerformed(java.awt.event.ActionEvent
evt) {
-
- //CyFileFilter oboFilter = new CyFileFilter();
+ private void browseButtonActionPerformed(ActionEvent evt) {
+
File file = null;
- //if (sourceType == ONTOLOGY_TYPE) {
- // oboFilter.addExtension("obo");
- // oboFilter.setDescription("Ontology files in OBO
format");
- // file = FileUtil.getFile("Select local OBO file",
FileUtil.LOAD,
- // new CyFileFilter[] { oboFilter
});
- //} else {
- // file = FileUtil.getFile("Select local annotation file",
FileUtil.LOAD,
- // new CyFileFilter[] { });
- //}
+ if (sourceType == ONTOLOGY_TYPE) {
+ final FileChooserFilter filter = new
FileChooserFilter("OBO File", "obo");
+ List<FileChooserFilter> filterCollection = new
ArrayList<FileChooserFilter>(1);
+ filterCollection.add(filter);
+ file = fileUtil.getFile(this.getParent(), "Select OBO
Source File", FileUtil.LOAD, filterCollection);
- /*
- * Do nothing if the file is null.
- */
- if (file == null) {
- return;
+ } else {
+ // Currently, there is no pre-defined extension for
this file type.
+ final List<FileChooserFilter> filterCollection = new
ArrayList<FileChooserFilter>();
+ file = fileUtil.getFile(this.getParent(), "Select Gene
Annotation Source File", FileUtil.LOAD,
+ filterCollection);
}
+ if (file == null)
+ return;
+
sourceFileName = file.getName();
if (sourceType == ONTOLOGY_TYPE) {
@@ -283,6 +250,8 @@
} catch (MalformedURLException e) {
e.printStackTrace();
}
+
+ this.toFront();
}
private void
ontologyNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {
@@ -290,27 +259,27 @@
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
*/
public String getSourceUrlString() {
return sourceUrlString;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
*/
public String getSourceName() {
return sourceName;
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
*/
public String getSourceFileName() {
return sourceFileName;
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
===================================================================
---
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
2012-08-07 17:04:19 UTC (rev 30109)
+++
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
2012-08-07 18:17:26 UTC (rev 30110)
@@ -128,6 +128,7 @@
import org.cytoscape.tableimport.internal.util.CytoscapeServices;
import org.cytoscape.tableimport.internal.util.URLUtil;
import org.cytoscape.util.swing.ColumnResizer;
+import org.cytoscape.util.swing.FileUtil;
import org.cytoscape.util.swing.JStatusBar;
import org.cytoscape.work.Task;
import org.cytoscape.work.TaskManager;
@@ -235,16 +236,17 @@
private final CyTableManager tableManager;
private final EventAdmin eventAdmin;
private File tempFile;
+ private final FileUtil fileUtil;
public ImportTablePanel(final int dialogType, final InputStream is,
final String fileType,
final String inputName, final
CyProperty<Bookmarks> bookmarksProp,
final BookmarksUtil bkUtil, final TaskManager
taskManager,
final InputStreamTaskFactory factory, final
CyNetworkManager manager,
- final CyTableFactory tableFactory, final
CyTableManager tableManager)
+ final CyTableFactory tableFactory, final
CyTableManager tableManager, final FileUtil fileUtil)
throws JAXBException, IOException
{
this(dialogType, is, fileType, bookmarksProp, bkUtil,
taskManager, factory, manager,
- tableFactory, tableManager);
+ tableFactory, tableManager, fileUtil);
this.inputName = inputName;
}
@@ -252,7 +254,7 @@
final CyProperty<Bookmarks> bookmarksProp,
final BookmarksUtil bkUtil, final TaskManager
taskManager,
final InputStreamTaskFactory factory, final
CyNetworkManager manager,
- final CyTableFactory tableFactory, final
CyTableManager tableManager)
+ final CyTableFactory tableFactory, final
CyTableManager tableManager, final FileUtil fileUtil)
throws JAXBException, IOException
{
this.bookmarksProp = null;
@@ -263,6 +265,7 @@
this.tableFactory = tableFactory;
this.tableManager = tableManager;
this.eventAdmin = CytoscapeServices.eventAdmin;
+ this.fileUtil = fileUtil;
if (dialogType != ONTOLOGY_AND_ANNOTATION_IMPORT) {
@@ -687,7 +690,7 @@
if (dialogType == ONTOLOGY_AND_ANNOTATION_IMPORT) {
panelBuilder = new OntologyPanelBuilder(this,
bookmarksProp, bkUtil,
taskManager,
factory, manager,
- tableFactory,
tableManager);
+ tableFactory,
tableManager, fileUtil);
panelBuilder.buildPanel();
}
@@ -2405,10 +2408,7 @@
* @return true if table looks OK.
*/
private boolean checkDataSourceError() {
- /*
- * Number of ENABLED columns should be 2 or more.
- *
- */
+
final JTable table = previewPanel.getPreviewTable();
if ((table == null) || (table.getModel() == null) ||
(table.getColumnCount() == 0)) {
Modified:
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/OntologyPanelBuilder.java
===================================================================
---
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/OntologyPanelBuilder.java
2012-08-07 17:04:19 UTC (rev 30109)
+++
core3/impl/trunk/table-import-impl/src/main/java/org/cytoscape/tableimport/internal/ui/OntologyPanelBuilder.java
2012-08-07 18:17:26 UTC (rev 30110)
@@ -12,6 +12,7 @@
import java.awt.Color;
import java.awt.Component;
+import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.io.IOException;
@@ -39,6 +40,7 @@
import org.cytoscape.tableimport.internal.reader.TextTableReader;
import
org.cytoscape.tableimport.internal.task.ImportOntologyAndAnnotationTaskFactory;
import org.cytoscape.tableimport.internal.util.CytoscapeServices;
+import org.cytoscape.util.swing.FileUtil;
import org.cytoscape.work.TaskManager;
import org.jdesktop.layout.GroupLayout;
@@ -76,11 +78,13 @@
private final CyNetworkManager manager;
private final CyTableFactory tableFactory;
private final CyTableManager tableManager;
+
+ private final FileUtil fileUtil;
OntologyPanelBuilder(final ImportTablePanel panel, final
CyProperty<Bookmarks> bookmarksProp,
final BookmarksUtil bkUtil, final TaskManager
taskManager,
final InputStreamTaskFactory factory, final
CyNetworkManager manager,
- final CyTableFactory tableFactory, final
CyTableManager tableManager)
+ final CyTableFactory tableFactory, final
CyTableManager tableManager, final FileUtil fileUtil)
{
this.panel = panel;
this.bookmarksProp = bookmarksProp;
@@ -90,6 +94,7 @@
this.manager = manager;
this.tableFactory = tableFactory;
this.tableManager = tableManager;
+ this.fileUtil = fileUtil;
}
protected void buildPanel() {
@@ -327,7 +332,7 @@
private void
browseAnnotationButtonActionPerformed(java.awt.event.ActionEvent evt) {
DataSourceSelectDialog dssd = new
DataSourceSelectDialog(DataSourceSelectDialog.ANNOTATION_TYPE,
-
CytoscapeServices.cySwingApplication.getJFrame(), true);
+
CytoscapeServices.cySwingApplication.getJFrame(),
Dialog.ModalityType.APPLICATION_MODAL, fileUtil);
dssd.setLocationRelativeTo(CytoscapeServices.cySwingApplication.getJFrame());
dssd.setVisible(true);
@@ -343,7 +348,7 @@
private void
browseOntologyButtonActionPerformed(java.awt.event.ActionEvent evt) {
DataSourceSelectDialog dssd = new
DataSourceSelectDialog(DataSourceSelectDialog.ONTOLOGY_TYPE,
-
CytoscapeServices.cySwingApplication.getJFrame(), true);
+
CytoscapeServices.cySwingApplication.getJFrame(),
Dialog.ModalityType.APPLICATION_MODAL, fileUtil);
dssd.setLocationRelativeTo(CytoscapeServices.cySwingApplication.getJFrame());
dssd.setVisible(true);
--
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.