Ewd GTM
Ewd GTM
Rob Tweed
M/Gateway Developments Ltd
Is GT.M old-fashioned?
• “I am a physician working in the VA
system. I also program in .net. Certainly
the VAs informatics back bone “VISTA” is
impressive…for the 1980s. “
Is GT.M old-fashioned?
• In fact that’s just a reflection of when VistA
was developed
• The fact is that GT.M is not only the right
kind of database for today’s applications..
• It also supports all the very latest Ajax
techniques and frameworks.
• One of the best platforms available!
• Eg…
What is Ajax?
• A term coined by Jesse James Garrett in 2005
to describe a range of techniques and
technologies that were starting to appear widely:
– http://adaptivepath.com/publications/essays/archives/
000385.php
• Ajax = Asynchronous Javascript and XML
• Actually XML not often used at all!
– Broad and vague term that describes a style of
application more than a set of technologies
What distinguishes an Ajax application?
Parser:
HTML XHTML CSP Pages
XML DOM
PHP Pages
Transformation
High-level description Engine
“Design Pages” (DOM API Methods)
Java Server Pages
HTML + JavaScript
+ CSS
+ ewd Custom Tags
ewd Compiler
WebLink Routines
EWD and GT.M
• EWD is available for GT.M
• Free (but not currently FOSS)
• Available in various formats:
– Suite of Mumps routines
– Install kit for Asus Eee
– Pre-packaged Virtual Appliance
• VMWare
• Ubuntu Linux JEOS
• GT.M
• EWD
• MGWSI gateway
• PHP
• Apache
Who uses EWD?
• Quest Diagnostics
– Care360 test requests/reporting
– 0.5 million tests per night
– 30,000 concurrent users
• Goodfellow UK online ordering
• Dept of Veterans Affairs, audiology
• Etc…
Let’s take a look
• EWD Virtual Appliance
• A typical Ajax application
– ewdMgr application
– Pre-built EWD/Ajax application
• Managing your EWD environment
Ajax Key Technologies
• Javascript and Event Handlers
• Cascading Style Sheets (CSS)
• XMLHttpRequest Object
– “back-channel” built into the browser that allows a
Javascript function to communicate externally via
HTTP
• Standard HTTP request/response
• Browser’s Document Object Model (DOM)
– Dynamic HTML
• JSON (JavaScript Object Notation)
Typical Ajax technique
• Catch an in-browser event:
– Standard Javascript event handler
• onClick, onChange, onMouseOver
• Send an asynchronous request via
XMLHTTPRequest object
• Use the response to modify part of the page in
the browser by manipulating the DOM
– Or send and optionally invoke a JavaScript object via
JSON
Browser’s DOM
• When a page of HTML is received by a
browser, it is parsed into a DOM
• API methods to manipulate the DOM are
implemented in Javascript
– document.getElementById(“myField”).parentNode
– document.getElementById(“myField”).firstChild
Javascript DOM API
Example:
var alertPointer = document.getElementById("ajaxAlert") ;
var head = document.getElementsByTagName("head").item(0);
alertPointer = document.createElement("script") ;
alertPointer.id = "ajaxAlert" ;
alertPointer.type = "text/javascript" ;
head.appendChild(alertPointer) ;
alertPointer.text = "EWD.ajax.errorOn() ;" ;
DOM Content Replacement
Element
<div>
<div id=“myId”>
parent
<h3> firstChild
Element
This is some text <h3>
</h3> parent
firstChild
</div>
Text
This is some text
DOM Content Replacement
<div id=“myId”>
<h3>
This is some text
</h3>
</div>
document.getElementById(“myId”).innerHTML
• read/write property
DOM Content Replacement
<div id=“myId”>
<h3>
This is some text
</h3>
</div>
DOM Content Replacement
<div id=“myId”>
</div>
DOM Content Replacement
<div id=“myId”>
<p>
Some new text
</p>
</div>
Browser DOM is active
• As soon as you make a modification to the
browser’s DOM, the browser re-renders
the page
• By replacing DOM content with markup
delivered as page fragments, we can
create an interactive experience for the
user
• EWD makes this easy…
Ajax Event Cycle (EWD)
Front-end technology (WebLink, PHP, CSP etc)
Container
Page
Fetch
data
Fetch
Method
EWD State & Session Management
GT.M Server
Ajax Event Cycle (EWD)
Replaces DOM content
Event
Container XMLHttpRequest Page
Page Fragment
Fetch
Page
Fragment
Fetch
data
Pre-page Fetch
Script Method
EWD State & Session Management
GT.M Server
Ajax Event Cycle (EWD)
Replaces DOM content
Event
Container Page
Page Fragment
Fetch
Page
Fragment
Fetch
data
Fetch
Method
EWD State & Session Management
GT.M Server
Ajax Event Cycle (EWD)
Container
Page
GT.M Server
Example page
• From ewdMgr
– mainMenu.ewd
• Very high-level description of what the page does
• Written using Custom Tags
– Compiler.ewd
• Ewd’s form automation
• Cross-reference
– Event
– Fragment name
– targetId
Developing with EWD
• EWD Virtual Appliance
– Apache
• WinSCP
• puTTY
• Serenji editor (optional)
• Browser
Developing with EWD
• Create new application directory
– Under /usr/ewdapps
– “application root directory”
• Create a page using text editor
– Eg within WinSCP or using Serenji
– File extension .ewd
• Compile application
– Using ewdMgr
– Command prompt
Developing with EWD
Developing with EWD
• Running in a browser
• http://192.168.1.10/php/helloWorld/hello1.php
Application name
Page name
(derived from hello.ewd)
A quick “hello world”
• Let’s build it…
Developing with EWD
• Fetch methods
– Create Mumps routine in /usr/local/gtm/ewd
– Compile using mumps *.m
Interfacing design and programming
Session
Web Page Database
Data-store
Designer Programmer
import java.util.ArrayList;
import java.util.List;
import com.extjs.gxt.samples.resources.client.TestData;
import com.extjs.gxt.samples.resources.client.model.Stock;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.store.ListStore;
column = new ColumnConfig();
column.setId("symbol"); import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
column.setHeader("Symbol");
column.setWidth(100); import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
configs.add(column); import com.extjs.gxt.ui.client.widget.grid.ColumnData;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
column = new ColumnConfig();
column.setId("last"); import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
column.setHeader("Last");
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
column.setAlignment(HorizontalAlignment.RIGHT);
column.setWidth(75); import com.extjs.gxt.ui.client.widget.table.NumberCellRenderer;
import com.google.gwt.i18n.client.DateTimeFormat;
column.setRenderer(gridNumber);
configs.add(column); import com.google.gwt.i18n.client.NumberFormat;
final NumberFormat
column = new ColumnConfig("date", currency
"Last Updated", = NumberFormat.getCurrencyFormat();
100);
final NumberFormat number = NumberFormat.getFormat("0.00");
column.setAlignment(HorizontalAlignment.RIGHT);
column.setDateTimeFormat(DateTimeFormat.getShortDateFormat());numberRenderer = new NumberCellRenderer<Grid<Stock>>(
final NumberCellRenderer<Grid<Stock>>
configs.add(column); currency);
<ewd:config fetchMethod="ewd.test.getAJWGridData">
<ext:config path="/ext-2.2" />
<html>
<head>
<title>Design-focused Development: ExtJS Grid Examples</title>
</head>
<body>
</body>
</html>
The ExtJS Demo
• Index4.ewd
– Viewport + sub-panels
• trialSelection.ewd
– Grid
• demographicsForm3.ewd
– Form panel + fields
Conclusions
• EWD is probably the fastest way to
develop web/Ajax applications
– No compromises
– All the most advanced modern techniques are
available
– But can be used in a fraction of the time
• Design-focussed = low maintenance
• GT.M + EWD = an awesome and world-
class environment