de.saar.chorus.ubench.gui
Class Ubench

Object
  extended by Ubench

public class Ubench
extends Object

The main class of Ubench. This implements the "singleton pattern", so this class provides one (and only one) instance of Ubench.

Author:
Alexander Koller, Michaela Regneri

Field Summary
 boolean reduceAutomatically
           
 
Method Summary
 JDomGraphTab addNewTab(JDomGraph graph, String label, DomGraph origin, boolean paintNow, boolean showNow, int index, NodeLabels labels)
          Adding a new tab to the window displaying the given JDomGraph, given the index indicating where to insert it in the tab.
 JDomGraphTab addNewTab(JDomGraph graph, String label, DomGraph origin, boolean paintNow, boolean showNow, NodeLabels labels)
          Adding a new tab to the window displaying the given JDomGraph
 boolean addNewTab(String label, DomGraph graph, NodeLabels labels)
          Allowes to set up a new Tab by submitting the DomGraph to display and a NodeLabels object along with the graph's name.
 void addTab(JGraphTab tab, boolean showNow)
          Adding a complete tab to the window
 void addTab(JGraphTab tab, boolean showNow, int ind)
          Adding a complete tab to the window
 void closeAllTabs()
          Closing all tabs.
 void closeCurrentTab()
          Closes the currently shown tab (if there is one).
 JDomGraph genericLoadGraph(Reader reader, String codec, DomGraph graph, NodeLabels nl, Map<String,String> options)
          Loads a labelled dominance graph from a reader.
 JDomGraph genericLoadGraph(String filename, DomGraph graph, NodeLabels nl, Map<String,String> options)
          Loads a labelled dominance graph from a file.
 CodecManager getCodecManager()
           
 String getEqsname()
           
 EquationSystem getEquationSystem()
           
 ExampleManager getExampleManager()
           
static Ubench getInstance()
          Returns the (only) instance of the Ubench class.
 File getLastPath()
           
 CommandListener getListener()
           
 double getTabHeight()
          Returning the tab height (considering the possible minimization of the window).
 double getTabWidth()
          Returning the tab width (considering the possible minimization of the window).
 JGraphTab getVisibleTab()
           
 int getVisibleTabIndex()
           
 JFrame getWindow()
           
 boolean isEquationSystemLoaded()
           
static void main(String[] args)
          Starting Ubench, optionally with files to open on command line
 void quit()
          Closing Ubench.
 void refresh()
          Refreshes the menu, the slider and the status bar.
 void resetSlider()
          Aligning the slider with the currently shown graph.
 void setEquationSystem(EquationSystem eqs, String name)
           
 void setLastPath(File lastPath)
           
 void setListener(CommandListener listener)
           
 void setPreferenceDialogVisible(boolean visible)
           
 void setSolvingEnabled(boolean b)
          (De-)Activates the menu-items only available for solvable dominance graphs (as opposed to unsolvable graphs and solved forms).
 void showProgressBar()
          Showing the bar for the solving process.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reduceAutomatically

public boolean reduceAutomatically
Method Detail

resetSlider

public void resetSlider()
Aligning the slider with the currently shown graph. (if there is one).


setPreferenceDialogVisible

public void setPreferenceDialogVisible(boolean visible)

showProgressBar

public void showProgressBar()
Showing the bar for the solving process.


getWindow

public JFrame getWindow()
Returns:
the main window itself

closeAllTabs

public void closeAllTabs()
Closing all tabs.


quit

public void quit()
Closing Ubench.


getTabHeight

public double getTabHeight()
Returning the tab height (considering the possible minimization of the window).

Returns:
the height

getTabWidth

public double getTabWidth()
Returning the tab width (considering the possible minimization of the window).

Returns:
the width

refresh

public void refresh()
Refreshes the menu, the slider and the status bar.


closeCurrentTab

public void closeCurrentTab()
Closes the currently shown tab (if there is one).


getVisibleTab

public JGraphTab getVisibleTab()
Returns:
the currently shown tab or null if there is none

getVisibleTabIndex

public int getVisibleTabIndex()
Returns:
the index of the currently shown tab

addTab

public void addTab(JGraphTab tab,
                   boolean showNow)
Adding a complete tab to the window

