Skip to content

Editing Elements with Wt

Daniel Kramp edited this page Aug 10, 2017 · 1 revision

Controlling Elements Using Wt

DOM (Domain Object Model) elements are all on-screen features that you see. A basic understanding of HTML is recommended before editing DOM elements. Almost all DOM elements used in the ANMLViewer tool are generated by Wt C++ Web Toolkit and therefore must be edited in the C++ file "VASimVis.cc". After making any changes, this must be recompiled using the command make, the server stopped, and then run again using run.sh. See Wt's documentation for information on using Wt, or see from the code provided in ANMLViewer.

Objects that do not need to use C++ for back-end manipulation do not necessarily have to be added in this file. However, if an element does need to interact with C++, all of its ancestors must also be added via Wt. All elements except some tooltips and context menus were added via Wt for consistency and organization. This does not slow down the interaction time since after elements are loaded, interactions remain mostly client-side except as described below.

The web page links Bootstrap for styling and functionality and is used for all modals (dialogs) that show up on screen. Using these style classes will help to maintain the look and feel when adding new features.

Input Listeners

Input listeners (button click, file uploaded, etc.) can be added directly using Wt, but again are only necessary to do so if they must use a C++ back-end. Most features implement JavaScript listeners instead to minimize server-side connections and allow for almost complete usage if connection is lost during a session. However, certain features, like file uploading and automata editing must make connections to C++ where the automata is manipulated. Where possible, add the input listener purely in JavaScript.

JSignals

JSignals are extremely useful when it is necessary to call a C++ function from JavaScript. This is done a few times in Editor Mode when editing automata. Conversely, any JavaScript function can be called from C++ using doJavaScript().

Clone this wiki locally