japlot.jaxodraw
Class JaxoGraph
- java.lang.Object
-
- japlot.jaxodraw.JaxoGraph
-
- All Implemented Interfaces:
- java.io.Serializable
public class JaxoGraph extends java.lang.Object implements java.io.SerializableA JaxoGraph is an extended version of a JaxoSaveGraph: in addition to the Vector holding the list of JaxoObjects and the description of the graph, it contains some information about how the graph is presented on the screen: a backup list of JaxoObjects (used for undo), a file name (used for saving) the currently selected object, etc.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description JaxoGraph()Creates a new JaxoGraph with empty list of objects, empty description and empty saveFileName.JaxoGraph(java.util.ArrayList list)Creates a new JaxoGraph with the given list of objects, empty description and empty saveFileName.JaxoGraph(java.util.ArrayList list, java.lang.String describe)Creates a new JaxoGraph with the given list of objects and description and empty saveFileName.JaxoGraph(java.util.ArrayList list, java.lang.String describe, java.lang.String saveFile)Creates a new JaxoGraph with the given list of objects, description and saveFileName.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddFirst(JaObject object)Adds the specified JaObject to the first positionvoidaddObject(JaObject object)Adds the specified JaObject to the list of objects by appending it and flags the JaxoGraph as not saved..voidbackground(JaObject object)Puts the specified JaObject into the background, i.e., to the first position in the object list.voidbackup()Copies the list of objects to the backup list and the selected object to the backup selected object.voidclear()Removes all JaxoObjects from the list of objects.voidclearAll()Removes all JaxoObjects from the list of objects and sets the description to a string to size zero.booleancontainsLatexText()Checks if there are LatexText objects present in this current graph.booleancontainsPSText()Checks if there are PSText objects present in this current graph.java.util.ArrayListcopyFrom(java.util.ArrayList v)Returns a copy of the specified vector.voiddelete(JaObject object)Removes the specified JaObject from the list of objects and flags the JaxoGraph as not saved.voiddrawGroupHandles(org.freehep.graphics2d.VectorGraphics g2)Draws handles on all group objects in this graph.voiddrawHandles(org.freehep.graphics2d.VectorGraphics g2)Draws handles on all objects in this graph.voidforeground(JaObject object)Puts the specified JaObject into the foreground, i.e., to the last position in the object list.java.util.ArrayListgetBackupList()Returns the backup list of the current JaxoGraph.JaObjectgetBackupSelectedObject()Returns the current backupSelectedObject.double[]getBoundingBox()Returns the smallest bounding box that contains all the JaxoObjects of this JaxoGraph.java.lang.StringgetDescription()Returns the description text of this JaxoGraph.java.util.ArrayListgetObjectList()Returns the Vector holding the list of JaxoObjects.java.util.ArrayListgetPackageList()Returns the Vector holding the list of Latex packages.java.lang.StringgetSaveFileName()Returns the current default save file name.JaxoSaveGraphgetSaveGraph()Returns the JaxoSaveGraph (i.e., the current list of objects and the current description) of the current JaxoGraph.JaObjectgetSelectedObject()Returns the currently selected JaObject of this JaxoGraph.java.lang.StringgetShortName()Returns the name of the current file (ie without the absolute path).booleanisSaved()Indicates whether the current JaxoGraph contains unsaved changes.JaObjectlistElementAt(int i)Returns the JaObject at position i of the object list.intlistSize()Returns the size of the current object list, i.e., the number of objects it contains.voidreverse()Reverse the object listvoidsetAsMarked(boolean marked)Marks all objects in this graph.voidsetBackupList(java.util.ArrayList v)Sets the backup list of the current JaxoGraph to v.voidsetBackupSelectedObject(JaObject newOb)Sets the specified JaObject to be the current backupSelectedObject.voidsetDescription(java.lang.String describe)Sets the description text of this JaxoGraph and flags the JaxoGraph as not saved.voidsetObjectList(java.util.ArrayList list)Sets the list of objects of this JaxoGraph to list and flags the JaxoGraph as not saved.voidsetPackageList(java.util.ArrayList list)Sets the list of Latex packages of this JaxoGraph to list and flags the JaxoGraph as not saved.voidsetSaved(boolean isSaved)Declares the current JaxoGraph as saved or unsaved, according to the boolean variable isSaved.voidsetSaveFileName(java.lang.String fileName)Sets the default file name for save operations.voidsetSaveGraph(JaxoSaveGraph newSaveGraph)Sets the JaxoSaveGraph (i.e., the current list of objects and the current description) of the current JaxoGraph.voidsetSelectedObject(JaObject newOb)Sets the specified JaObject as currently selected.voidundo()Exchanges the current list of objects with the backup list and the current SelectedObject with the BackupSelectedObject and sets the graph as not saved.
-
-
-
Constructor Detail
-
JaxoGraph
public JaxoGraph()
Creates a new JaxoGraph with empty list of objects, empty description and empty saveFileName.
-
JaxoGraph
public JaxoGraph(java.util.ArrayList list)
Creates a new JaxoGraph with the given list of objects, empty description and empty saveFileName.- Parameters:
list- The new list of objects
-
JaxoGraph
public JaxoGraph(java.util.ArrayList list, java.lang.String describe)Creates a new JaxoGraph with the given list of objects and description and empty saveFileName.- Parameters:
list- The new list of objectsdescribe- String which decsribes this JaxoGraph
-
JaxoGraph
public JaxoGraph(java.util.ArrayList list, java.lang.String describe, java.lang.String saveFile)Creates a new JaxoGraph with the given list of objects, description and saveFileName.- Parameters:
list- The new list of objectsdescribe- String which decsribes this JaxoGraphsaveFile- String holding the file name for saving
-
-
Method Detail
-
getSaveGraph
public final JaxoSaveGraph getSaveGraph()
Returns the JaxoSaveGraph (i.e., the current list of objects and the current description) of the current JaxoGraph.- Returns:
- The JaxoSaveGraph of the current JaxoGraph.
-
setSaveGraph
public final void setSaveGraph(JaxoSaveGraph newSaveGraph)
Sets the JaxoSaveGraph (i.e., the current list of objects and the current description) of the current JaxoGraph.- Parameters:
newSaveGraph- The new JaxoSaveGraph.
-
getObjectList
public final java.util.ArrayList getObjectList()
Returns the Vector holding the list of JaxoObjects.- Returns:
- The vector holding the list of JaxoObjects.
-
reverse
public final void reverse()
Reverse the object list
-
setObjectList
public final void setObjectList(java.util.ArrayList list)
Sets the list of objects of this JaxoGraph to list and flags the JaxoGraph as not saved.- Parameters:
list- The vector holding the new list of JaxoObjects.
-
getPackageList
public final java.util.ArrayList getPackageList()
Returns the Vector holding the list of Latex packages.- Returns:
- The vector holding the list of Latex packages.
-
setPackageList
public final void setPackageList(java.util.ArrayList list)
Sets the list of Latex packages of this JaxoGraph to list and flags the JaxoGraph as not saved.- Parameters:
list- The vector holding the new list of Latex packages.
-
setBackupList
public final void setBackupList(java.util.ArrayList v)
Sets the backup list of the current JaxoGraph to v.- Parameters:
v- The new backup list.
-
getBackupList
public final java.util.ArrayList getBackupList()
Returns the backup list of the current JaxoGraph.- Returns:
- The backup list of the current JaxoGraph.
-
setDescription
public final void setDescription(java.lang.String describe)
Sets the description text of this JaxoGraph and flags the JaxoGraph as not saved.- Parameters:
describe- The description of this JaxoGraph.
-
getDescription
public final java.lang.String getDescription()
Returns the description text of this JaxoGraph.- Returns:
- The decription of this JaxoGraph.
-
isSaved
public final boolean isSaved()
Indicates whether the current JaxoGraph contains unsaved changes.- Returns:
- True if the Current JaxoGraph is saved.
-
setSaved
public final void setSaved(boolean isSaved)
Declares the current JaxoGraph as saved or unsaved, according to the boolean variable isSaved.- Parameters:
isSaved- Boolean variable to indicate whether the current JaxoGraph is saved or not.
-
setSaveFileName
public final void setSaveFileName(java.lang.String fileName)
Sets the default file name for save operations.- Parameters:
fileName- The file name to be used for saving.
-
getSaveFileName
public final java.lang.String getSaveFileName()
Returns the current default save file name.- Returns:
- The current default save file name.
-
getShortName
public final java.lang.String getShortName()
Returns the name of the current file (ie without the absolute path).- Returns:
- The current file
-
getSelectedObject
public final JaObject getSelectedObject()
Returns the currently selected JaObject of this JaxoGraph.- Returns:
- The currently selected JaObject of this JaxoGraph.
-
setSelectedObject
public final void setSelectedObject(JaObject newOb)
Sets the specified JaObject as currently selected.- Parameters:
newOb- The JaObject to be set selected.
-
getBackupSelectedObject
public final JaObject getBackupSelectedObject()
Returns the current backupSelectedObject.- Returns:
- The current backupSelectedObject.
-
setBackupSelectedObject
public final void setBackupSelectedObject(JaObject newOb)
Sets the specified JaObject to be the current backupSelectedObject.- Parameters:
newOb- The JaObject to be set as backupSelectedObject.
-
listElementAt
public final JaObject listElementAt(int i)
Returns the JaObject at position i of the object list.- Parameters:
i- The index of the JaObject to be returned.- Returns:
- The JaObject at position i of the object list.
-
listSize
public final int listSize()
Returns the size of the current object list, i.e., the number of objects it contains.- Returns:
- The number of objects currently in the object list.
-
foreground
public final void foreground(JaObject object)
Puts the specified JaObject into the foreground, i.e., to the last position in the object list. If the JaxoGraph was modified by this operation, flags it as not saved.- Parameters:
object- The JaObject to be put into the foreground.
-
background
public final void background(JaObject object)
Puts the specified JaObject into the background, i.e., to the first position in the object list. If the JaxoGraph was modified by this operation, flags it as not saved.- Parameters:
object- The JaObject to be put into the background.
-
delete
public final void delete(JaObject object)
Removes the specified JaObject from the list of objects and flags the JaxoGraph as not saved.- Parameters:
object- The JaObject to be removed from the list.
-
addFirst
public final void addFirst(JaObject object)
Adds the specified JaObject to the first position- Parameters:
object- The JaObject to be added to the list.
-
addObject
public final void addObject(JaObject object)
Adds the specified JaObject to the list of objects by appending it and flags the JaxoGraph as not saved..- Parameters:
object- The JaObject to be added to the list.
-
clear
public final void clear()
Removes all JaxoObjects from the list of objects. If the JaxoGraph was modified by this operation, flags it as not saved.
-
clearAll
public final void clearAll()
Removes all JaxoObjects from the list of objects and sets the description to a string to size zero. If the JaxoGraph was modified by this operation, flags it as not saved.
-
undo
public final void undo()
Exchanges the current list of objects with the backup list and the current SelectedObject with the BackupSelectedObject and sets the graph as not saved.
-
getBoundingBox
public final double[] getBoundingBox()
Returns the smallest bounding box that contains all the JaxoObjects of this JaxoGraph.- Returns:
- An array holding the bounds of the current JaxoGraph: bBox[0] = Xmin, bBox[1] = Ymin, bBox[2] = Xmax and bBox[3] = Ymax.
-
backup
public final void backup()
Copies the list of objects to the backup list and the selected object to the backup selected object.
-
copyFrom
public final java.util.ArrayList copyFrom(java.util.ArrayList v)
Returns a copy of the specified vector.- Parameters:
v- A vector to be duplicated.- Returns:
- A copy of v.
-
containsPSText
public final boolean containsPSText()
Checks if there are PSText objects present in this current graph.- Returns:
- True, if there are PSTexts, false otherwise.
-
containsLatexText
public final boolean containsLatexText()
Checks if there are LatexText objects present in this current graph.- Returns:
- True, if there are LatexTexts, false otherwise.
-
drawHandles
public final void drawHandles(org.freehep.graphics2d.VectorGraphics g2)
Draws handles on all objects in this graph.- Parameters:
g2- The graphics context to draw the handles to.
-
drawGroupHandles
public final void drawGroupHandles(org.freehep.graphics2d.VectorGraphics g2)
Draws handles on all group objects in this graph.- Parameters:
g2- The graphics context to draw the handles to.
-
setAsMarked
public final void setAsMarked(boolean marked)
Marks all objects in this graph.- Parameters:
marked- A boolean that indicates whether to mark or not.
-
-
DMelt 3.0 © DataMelt by jWork.ORG