Parameters:
tab - the tab to ad
showNow - if set to true, the tab will be displayed at once

addTab

public void addTab(JGraphTab tab,
                   boolean showNow,
                   int ind)
Adding a complete tab to the window

Parameters:
tab - the tab to ad
showNow - if set to true, the tab will be displayed at once

setSolvingEnabled

public void setSolvingEnabled(boolean b)
(De-)Activates the menu-items only available for solvable dominance graphs (as opposed to unsolvable graphs and solved forms).

Parameters:
b - if false, solving becomes disabled.

addNewTab

public JDomGraphTab addNewTab(JDomGraph graph,
                              String label,
                              DomGraph origin,
                              boolean paintNow,
                              boolean showNow,
                              NodeLabels labels)
Adding a new tab to the window displaying the given JDomGraph

Parameters:
graph - the graph to display
label - the name for the tab
paintNow - if set to true, the graph is layoutet at once
showNow - if set to true, the tab will be shown after creating
Returns:
the tab or null if an error occured while setting up the tab

addNewTab

public boolean addNewTab(String label,
                         DomGraph graph,
                         NodeLabels labels)
Allowes to set up a new Tab by submitting the DomGraph to display and a NodeLabels object along with the graph's name.

Parameters:
label - name of the graph (resp. the tab)
graph - the DomGraph to display
labels - the storage for the node labels
Returns:
true if the DomGraph was sucessfully translated into a JDomGraph

addNewTab

public JDomGraphTab addNewTab(JDomGraph graph,
                              String label,
                              DomGraph origin,
                              boolean paintNow,
                              boolean showNow,
                              int index,
                              NodeLabels labels)
Adding a new tab to the window displaying the given JDomGraph, given the index indicating where to insert it in the tab.

Parameters:
graph - the graph to display
label - the name of the tab
paintNow - if set to true the graph is layoutet at once
showNow - if set to true the graph is shown immidiately
index - indicating on which place of the tab the new tab shall be inserted
Returns:
the new tab or null if anything fails

genericLoadGraph

public JDomGraph genericLoadGraph(Reader reader,
                                  String codec,
                                  DomGraph graph,
                                  NodeLabels nl,
                                  Map<String,String> options)
Loads a labelled dominance graph from a reader.

Parameters:
reader - the Reader from which the graph is read
codec - the name of the input codec that should be used to decode the graph
graph - a DomGraph which this method sets to the dominance graph part of the labelled graph
nl - a NodeLabels object which this method fills with the node labelling part of the labelled graph
Returns:
a new JDomGraph representation for the labelled graph

genericLoadGraph

public JDomGraph genericLoadGraph(String filename,
                                  DomGraph graph,
                                  NodeLabels nl,
                                  Map<String,String> options)
Loads a labelled dominance graph from a file.

Parameters:
filename - the file name
graph - a DomGraph which this method sets to the dominance graph part of the labelled graph
nl - a NodeLabels object which this method fills with the node labelling part of the labelled graph
Returns:
a new JDomGraph representation for the labelled graph

main

public static void main(String[] args)
Starting Ubench, optionally with files to open on command line

Parameters:
args - command line arfuments

getListener

public CommandListener getListener()
Returns:
Returns the listener.

setListener

public void setListener(CommandListener listener)
Parameters:
listener - The listener to set.

getCodecManager

public CodecManager getCodecManager()
Returns:
the codecManager

getExampleManager

public ExampleManager getExampleManager()
Returns:
the exampleManager

getInstance

public static Ubench getInstance()
Returns the (only) instance of the Ubench class. Creates a new Ubench object if there was none created yet, returns the already created instance otherwise.

Returns:
the single Ubench instance

getEquationSystem

public EquationSystem getEquationSystem()
Returns:
Returns the eqs.

setEquationSystem

public void setEquationSystem(EquationSystem eqs,
                              String name)
Parameters:
eqs - The eqs to set.

getEqsname

public String getEqsname()
Returns:
Returns the eqsname.

isEquationSystemLoaded

public boolean isEquationSystemLoaded()

getLastPath

public File getLastPath()
Returns:
Returns the lastPath.

setLastPath

public void setLastPath(File lastPath)
Parameters:
lastPath - The lastPath to set.