 |
JavaScript Everywhere - Detailed Instructions
Posted by arungupta on June 1, 2007 at 5:01 PM PDT
These are detailed instructions for
this screencast.
Pre-requisites
- Download GlassFish v2 latest
build.
- In NetBeans 5.5
or NetBeans 5.5.1 Update Center,
manually download and install the
Ajax Update Center module. Run the Update Center and install all the modules supported by Ajax
Update Center plug-in. This will require an IDE restart.
- In NetBeans menu, go to Tools, Palette Manager, Add jMaki Component Library
and then add
jMaki Charting widgets.
Instructions
- Create a new NetBeans "Scripting" category and "Phobos Application"
project. In CSS layout, scroll to the bottom and select "Two Fixed Right
Sidebars" layout.
- In the '
Top
Right Column', clear the text and drag/drop Yahoo Calendar widget.
- In the '
Right Column', clear the text and drag/drop BlockList.
- Replace
value : [
{title : 'jMaki Project Home', link : 'https://ajax.dev.java.net',
description : 'Where to go for the latest jMaki.' },
{title : 'jMaki Widgets Home', link : 'https://widgets.dev.java.net',
description : 'The source for the latest jMaki widgets.' },
{title : 'jMaki-Charting Home', link : 'https://jmaki-charting.dev.java.net',
description : 'Enables complex charts rendered on the client in any modern
browser.' }
]
with
service : "/xhp?id=rss"
- In Left Column, clear the text drag/drop Yahoo Tabbed View.
- Replace "
content: 'Some Content'" with "url:
'/tab1/show'".
- Replace "
content: 'Tab 2 Content'" with "url:
'/tab2/show', iframe: true".
- Right click on View, select New, Stylized Phobos View and name it
tab1.
In CSS layout, scroll to the bottom and select "No CSS style". This will
automatically create a controller tab1.js which can be seen in
the controller sub-tree. This demonstrates that a new controller is
automatically created for every newly created view.
- Create tab2 using the instructions in the previous step.
- In tab1.ejs, clean all the text and drag/drop jMaki Line Chart widget from the
palette.
- Change
'Months' to
lineChartModel.xAxisTitle.
- Change the value of
xAxis.labels to
lineChartModel.xAxis.
- Change
'Temperature' to
lineChartModel.yAxisTitle.
- Change the value of
yAxis.tickCount from 3 to 10.
- Change the value of
value.data to
lineChartModel.chartData.
- In tab2.ejs, clean all the text and drag/drop Google Search widget from the
palette.
- Edit Static Content, resources, google, search, widget.json and add
- In '
controller', 'tab1.js', replace model definition
model = {
name = "app name"
};
with
var lineChartData = module.application.generateChartData();
lineChartModel = { xAxisTitle: "Month",
yAxisTitle: "Bug Count",
xAxis: "['November',
'December', 'January', 'February', 'March', 'April']",
chartData: lineChartData
};
- In '
module', 'application.js', add the following code after
onShutdown() function:
this.generateChartData = function() { var chartData = [];
var chartDataRow = this.getData('red', 'P1'); chartData.push(chartDataRow);
chartDataRow = this.getData('orange', 'P2'); chartData.push(chartDataRow);
chartDataRow = this.getData('yellow', 'P3'); chartData.push(chartDataRow);
chartDataRow = this.getData('green', 'P4'); chartData.push(chartDataRow);
return chartData; }
// get bug data for a priority and assign a color to it this.getData = function(color, priority) { var chartDataRow = {}; chartDataRow["color"] = color; var
priorities = [];
for (var k=180;k > 29; k=k-30) { var val = new Packages.mypkg.BugQuery().getNewBugList(priority,
k); priorities.push(val); } chartDataRow["values"] =
priorities;
return chartDataRow; }
- Right click on Project, select Properties, Run tab, Add Jar/Folder, then
add
this library. This jar file manifests an existing
Enterprise application and queries bug tracking system in this case.
- Right click on Project, select Run Project.
Technorati:
javaone jmaki
phobos
glassfish
web2.0
|