Protege 3.4

edu.stanford.smi.protege.action
Class ExportToCsvAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by edu.stanford.smi.protege.util.StandardAction
          extended by edu.stanford.smi.protege.action.ExportToCsvAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public class ExportToCsvAction
extends StandardAction

This action class allows the export of an instance list to a CSV file.

Delimiters between different slots and slots values can be configured (see setSlotsDelimiter(String) and setSlotValuesDelimiter(String)). Slots to be exported for each instance can be configured (see setSlotsToExport(Collection).

It works both with an UI and without. To use it without a UI, call the setter methods to configure the export action and then call export().

Author:
Tania Tudorache
See Also:
Serialized Form

Field Summary
static Operation EXPORT_TO_CSV_OPERATION
           
 
Fields inherited from class edu.stanford.smi.protege.util.StandardAction
DISABLED_ICON
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
  ExportToCsvAction(KnowledgeBase kb)
           
protected ExportToCsvAction(KnowledgeBase kb, String name, Icon icon)
           
 
Method Summary
 void actionPerformed(ActionEvent arg0)
           
 boolean export()
           
 File getExportFile()
           
 String getExportMetadata()
           
protected  String getExportName(Frame frame)
           
 Collection<Instance> getInstancesToExport()
           
protected  String getQuotedValule(String value)
           
 String getSlotsDelimiter()
           
 Collection<Slot> getSlotsToExport()
           
 String getSlotValuesDelimiter()
           
protected  String getSlotValuesExportString(Instance instance, Slot slot)
           
 boolean isExportBrowserTextEnabled()
           
 boolean isExportHeader()
           
 boolean isExportMetadata()
           
 boolean isExportTypes()
           
protected  void printHeader(PrintWriter writer, Collection<Slot> slots)
           
protected  void printInstance(PrintWriter writer, Instance instance)
           
protected  void printResults(Writer writer, Collection<Instance> instances, Collection<Slot> slots)
           
 void setExportBrowserText(boolean exportBrowserText)
           
 void setExportFile(File exportFile)
           
 void setExportHeader(boolean exportHeader)
           
 void setExportMetadata(boolean exportMetadata)
           
 void setExportMetadata(String metadata)
           
 void setExportTypes(boolean exportTypes)
           
 void setFramesWithBrowserTextToExport(Collection<FrameWithBrowserText> frames)
           
 void setInstancesToExport(Collection<Instance> instancesToExport)
           
 void setSlotsDelimiter(String slotsDelimiter)
           
 void setSlotsToExport(Collection<Slot> slotsToExport)
           
 void setSlotValuesDelimiter(String slotValuesDelimiter)
           
 
Methods inherited from class edu.stanford.smi.protege.util.StandardAction
equals, getIcon, getName, getName, initialize, setDescription, setDescription, setDisabledIcon, setDisabledIcon, setIcon, setIcon, setMnemonic, setMnemonic, setName, setName, setShortcut, setShortcut, substituteIntoName
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXPORT_TO_CSV_OPERATION

public static final Operation EXPORT_TO_CSV_OPERATION
Constructor Detail

ExportToCsvAction

public ExportToCsvAction(KnowledgeBase kb)

ExportToCsvAction

protected ExportToCsvAction(KnowledgeBase kb,
                            String name,
                            Icon icon)
Method Detail

actionPerformed

public void actionPerformed(ActionEvent arg0)

export

public boolean export()

printResults

protected void printResults(Writer writer,
                            Collection<Instance> instances,
                            Collection<Slot> slots)

printHeader

protected void printHeader(PrintWriter writer,
                           Collection<Slot> slots)

printInstance

protected void printInstance(PrintWriter writer,
                             Instance instance)

getSlotValuesExportString

protected String getSlotValuesExportString(Instance instance,
                                           Slot slot)

getQuotedValule

protected String getQuotedValule(String value)

getExportName

protected String getExportName(Frame frame)

getInstancesToExport

public Collection<Instance> getInstancesToExport()

setInstancesToExport

public void setInstancesToExport(Collection<Instance> instancesToExport)

setFramesWithBrowserTextToExport

public void setFramesWithBrowserTextToExport(Collection<FrameWithBrowserText> frames)

getExportFile

public File getExportFile()

setExportFile

public void setExportFile(File exportFile)

getSlotsToExport

public Collection<Slot> getSlotsToExport()

setSlotsToExport

public void setSlotsToExport(Collection<Slot> slotsToExport)

setExportMetadata

public void setExportMetadata(String metadata)

getExportMetadata

public String getExportMetadata()

isExportHeader

public boolean isExportHeader()

setExportHeader

public void setExportHeader(boolean exportHeader)

isExportTypes

public boolean isExportTypes()

setExportTypes

public void setExportTypes(boolean exportTypes)

isExportMetadata

public boolean isExportMetadata()

setExportMetadata

public void setExportMetadata(boolean exportMetadata)

getSlotValuesDelimiter

public String getSlotValuesDelimiter()

setSlotValuesDelimiter

public void setSlotValuesDelimiter(String slotValuesDelimiter)

getSlotsDelimiter

public String getSlotsDelimiter()

setSlotsDelimiter

public void setSlotsDelimiter(String slotsDelimiter)

isExportBrowserTextEnabled

public boolean isExportBrowserTextEnabled()

setExportBrowserText

public void setExportBrowserText(boolean exportBrowserText)

Protege 3.4

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2009 Stanford University.