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 StringuntitledString-
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 voidaddAction(ActionObject action)Insert the method's description here.static voidapplyPortAndMacroConnectors(Object dsId, DBData dbData, VDBData vdbData)static HashMapapplyVisualData(Object dsId, boolean importDB, Group group, DBData dbData, VDBData vdbData)Insert the method's description here.voidascendFromTemplate()Insert the method's description here.voidbaseView()Insert the method's description here.voidcenterObject(VisibleObject object)Insert the method's description here.voidcheckForIncodedDBDs(File file)jh Creation date: (6.1.2001 22:35:40)booleanclose()MacrocreateMacro(VDBMacro vdbMacro)Insert the method's description here.voidcreatePort(VDBPort vdbPort)Insert the method's description here.voidcreateTemplateInstance(String name, String type, boolean relative)Insert the method's description here.voiddescendIntoTemplate(Template template)Insert the method's description here.voiddraw(Graphics g)Insert the method's description here.voidgenerateMacros()Searches for undefined macrosintgetComponentHeight()Insert the method's description here.intgetComponentWidth()Insert the method's description here.InternalFrameInterfacegetDisplayer()ObjectgetDsId()DSGUIInterfacegetGuimenu()intgetNumberOfPages()Returns the number of pages in the set.PageFormatgetPageFormat(int pageIndex)Returns thePageFormatof the page specified bypageIndex.intgetPressedX()Insert the method's description here.intgetPressedY()Insert the method's description here.PrintablegetPrintable(int pageIndex)Returns thePrintableinstance responsible for rendering the page specified bypageIndex.VDBTemplategetTemplate()StackgetTemplateStack()Returns the templateStack.StringgetTitle()ViewStategetView()Insert the method's description here.GroupgetViewGroup()Insert the method's description here.booleanimportBorder(File file)booleanimportDB(File file)SEPARATE DOWN CODE TO METHODS Creation date: (6.1.2001 22:35:40)booleanimportFields(File file, boolean ignoreLinkFields)Import the fields from a .db file (option to ignore database link fields).voidinitializeWorkspace()Insert the method's description here.booleanisDisposed()booleanisFlat()Insert the method's description here.booleanisModified()Insert the method's description here.booleanisPrinting()booleanisTemplateAllowed(VDBTemplate template)Returns true if a template instance of the given template can be added as an element to currently edited template.booleanisTemplateChanged()voidlinkCommand(VisibleObject linkObject, LinkSource linkData)Insert the method's description here.static voidloadBlackOnWhiteColorScheme()Loads black on white color chemebooleanloadRdbDbGroup(JFrame guiContext)static voidloadWhiteOnBlackColorScheme()Loads white on black color chemevoidmouseClicked(MouseEvent e)Invoked when the mouse has been clicked on a component.voidmouseDragged(MouseEvent e)Invoked when a mouse button is pressed on a component and then dragged.voidmouseEntered(MouseEvent e)Invoked when the mouse enters a component.voidmouseExited(MouseEvent e)Invoked when the mouse exits a component.voidmouseMoved(MouseEvent e)Invoked when the mouse button has been moved on a component (with no buttons no down).voidmousePressed(MouseEvent e)Invoked when a mouse button has been pressed on a component.voidmouseReleased(MouseEvent e)Invoked when a mouse button has been released on a component.voidmoveLevelUp()Insert the method's description here.voidmoveToGroup(Group group)Insert the method's description here.booleanopen(File file)Insert the method's description here.booleanopen(File file, boolean importDB)Insert the method's description here.booleanopen(File file, boolean importDB, boolean importToCurrentGroup)booleanopen(InputStream is, File file, boolean importDB, boolean importToCurrentGroup)SEPARATE DOWN CODE TO METHODS Creation date: (6.1.2001 22:35:40)booleanopenDBD(File file)Insert the method's description here.booleanopenDBD(File file, boolean importDBD)Insert the method's description here.booleanprepareTemplateLeave()true - OK, false - deniedintprint(Graphics graphics, PageFormat pageFormat, int pageIndex)Prints the page at the specified index into the specifiedGraphicscontext in the specified format.voidrecalculateNavigatorPosition()Insert the method's description here.booleanreloadTemplate(VDBTemplate data)voidrepaint()Insert the method's description here.voidrepaint(boolean drawOnlyHilitedOnce)Insert the method's description here.voidreset()voidresetDraggedPosition()voidresize(int x0, int y0, int width, int height)Insert the method's description here.voidrun()DrawingSurface thread.booleansaveRdbGroup(JFrame guiContext, RdbDataId rdbId, boolean dialog)voidsetBlockNavigatorRedrawOnce(boolean blockNavigatorRedrawOnce)Sets the blockNavigatorRedrawOnce.voidsetDisposed(boolean disposed)voidsetModified(boolean newModified)Insert the method's description here.voidsetPressedMousePos(int x, int y)voidsetScale(double scale)Insert the method's description here.voidtemplateReloadPostInit()voidupdateFile(File file)voidupdateWorkspaceGroup()Insert the method's description here.voidupdateWorkspaceScale()Insert the method's description here.voidzoomArea(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:
drawin interfaceVisualComponent- Overrides:
drawin classDecorator- Parameters:
g- g
-
getComponentHeight
public int getComponentHeight()
Insert the method's description here. Creation date: (11.12.2000 16:23:31)- Specified by:
getComponentHeightin interfaceVisualComponent- Overrides:
getComponentHeightin classDecorator- Returns:
- something
-
getComponentWidth
public int getComponentWidth()
Insert the method's description here. Creation date: (11.12.2000 16:23:02)- Specified by:
getComponentWidthin interfaceVisualComponent- Overrides:
getComponentWidthin classDecorator- Returns:
- int
-
getNumberOfPages
public int getNumberOfPages()
Returns the number of pages in the set. To enable advanced printing features, it is recommended thatPageableimplementations return the true number of pages rather than the UNKNOWN_NUMBER_OF_PAGES constant.- Specified by:
getNumberOfPagesin interfacePageable- Returns:
- the number of pages in this
Pageable.
-
getPageFormat
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException
Returns thePageFormatof the page specified bypageIndex.- Specified by:
getPageFormatin interfacePageable- Parameters:
pageIndex- the zero based index of the page whosePageFormatis being requested- Returns:
- the
PageFormatdescribing the size and orientation. - Throws:
IndexOutOfBoundsException- foo thePageabledoes 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 thePrintableinstance responsible for rendering the page specified bypageIndex.- Specified by:
getPrintablein interfacePageable- Parameters:
pageIndex- the zero based index of the page whosePrintableis being requested- Returns:
- the
Printablethat renders the page. - Throws:
IndexOutOfBoundsException- foo thePageabledoes 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:
isModifiedin 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:
linkCommandin interfaceLinkCommandInterface- Parameters:
linkObject- linkObjectlinkData- linkData
-
mouseClicked
public void mouseClicked(MouseEvent e)
Invoked when the mouse has been clicked on a component.- Specified by:
mouseClickedin 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:
mouseDraggedin interfaceMouseMotionListener- Parameters:
e- e
-
mouseEntered
public void mouseEntered(MouseEvent e)
Invoked when the mouse enters a component.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e- e
-
mouseExited
public void mouseExited(MouseEvent e)
Invoked when the mouse exits a component.- Specified by:
mouseExitedin 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:
mouseMovedin interfaceMouseMotionListener- Parameters:
e- e
-
mousePressed
public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
e- e
-
mouseReleased
public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleasedin 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:
openin 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 specifiedGraphicscontext in the specified format. APrinterJobcalls thePrintableinterface 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. TheGraphicsclass or subclass implements thePrinterGraphicsinterface to provide additional information. If thePrintableobject aborts the print job then it throws aPrinterException.- Specified by:
printin 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
pageIndexspecifies 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:
runin 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:
resizein interfaceVisualComponent- Overrides:
resizein 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:
reloadTemplatein 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:
getDsIdin 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:
getTitlein interfaceDrawingSurfaceInterface- Returns:
- something
-
close
public boolean close()
- Specified by:
closein interfaceDrawingSurfaceInterface- Returns:
- something
-
getDisplayer
public InternalFrameInterface getDisplayer()
- Returns:
- something
-
isTemplateChanged
public boolean isTemplateChanged()
- Specified by:
isTemplateChangedin interfaceDrawingSurfaceInterface- Returns:
- something
-
getTemplate
public VDBTemplate getTemplate()
- Specified by:
getTemplatein 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:
isTemplateAllowedin interfaceDrawingSurfaceInterface- Parameters:
template- template- Returns:
- something
-
-