Class StandardPirolPlugIn

java.lang.Object
com.vividsolutions.jump.workbench.plugin.AbstractPlugIn
de.fho.jump.pirol.utilities.plugIns.StandardPirolPlugIn
All Implemented Interfaces:
EnableChecked, Iconified, PlugIn, Recordable, ShortcutEnabled, ErrorHandler

public abstract class StandardPirolPlugIn extends AbstractPlugIn implements ErrorHandler
Overrides most of the abstract methods of the AbstractPlugIn to implement a default behavior, that fits the needs for a plugIn in the PIROL context. Also implements the ErrorHandler interface and offers methods to post error messages to the GUI.
Version:
$Rev$
Author:
Ole Rahn, Stefan Ostermann

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement
  • Field Details

    • messages

      protected StringBuffer messages
      buffer for messages of errors that occured during execution - needed to implement the ErrorHandler interface
    • bringUpMessages

      protected boolean bringUpMessages
      Are errors to be shown in the statusbar (bringUpMessages = false, DEFAULT) or in an output window (bringUpMessages = true)?
    • checkFactory

      protected static EnableCheckFactory checkFactory
    • icon

      protected ImageIcon icon
      see description for method getIconString() for more information
    • useToolIconSize

      protected boolean useToolIconSize
    • geometryFactory

      protected static org.locationtech.jts.geom.GeometryFactory geometryFactory
    • logger

      protected PersonalLogger logger
      logger reference for use with the StandardPirolPlugIn. Since loggers are personalized, this member has to be initialized in derived classes by the programmer, before it can be used. For downward compatibility no abstract method or constructur parameter was introduced to do this.
      Since:
      rev.1.12
  • Constructor Details

    • StandardPirolPlugIn

      public StandardPirolPlugIn(PersonalLogger logger)
      Please, use this constructor in the deriving class!
      Parameters:
      logger - the logger that will controll console outputs
      Since:
      rev.1.17
  • Method Details

    • getShortClassName

      public String getShortClassName()
    • createEnableCheck

      public static MultiEnableCheck createEnableCheck(WorkbenchContext workbenchContext, boolean needFence)
    • getIconString

      public abstract String getIconString()
      Method to enable loading an icon from the surrounding jar-file if necessary. If the plugin doesn't need an icon, just return null else return the file name, e.g. "xyz.png" and put the picture in the same folder (package) as the deriving class.
      Returns:
      the filename of the icon or null if the plugin has no icon.
    • execute

      public abstract boolean execute(PlugInContext context) throws Exception
      This method is called to execute the PlugIn.
      Specified by:
      execute in interface PlugIn
      Overrides:
      execute in class AbstractPlugIn
      Parameters:
      context - the snapshot of the current workbench.
      Returns:
      always true ?
      Throws:
      Exception - if an Exception occurs
      See Also:
    • getName

      public String getName()
      Name of the PlugIn to be shown in the menus or as a tooltip in JUMP.
      Looks for a key (the PlugIn's name with no path) in the i18n resources, if none is found the standard jump name generation will be used.
      Specified by:
      getName in interface PlugIn
      Overrides:
      getName in class AbstractPlugIn
      Returns:
      the class name, minus "PlugIn", with spaces inserted at the appropriate point before each uppercase+lowercase and lowercase+uppercase combination.
    • initialize

      public void initialize(PlugInContext context) throws Exception
      The PlugIn will be added to the PIROL Tools/[return value of getCategoryName()] menu and a standard EnableCheck is applied.
      Specified by:
      initialize in interface PlugIn
      Overrides:
      initialize in class AbstractPlugIn
      Parameters:
      context - PlugInContext
      Throws:
      Exception - if an Exception occurs
      See Also:
    • getCategoryName

      public String getCategoryName()
      The name of the category, a PlugIn can be found in - this method should be overridden by any derived class!
      Returns:
      name of the category, a PlugIn can be found in
    • initialize

      public void initialize(PlugInContext context, String subMenuName) throws Exception
      Deprecated.
      Standard intialization: PlugIn is added to the PIROL Tools/subMenuName (or localized menu name) menu and a standard EnableCheck is applied.
      Throws:
      Exception
    • getMonitor

      public static TaskMonitorDialog getMonitor(PlugInContext context)
      Parameters:
      context - the current PlugIn context
      Returns:
      a TaskMonitorDialog, to show progress information to the user
    • println

      protected void println(String function, String msg)
      Deprecated.
      use logger instead!
      Prints output to the stdout. Can be invoked by deriving classes.
      Parameters:
      function - the name of the method from within this one is called. E.g. "myMethod()".
      msg - the message String.
      See Also:
    • println

      public static void println(Class c, String function, String message)
      Deprecated.
      use logger instead!
      Writes the given message and function string to the stdout. The output will be formated as "classname.function: message".
      Parameters:
      c - the calling class
      function - the method from within this one is called.
      message - the text with some useful information.
    • warnUser

      public static void warnUser(PlugInContext context, String msg)
      Puts a warning message into the statusbar of JUMP
      Parameters:
      context - curr. PlugInContext
      msg - message to be shown to the user
    • getSelectedLayers

      public static Layer[] getSelectedLayers(PlugInContext context, int num)
      Get a given number of selected Layers.
      Parameters:
      context - the current PlugInContext
      num - max. number of layers to return, -1 returns all selected layers
      Returns:
      a given number of selected Layers, null if no Layers are selected
    • getSelectedLayer

      public static Layer getSelectedLayer(PlugInContext context)
      get one Layer that is selected
      Parameters:
      context - the current PlugInContext
      Returns:
      one selected Layer, null if no Layers are selected
    • finishExecution

      protected boolean finishExecution(PlugInContext context, boolean retVal)
      To be called, when leaving the execute()-method. Puts out the error messages collected during execution if any and returns the given boolean value. Example:
      return finishExecution(context, true);
      Parameters:
      context - the current PlugInContext
      retVal - the value to be returned by execute()
      Returns:
      retVal
    • postMessagesToGui

      protected void postMessagesToGui(PlugInContext context)
    • handleThrowable

      public void handleThrowable(Throwable t)
      Description copied from interface: ErrorHandler
      Note that this method may or may not be called from the AWT event-dispatch thread.
      Specified by:
      handleThrowable in interface ErrorHandler
    • getIcon

      public Icon getIcon()
      Method to load an icon from the surrounding jar-file if necessary.
      Specified by:
      getIcon in interface Iconified
      Overrides:
      getIcon in class AbstractPlugIn
      Returns:
      the icon or null if the getIconString() returned null (or problems occured)
    • getFeaturesInFenceOrInLayer

      public static Feature[] getFeaturesInFenceOrInLayer(PlugInContext context, Layer layer)
      Get a List of Features (from the given Layer) that reside within the fence (if there is a fence) or just the features of the layer (if there is currently no fence)
      Parameters:
      context - the plugIn context
      layer - the layer holding the features
      Returns:
      List of features within fence if present or just within the layer
    • getLogger

      public PersonalLogger getLogger()
      Returns:
      the personal logger
      See Also:
    • setLogger

      public void setLogger(PersonalLogger logger)
      Sets the personal logger - enables debug statement handling
      Parameters:
      logger - the new personal logger
      See Also:
    • setUseInToolbox

      public void setUseInToolbox(boolean toolboxUse)