public class ToolTableImpl extends java.lang.Object implements ToolTable, ToolListener
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector<ToolListener> |
listeners
An array list of tool listeners
|
static java.lang.String |
USER_TOOLBOX |
Constructor and Description |
---|
ToolTableImpl(ToolResolver resolver) |
Modifier and Type | Method and Description |
---|---|
void |
addToolBox(Toolbox... boxes)
Add a tool box path to the current tool boxes
|
void |
addToolTableListener(ToolListener listener)
Add a listener to be notified when new tools are discovered
|
void |
deleteTool(Tool tool,
boolean files)
Deletes the specified tool.
|
java.lang.String |
findToolBox(java.net.URL location)
Attempts to find a toolbox that contains the specified location
|
java.lang.String |
getPasteFileLocation(java.lang.String toolname,
java.lang.String pack,
java.lang.String toolbox)
Generate a new file location to store a pasted tool
|
TrianaProperties |
getProperties() |
Tool |
getTool(java.lang.String toolName)
A method to lookup the tool with the given the tool name.
|
Toolbox[] |
getToolBoxes() |
Toolbox[] |
getToolBoxes(java.lang.String type) |
java.lang.String[] |
getToolBoxPaths() |
java.lang.String |
getToolBoxType(java.lang.String toolbox) |
java.lang.String[] |
getToolNames()
returns an array of strings of qualified tool names.
|
ToolResolver |
getToolResolver()
Gets the tool resolver for this tool table -- added by Ian T to fix the static loading of tool resolvers.
|
Tool[] |
getTools()
get all tools
|
Tool[] |
getTools(java.net.URL definitionPath)
get the list of tools that share the same definition path.
|
void |
insertTool(Tool tool,
java.lang.String pack,
java.lang.String toolbox)
Inserts a copy of the tool into the specified package.
|
boolean |
isModifiable(Tool tool)
return true if this tool can be modified.
|
boolean |
isTool(java.lang.String toolName) |
protected void |
notifyToolAdded(Tool tool)
Notifies the tool listeners when a tool is added
|
protected void |
notifyToolboxAdded(Toolbox toolbox)
Notifies a listener when tool box is added
|
protected void |
notifyToolboxRemoved(Toolbox toolbox)
Notifies a listener when tool box is removed
|
protected void |
notifyToolboxRenamed(Toolbox toolbox,
java.lang.String name) |
protected void |
notifyToolboxRenaming(Toolbox toolbox,
java.lang.String name) |
protected void |
notifyToolRemoved(Tool tool)
Notifies the tool listeners when a tool is removed
|
protected void |
notifyToolsAdded(java.util.List<Tool> tool)
Notifies the tool listeners when a tool is added
|
protected void |
notifyToolsRemoved(java.util.List<Tool> tool)
Notifies the tool listeners when a tool is removed
|
protected void |
purgeTool(Tool tool)
Removes the tool
|
protected void |
purgeToolRef(Tool tool)
Removes references to the tool
|
void |
refreshLocation(java.net.URL location,
java.lang.String toolbox)
Notifies the tool table to update the tool loaded from the specified location, such as when a tool is created.
|
boolean |
removeToolBox(java.lang.String path)
Removes a tool box from the current tool boxes and from the tool box types if it has a type set.
|
void |
removeToolTableListener(ToolListener listener)
Removes a tool listener
|
void |
toolAdded(Tool tool)
Called when a new tool is added
|
void |
toolBoxAdded(Toolbox toolbox)
Called when a Tool Box is added
|
void |
toolboxNameChanged(Toolbox toolbox,
java.lang.String newName) |
void |
toolboxNameChanging(Toolbox toolbox,
java.lang.String newName) |
void |
toolBoxRemoved(Toolbox toolbox)
Called when a Tool Box is Removed
|
void |
toolRemoved(Tool tool)
Called when a tool is removed
|
void |
toolsAdded(java.util.List<Tool> tools) |
void |
toolsRemoved(java.util.List<Tool> tools) |
public static final java.lang.String USER_TOOLBOX
protected java.util.Vector<ToolListener> listeners
public ToolTableImpl(ToolResolver resolver)
public TrianaProperties getProperties()
getProperties
in interface ToolTable
public void addToolTableListener(ToolListener listener)
addToolTableListener
in interface ToolTable
public void removeToolTableListener(ToolListener listener)
removeToolTableListener
in interface ToolTable
public ToolResolver getToolResolver()
ToolTable
getToolResolver
in interface ToolTable
public Tool getTool(java.lang.String toolName)
public Tool[] getTools(java.net.URL definitionPath)
ToolTable
public boolean isTool(java.lang.String toolName)
public java.lang.String[] getToolNames()
getToolNames
in interface ToolTable
public void refreshLocation(java.net.URL location, java.lang.String toolbox)
ToolTable
refreshLocation
in interface ToolTable
location
- the location of the filetoolbox
- the toolbox the location is in (specify null if unknown)public void insertTool(Tool tool, java.lang.String pack, java.lang.String toolbox)
insertTool
in interface ToolTable
tool
- the tool being pastedpack
- the package of the pasted tooltoolbox
- the toolbox the tool is pasted into (ignore if irrelevant)public void deleteTool(Tool tool, boolean files)
deleteTool
in interface ToolTable
tool
- tool to be deletedpublic boolean isModifiable(Tool tool)
ToolTable
isModifiable
in interface ToolTable
public java.lang.String getPasteFileLocation(java.lang.String toolname, java.lang.String pack, java.lang.String toolbox)
getPasteFileLocation
in interface ToolTable
toolname
- tool to be createdpack
- tool package nametoolbox
- toolbox to create the tool inprotected void notifyToolsAdded(java.util.List<Tool> tool)
tool
- the tool added to the ToolTableprotected void notifyToolsRemoved(java.util.List<Tool> tool)
tool
- the Tool removed from the ToolTableprotected void notifyToolAdded(Tool tool)
tool
- the tool added to the ToolTableprotected void notifyToolRemoved(Tool tool)
tool
- the Tool removed from the ToolTableprotected void notifyToolboxAdded(Toolbox toolbox)
toolbox
- the toolbox added to the ToolTableprotected void notifyToolboxRemoved(Toolbox toolbox)
toolbox
- the toolbox removed from the ToolTableprotected void notifyToolboxRenamed(Toolbox toolbox, java.lang.String name)
protected void notifyToolboxRenaming(Toolbox toolbox, java.lang.String name)
public Toolbox[] getToolBoxes()
getToolBoxes
in interface ToolTable
public java.lang.String[] getToolBoxPaths()
getToolBoxPaths
in interface ToolTable
public Toolbox[] getToolBoxes(java.lang.String type)
getToolBoxes
in interface ToolTable
public java.lang.String getToolBoxType(java.lang.String toolbox)
getToolBoxType
in interface ToolTable
public void addToolBox(Toolbox... boxes)
addToolBox
in interface ToolTable
public boolean removeToolBox(java.lang.String path)
removeToolBox
in interface ToolTable
path
- the path of the tool box to removepublic java.lang.String findToolBox(java.net.URL location)
location
- the location being searched for in existing toolboxesprotected void purgeTool(Tool tool)
tool
- the Tool.protected void purgeToolRef(Tool tool)
tool
- the Tool.public void toolsAdded(java.util.List<Tool> tools)
toolsAdded
in interface ToolListener
public void toolsRemoved(java.util.List<Tool> tools)
toolsRemoved
in interface ToolListener
public void toolAdded(Tool tool)
ToolListener
toolAdded
in interface ToolListener
public void toolRemoved(Tool tool)
ToolListener
toolRemoved
in interface ToolListener
public void toolBoxAdded(Toolbox toolbox)
ToolListener
toolBoxAdded
in interface ToolListener
public void toolBoxRemoved(Toolbox toolbox)
ToolListener
toolBoxRemoved
in interface ToolListener
public void toolboxNameChanging(Toolbox toolbox, java.lang.String newName)
toolboxNameChanging
in interface ToolListener
public void toolboxNameChanged(Toolbox toolbox, java.lang.String newName)
toolboxNameChanged
in interface ToolListener