com.levigo.jadice.appbase
Class FileOpener

java.lang.Object
  extended by java.awt.dnd.DropTargetAdapter
      extended by com.levigo.jadice.appbase.FileOpener
All Implemented Interfaces:
DropTargetListener, EventListener

public class FileOpener
extends DropTargetAdapter

Support file based opening operations for the viewer.


Nested Class Summary
static class FileOpener.FileOpenerReadConfiguration
          A ReadConfiguration which loads a single local File.
protected  class FileOpener.SimpleReadStrategy
           
 
Field Summary
protected  PageView view
           
 
Constructor Summary
FileOpener(PageView forView)
          FileOpener Constructor
 
Method Summary
protected  ReadConfiguration createReadConfiguration(File file)
          Create a ReadConfigurer for the provided File.
 void dragEnter(DropTargetDragEvent dtde)
           
 void dragOver(DropTargetDragEvent dtde)
           
 void drop(DropTargetDropEvent dtde)
           This method will be called when a drag operation has terminated with a drop on a component which DropTarget is registered with a FileOpener instance as DropTargetListener.
 void openDocumentFromFile()
          Produces a FileDialog and calls openDocumentFromFile(File).
 void openDocumentFromFile(File fSelected)
          Loads a file specified by the parameter supplied.
 void openDocumentFromFile(String fullName)
          Loads a file specified by its name.
 
Methods inherited from class java.awt.dnd.DropTargetAdapter
dragExit, dropActionChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected PageView view
Constructor Detail

FileOpener

public FileOpener(PageView forView)
FileOpener Constructor

Parameters:
forView - the viewer into which the documents shall be loaded
Method Detail

createReadConfiguration

protected ReadConfiguration createReadConfiguration(File file)
Create a ReadConfigurer for the provided File. This method may be overridden to integrate custom loading logic which may respect loading of Annotations and other things of interest.

The FileOpener will only use one Document generated from the ReadConfigurer. If multiple documents are generated within the ReadConfigurer all but the first will be ignored.


openDocumentFromFile

public void openDocumentFromFile()
Produces a FileDialog and calls openDocumentFromFile(File).


openDocumentFromFile

public void openDocumentFromFile(File fSelected)
Loads a file specified by the parameter supplied.

Parameters:
fSelected - file to load

openDocumentFromFile

public void openDocumentFromFile(String fullName)
Loads a file specified by its name.

Parameters:
fullName - full file name

drop

public void drop(DropTargetDropEvent dtde)

This method will be called when a drag operation has terminated with a drop on a component which DropTarget is registered with a FileOpener instance as DropTargetListener. Within this method the transferable object will be used to load and display a dropped file into the associated viewer.

As DataFlavor only DataFlavor.javaFileListFlavor will be accepted.

Integrator hint: To enable file dropping from GNOME / KDE desktop, you have to implement a Transferable that accepts the text/uri-list format. For further details see Oracle Bug Database, ID 4899516.

See Also:
DropTargetListener.drop(java.awt.dnd.DropTargetDropEvent)

dragOver

public void dragOver(DropTargetDragEvent dtde)
Specified by:
dragOver in interface DropTargetListener
Overrides:
dragOver in class DropTargetAdapter

dragEnter

public void dragEnter(DropTargetDragEvent dtde)
Specified by:
dragEnter in interface DropTargetListener
Overrides:
dragEnter in class DropTargetAdapter


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.