13.07.2015 Views

Thesis full text PDF - Politecnico di Milano

Thesis full text PDF - Politecnico di Milano

Thesis full text PDF - Politecnico di Milano

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The PropertyWindow is maybe the most important class for our project. This window allows tomonitor the selection of all the elements. When the user change the selection of the element inthe workflow area, the PropertyWindow keeps this event and shows the element properties. Thiswindow will be crucial to manage the state and the properties of the selected objects.ToolPaletteThe ToolPalette is a palette which can be personalized by inserting in it all the objects that wewant to make available for the user. The user will have the possibility to click an object on thepalette and to insert in the workflow area. The ToolPalette will therefore be the work instrumentof the tool.To better understand how Draw2D works we show an example of implementation in which wecreate a tool palette that will be used from the user to add objects to the <strong>di</strong>agram in the workarea. In the main page of the project we have to import all the necessary Javascript files of thelibrary to exploit all needed objects and their functions.…// Import all .js library files needed…// Create the work area HTML element inside the page…// Generate the Draw2D work area and associate the HTML elementvar workflow = new Workflow("paintarea");// Add a simple PropertyDialog to the Canvas// This will <strong>di</strong>splay the properties of the current select objectvar <strong>di</strong>alog = new VectorPropertyWindow();workflow.showDialog(<strong>di</strong>alog,400,10);// Add the Tool Window to the screenvar w = new VectorPalette();workflow.setToolWindow(w);// move the tool palette out of the hint message at the top left cornerw.setPosition(20,140);window.onscroll=function(){workflow.onScroll();};25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!