Package com.cosylab.vdct.graphics
Class DrawingSurface
- java.lang.Object
-
- com.cosylab.vdct.graphics.Decorator
-
- com.cosylab.vdct.graphics.DrawingSurface
-
- All Implemented Interfaces:
DrawingSurfaceInterface
,LinkCommandInterface
,VisualComponent
,MouseListener
,MouseMotionListener
,Pageable
,Printable
,Runnable
,EventListener
,MouseInputListener
public final class DrawingSurface extends Decorator implements DrawingSurfaceInterface, Pageable, Printable, MouseInputListener, Runnable, LinkCommandInterface
Insert the type's description here. Creation date: (10.12.2000 13:19:16)- Author:
- Matej Sekoranja
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
untitledString
-
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
-
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
-
Constructor Summary
Constructors Constructor Description DrawingSurface(Object id, int serialNumber, InternalFrameInterface displayer, CopyContext copyContext)
displayer can be null when no gui is linked to this.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAction(ActionObject action)
Insert the method's description here.static void
applyPortAndMacroConnectors(Object dsId, DBData dbData, VDBData vdbData)
static HashMap
applyVisualData(Object dsId, boolean importDB, Group group, DBData dbData, VDBData vdbData)
Insert the method's description here.void
ascendFromTemplate()
Insert the method's description here.void
baseView()
Insert the method's description here.void
centerObject(VisibleObject object)
Insert the method's description here.void
checkForIncodedDBDs(File file)
jh Creation date: (6.1.2001 22:35:40)boolean
close()
Macro
createMacro(VDBMacro vdbMacro)
Insert the method's description here.void
createPort(VDBPort vdbPort)
Insert the method's description here.void
createTemplateInstance(String name, String type, boolean relative)
Insert the method's description here.void
descendIntoTemplate(Template template)
Insert the method's description here.void
draw(Graphics g)
Insert the method's description here.void
generateMacros()
Searches for undefined macrosint
getComponentHeight()
Insert the method's description here.int
getComponentWidth()
Insert the method's description here.InternalFrameInterface
getDisplayer()
Object
getDsId()
DSGUIInterface
getGuimenu()
int
getNumberOfPages()
Returns the number of pages in the set.PageFormat
getPageFormat(int pageIndex)
Returns thePageFormat
of the page specified bypageIndex
.int
getPressedX()
Insert the method's description here.int
getPressedY()
Insert the method's description here.Printable
getPrintable(int pageIndex)
Returns thePrintable
instance responsible for rendering the page specified bypageIndex
.VDBTemplate
getTemplate()
Stack
getTemplateStack()
Returns the templateStack.String
getTitle()
ViewState
getView()
Insert the method's description here.Group
getViewGroup()
Insert the method's description here.boolean
importBorder(File file)
boolean
importDB(File file)
SEPARATE DOWN CODE TO METHODS Creation date: (6.1.2001 22:35:40)boolean
importFields(File file, boolean ignoreLinkFields)
Import the fields from a .db file (option to ignore database link fields).void
initializeWorkspace()
Insert the method's description here.boolean
isDisposed()
boolean
isFlat()
Insert the method's description here.boolean
isModified()
Insert the method's description here.boolean
isPrinting()
boolean
isTemplateAllowed(VDBTemplate template)
Returns true if a template instance of the given template can be added as an element to currently edited template.boolean
isTemplateChanged()
void
linkCommand(VisibleObject linkObject, LinkSource linkData)
Insert the method's description here.static void
loadBlackOnWhiteColorScheme()
Loads black on white color chemeboolean
loadRdbDbGroup(JFrame guiContext)
static void
loadWhiteOnBlackColorScheme()
Loads white on black color chemevoid
mouseClicked(MouseEvent e)
Invoked when the mouse has been clicked on a component.void
mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged.void
mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.void
mouseExited(MouseEvent e)
Invoked when the mouse exits a component.void
mouseMoved(MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons no down).void
mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.void
mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.void
moveLevelUp()
Insert the method's description here.void
moveToGroup(Group group)
Insert the method's description here.boolean
open(File file)
Insert the method's description here.boolean
open(File file, boolean importDB)
Insert the method's description here.boolean
open(File file, boolean importDB, boolean importToCurrentGroup)
boolean
open(InputStream is, File file, boolean importDB, boolean importToCurrentGroup)
SEPARATE DOWN CODE TO METHODS Creation date: (6.1.2001 22:35:40)boolean
openDBD(File file)
Insert the method's description here.boolean
openDBD(File file, boolean importDBD)
Insert the method's description here.boolean
prepareTemplateLeave()
true - OK, false - deniedint
print(Graphics graphics, PageFormat pageFormat, int pageIndex)
Prints the page at the specified index into the specifiedGraphics
context in the specified format.void
recalculateNavigatorPosition()
Insert the method's description here.boolean
reloadTemplate(VDBTemplate data)
void
repaint()
Insert the method's description here.void
repaint(boolean drawOnlyHilitedOnce)
Insert the method's description here.void
reset()
void
resetDraggedPosition()
void
resize(int x0, int y0, int width, int height)
Insert the method's description here.void
run()
DrawingSurface thread.boolean
saveRdbGroup(JFrame guiContext, RdbDataId rdbId, boolean dialog)
void
setBlockNavigatorRedrawOnce(boolean blockNavigatorRedrawOnce)
Sets the blockNavigatorRedrawOnce.void
setDisposed(boolean disposed)
void
setModified(boolean newModified)
Insert the method's description here.void
setPressedMousePos(int x, int y)
void
setScale(double scale)
Insert the method's description here.void
templateReloadPostInit()
void
updateFile(File file)
void
updateWorkspaceGroup()
Insert the method's description here.void
updateWorkspaceScale()
Insert the method's description here.void
zoomArea(int x1, int y1, int x2, int y2)
Insert the method's description here.-
Methods inherited from class com.cosylab.vdct.graphics.Decorator
getComponent, setComponent
-
-
-
-
Field Detail
-
untitledString
protected static final String untitledString
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DrawingSurface
public DrawingSurface(Object id, int serialNumber, InternalFrameInterface displayer, CopyContext copyContext)
displayer can be null when no gui is linked to this.- Parameters:
id
- idcopyContext
- copyContextserialNumber
- serialNumberdisplayer
- displayer
-
-
Method Detail
-
addAction
public void addAction(ActionObject action)
Insert the method's description here. Creation date: (22.4.2001 18:44:03)- Parameters:
action
- com.cosylab.vdct.undo.ActionObject
-
baseView
public void baseView()
Insert the method's description here. Creation date: (1.5.2001 17:32:20)
-
draw
public void draw(Graphics g)
Insert the method's description here. Creation date: (10.12.2000 13:19:16)- Specified by:
draw
in interfaceVisualComponent
- Overrides:
draw
in classDecorator
- Parameters:
g
- g
-
getComponentHeight
public int getComponentHeight()
Insert the method's description here. Creation date: (11.12.2000 16:23:31)- Specified by:
getComponentHeight
in interfaceVisualComponent
- Overrides:
getComponentHeight
in classDecorator
- Returns:
- something
-
getComponentWidth
public int getComponentWidth()
Insert the method's description here. Creation date: (11.12.2000 16:23:02)- Specified by:
getComponentWidth
in interfaceVisualComponent
- Overrides:
getComponentWidth
in classDecorator
- Returns:
- int
-
getNumberOfPages
public int getNumberOfPages()
Returns the number of pages in the set. To enable advanced printing features, it is recommended thatPageable
implementations return the true number of pages rather than the UNKNOWN_NUMBER_OF_PAGES constant.- Specified by:
getNumberOfPages
in interfacePageable
- Returns:
- the number of pages in this
Pageable
.
-
getPageFormat
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException
Returns thePageFormat
of the page specified bypageIndex
.- Specified by:
getPageFormat
in interfacePageable
- Parameters:
pageIndex
- the zero based index of the page whosePageFormat
is being requested- Returns:
- the
PageFormat
describing the size and orientation. - Throws:
IndexOutOfBoundsException
- foo thePageable
does not contain the requested page.
-
getPressedX
public int getPressedX()
Insert the method's description here. Creation date: (3.2.2001 23:39:28)- Returns:
- int
-
getPressedY
public int getPressedY()
Insert the method's description here. Creation date: (3.2.2001 23:39:28)- Returns:
- int
-
resetDraggedPosition
public void resetDraggedPosition()
-
getPrintable
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException
Returns thePrintable
instance responsible for rendering the page specified bypageIndex
.- Specified by:
getPrintable
in interfacePageable
- Parameters:
pageIndex
- the zero based index of the page whosePrintable
is being requested- Returns:
- the
Printable
that renders the page. - Throws:
IndexOutOfBoundsException
- foo thePageable
does not contain the requested page.
-
getView
public ViewState getView()
Insert the method's description here. Creation date: (1.5.2001 17:55:20)- Returns:
- com.cosylab.vdct.graphics.ViewState
-
getViewGroup
public Group getViewGroup()
Insert the method's description here. Creation date: (3.2.2001 22:58:19)- Returns:
- com.cosylab.vdct.graphics.objects.Group
-
initializeWorkspace
public void initializeWorkspace()
Insert the method's description here. Creation date: (8.1.2001 18:04:49)
-
isFlat
public boolean isFlat()
Insert the method's description here. Creation date: (1.5.2001 17:51:29)- Returns:
- boolean
-
isModified
public boolean isModified()
Insert the method's description here. Creation date: (1.2.2001 14:24:51)- Specified by:
isModified
in interfaceDrawingSurfaceInterface
- Returns:
- boolean
-
linkCommand
public void linkCommand(VisibleObject linkObject, LinkSource linkData)
Insert the method's description here. Creation date: (3.2.2001 13:31:09)- Specified by:
linkCommand
in interfaceLinkCommandInterface
- Parameters:
linkObject
- linkObjectlinkData
- linkData
-
mouseClicked
public void mouseClicked(MouseEvent e)
Invoked when the mouse has been clicked on a component.- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
e
- e
-
mouseDragged
public void mouseDragged(MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Parameters:
e
- e
-
mouseEntered
public void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
e
- e
-
mouseExited
public void mouseExited(MouseEvent e)
Invoked when the mouse exits a component.- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
e
- e
-
mouseMoved
public void mouseMoved(MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons no down).- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Parameters:
e
- e
-
mousePressed
public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
- e
-
mouseReleased
public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
- e
-
moveLevelUp
public void moveLevelUp()
Insert the method's description here. Creation date: (28.1.2001 18:39:57)
-
open
public boolean open(File file) throws IOException
Insert the method's description here. Creation date: (6.1.2001 22:35:40)- Parameters:
file
- java.io.File- Returns:
- something
- Throws:
IOException
- foo
-
open
public boolean open(File file, boolean importDB) throws IOException
Insert the method's description here. Creation date: (6.1.2001 22:35:40)- Specified by:
open
in interfaceDrawingSurfaceInterface
- Parameters:
file
- java.io.FileimportDB
- importDB- Returns:
- something
- Throws:
IOException
- foo
-
checkForIncodedDBDs
public void checkForIncodedDBDs(File file) throws IOException
jh Creation date: (6.1.2001 22:35:40)- Parameters:
file
- file- Throws:
IOException
- foo
-
importFields
public boolean importFields(File file, boolean ignoreLinkFields)
Import the fields from a .db file (option to ignore database link fields). Only the fields of the records that are already defined in VDCT are overriden with the new settings. This would allow easy definition of the limits, hardware addresses, display range etc.- Parameters:
file
- fileignoreLinkFields
- ignoreLinkFields- Returns:
- something
-
importBorder
public boolean importBorder(File file)
- Parameters:
file
- file- Returns:
- something
-
open
public boolean open(File file, boolean importDB, boolean importToCurrentGroup) throws IOException
- Parameters:
file
- fileimportDB
- importDBimportToCurrentGroup
- importToCurrentGroup- Returns:
- something
- Throws:
IOException
- foo
-
open
public boolean open(InputStream is, File file, boolean importDB, boolean importToCurrentGroup) throws IOException
SEPARATE DOWN CODE TO METHODS Creation date: (6.1.2001 22:35:40)- Parameters:
is
- isfile
- java.io.FileimportToCurrentGroup
- importToCurrentGroupimportDB
- importDB- Returns:
- something
- Throws:
IOException
- foo
-
loadRdbDbGroup
public boolean loadRdbDbGroup(JFrame guiContext)
- Parameters:
guiContext
- guiContext- Returns:
- something
-
saveRdbGroup
public boolean saveRdbGroup(JFrame guiContext, RdbDataId rdbId, boolean dialog)
- Parameters:
guiContext
- guiContextrdbId
- rdbIddialog
- dialog- Returns:
- something
-
importDB
public boolean importDB(File file) throws IOException
SEPARATE DOWN CODE TO METHODS Creation date: (6.1.2001 22:35:40)- Parameters:
file
- java.io.File- Returns:
- something
- Throws:
IOException
- foo
-
applyPortAndMacroConnectors
public static void applyPortAndMacroConnectors(Object dsId, DBData dbData, VDBData vdbData)
- Parameters:
dsId
- dsIddbData
- dbDatavdbData
- vdbData
-
applyVisualData
public static HashMap applyVisualData(Object dsId, boolean importDB, Group group, DBData dbData, VDBData vdbData)
Insert the method's description here.- Parameters:
dsId
- dsIdimportDB
- importDBgroup
- groupdbData
- dbDatavdbData
- vdbData- Returns:
- something
-
openDBD
public boolean openDBD(File file) throws IOException
Insert the method's description here. Creation date: (6.1.2001 22:35:40)- Parameters:
file
- java.io.File- Returns:
- something
- Throws:
IOException
- foo
-
openDBD
public boolean openDBD(File file, boolean importDBD) throws IOException
Insert the method's description here. Creation date: (6.1.2001 22:35:40)- Parameters:
file
- java.io.FileimportDBD
- importDBD- Returns:
- something
- Throws:
IOException
- foo
-
print
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
Prints the page at the specified index into the specifiedGraphics
context in the specified format. APrinterJob
calls thePrintable
interface to request that a page be rendered into the context specified bygraphics
. The format of the page to be drawn is specified bypageFormat
. The zero based index of the requested page is specified bypageIndex
. If the requested page does not exist then this method returns NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. TheGraphics
class or subclass implements thePrinterGraphics
interface to provide additional information. If thePrintable
object aborts the print job then it throws aPrinterException
.- Specified by:
print
in interfacePrintable
- Parameters:
graphics
- the context into which the page is drawnpageFormat
- the size and orientation of the page being drawnpageIndex
- the zero based index of the page to be drawn- Returns:
- PAGE_EXISTS if the page is rendered successfully
or NO_SUCH_PAGE if
pageIndex
specifies a non-existent page. - Throws:
PrinterException
- thrown when the print job is terminated.
-
recalculateNavigatorPosition
public void recalculateNavigatorPosition()
Insert the method's description here. Creation date: (27.12.2000 15:04:17)
-
run
public void run()
DrawingSurface thread. Aim of this thread is to optimize drawing on the surface. It could happen thatrepaint()
method is called very often (e.g. 100-times per second). Drawing at such rate is non-sence. The idea is to repaint whole workspace at maximum rate of 10 repaints/second.- Specified by:
run
in interfaceRunnable
- See Also:
Runnable.run()
-
repaint
public void repaint(boolean drawOnlyHilitedOnce)
Insert the method's description here. Creation date: (25.12.2000 14:59:05)- Parameters:
drawOnlyHilitedOnce
- drawOnlyHilitedOnce
-
repaint
public void repaint()
Insert the method's description here. Creation date: (25.12.2000 14:59:05)
-
resize
public void resize(int x0, int y0, int width, int height)
Insert the method's description here. Creation date: (10.12.2000 13:19:16)- Specified by:
resize
in interfaceVisualComponent
- Overrides:
resize
in classDecorator
- Parameters:
x0
- x0y0
- y0width
- widthheight
- height
-
setModified
public void setModified(boolean newModified)
Insert the method's description here. Creation date: (1.2.2001 14:24:51)- Parameters:
newModified
- boolean
-
setScale
public void setScale(double scale)
Insert the method's description here. Creation date: (29.12.2000 12:40:13)- Parameters:
scale
- double
-
centerObject
public void centerObject(VisibleObject object)
Insert the method's description here. Creation date: (29.12.2000 12:40:13)- Parameters:
object
- object
-
updateWorkspaceScale
public void updateWorkspaceScale()
Insert the method's description here. Creation date: (29.12.2000 12:49:54)
-
zoomArea
public void zoomArea(int x1, int y1, int x2, int y2)
Insert the method's description here. Creation date: (25.12.2000 16:49:07)- Parameters:
x1
- inty1
- intx2
- inty2
- int
-
createTemplateInstance
public void createTemplateInstance(String name, String type, boolean relative)
Insert the method's description here. Creation date: (3.2.2001 23:27:30)- Parameters:
name
- java.lang.Stringtype
- java.lang.Stringrelative
- boolean
-
prepareTemplateLeave
public boolean prepareTemplateLeave()
true - OK, false - denied- Returns:
- something
-
templateReloadPostInit
public void templateReloadPostInit()
-
descendIntoTemplate
public void descendIntoTemplate(Template template)
Insert the method's description here. Creation date: (22.4.2001 18:44:03)- Parameters:
template
- com.cosylab.vdct.graphics.objects.Template
-
ascendFromTemplate
public void ascendFromTemplate()
Insert the method's description here. Creation date: (22.4.2001 18:44:03)
-
moveToGroup
public void moveToGroup(Group group)
Insert the method's description here. Creation date: (22.4.2001 18:44:03)- Parameters:
group
- com.cosylab.vdct.graphics.objects.Group
-
updateWorkspaceGroup
public void updateWorkspaceGroup()
Insert the method's description here. Creation date: (22.4.2001 18:44:03)
-
getTemplateStack
public Stack getTemplateStack()
Returns the templateStack.- Returns:
- Stack
-
reloadTemplate
public boolean reloadTemplate(VDBTemplate data)
- Specified by:
reloadTemplate
in interfaceDrawingSurfaceInterface
- Parameters:
data
- data- Returns:
- something
-
setBlockNavigatorRedrawOnce
public void setBlockNavigatorRedrawOnce(boolean blockNavigatorRedrawOnce)
Sets the blockNavigatorRedrawOnce.- Parameters:
blockNavigatorRedrawOnce
- The blockNavigatorRedrawOnce to set
-
loadWhiteOnBlackColorScheme
public static void loadWhiteOnBlackColorScheme()
Loads white on black color cheme
-
loadBlackOnWhiteColorScheme
public static void loadBlackOnWhiteColorScheme()
Loads black on white color cheme
-
createPort
public void createPort(VDBPort vdbPort)
Insert the method's description here. Creation date: (3.2.2001 23:27:30)- Parameters:
vdbPort
- vdbPort
-
createMacro
public Macro createMacro(VDBMacro vdbMacro)
Insert the method's description here. Creation date: (3.2.2001 23:27:30)- Parameters:
vdbMacro
- vdbMacro- Returns:
- something
-
generateMacros
public void generateMacros()
Searches for undefined macros
-
isPrinting
public boolean isPrinting()
- Returns:
- something
-
reset
public void reset()
-
setPressedMousePos
public void setPressedMousePos(int x, int y)
- Parameters:
x
- xy
- y
-
getGuimenu
public DSGUIInterface getGuimenu()
- Returns:
- the guimenu
-
getDsId
public Object getDsId()
- Specified by:
getDsId
in interfaceDrawingSurfaceInterface
- Returns:
- the id
-
isDisposed
public boolean isDisposed()
- Returns:
- something
-
setDisposed
public void setDisposed(boolean disposed)
- Parameters:
disposed
- disposed
-
updateFile
public void updateFile(File file)
- Parameters:
file
- file
-
getTitle
public String getTitle()
- Specified by:
getTitle
in interfaceDrawingSurfaceInterface
- Returns:
- something
-
close
public boolean close()
- Specified by:
close
in interfaceDrawingSurfaceInterface
- Returns:
- something
-
getDisplayer
public InternalFrameInterface getDisplayer()
- Returns:
- something
-
isTemplateChanged
public boolean isTemplateChanged()
- Specified by:
isTemplateChanged
in interfaceDrawingSurfaceInterface
- Returns:
- something
-
getTemplate
public VDBTemplate getTemplate()
- Specified by:
getTemplate
in interfaceDrawingSurfaceInterface
- Returns:
- something
-
isTemplateAllowed
public boolean isTemplateAllowed(VDBTemplate template)
Returns true if a template instance of the given template can be added as an element to currently edited template. Returns false if there is a cyclic template dependency.- Specified by:
isTemplateAllowed
in interfaceDrawingSurfaceInterface
- Parameters:
template
- template- Returns:
- something
-
-