Hi,
What’s the best practice for embedding flash into Smart Gwt, specifically into a movable Window. I have been trying to get it working but am having a few issues.
1.The flash object renders in the Window but when i move the window, the title bar disappears and the window is no longer movable.
2.When the window is closed, the flash movie is still present.
When using TabSet , the flash movie is visible in all tabs, i.e. when I switch tabs, the movie is not hidden.
I am pretty new to using flash, my only experience is using amcharts (www.amcharts.com ) in Grails GSP’s (Groovy server pages) and am now migrating that system to smart GWT. Your help is really appreciated as deadlines are fast approaching (as per usual)
Thanks,
John
Hi,
This code seems to alleviate problems 2 & 3:
HLayout mainPanel = new HLayout();
mainPanel.setWidth100();
mainPanel.setWidth100();
Window window = new Window();
window.setSize("800", "800");
String s = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"100%\" height=\"100%\" id=\"amline\" align=\"middle\">" +
"<param name=\"allowScriptAccess\" value=\"sameDomain\" />" +
"<param name=\"movie\" value=\"js/amchart/amline/amline.swf?&path=js/amchart/amline/&data_file=js/amchart/amline/amline_data.xml&settings_file=js/amchart/amline/amline_settings.xml\"/>" +
"<param name=\"quality\" value=\"high\" />" +
"<param name=\"bgcolor\" value=\"#ffffff\"/>" +
"<embed src=\"js/amchart/amline/amline.swf?&path=js/amchart/amline/&data_file=js/amchart/amline/amline_data.xml&settings_file=js/amchart/amline/amline_settings.xml\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100%\" height=\"100%\" name=\"0\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />" +
"</object>";
HTMLPanel htmlPanel = new HTMLPanel(s);
htmlPanel.setHeight("600");
htmlPanel.setWidth("600");
window.addChild(htmlPanel);
mainPanel.addChild(window);
However I still have these problems:
1.the flash object is not entirely within the window, it is covering the title now. Setting wmode to transparent kind of works but you cannot see the very top of the movie (it is clipped by the title bar)
2. In firefox, when i drag the widow containing the movie towards the top of the tabset, the title bar disappears, meaning I cannot move or close the window.
Any idea’s?
Thanks,
John
Sorry all, my mistake. Instead of
window.addChild(htmlPanel);
I needed:
window.addItem(htmlPanel);
D’oh
Groovy Grails and SmartClient data source
Hello,
Is there a way for Grails to expose a service as a SmartClient data source ?
Like a one liner in groovy as is done to offer a RESTful service…
That would save me from writing such Java classes :
package com.smartgwt.sample.showcase.client.data;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
import com.smartgwt.client.data.fields.DataSourceFloatField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;
public class EmployeeXmlDS extends DataSource {
private static EmployeeXmlDS instance = null;
public static EmployeeXmlDS getInstance() {
if (instance == null) {
instance = new EmployeeXmlDS("employeesDS");
}
return instance;
}
public EmployeeXmlDS(String id) {
setID(id);
setRecordXPath("/List/employee");
DataSourceTextField nameField = new DataSourceTextField("Name", "Name", 128);
DataSourceIntegerField employeeIdField = new DataSourceIntegerField("EmployeeId", "Employee ID");
employeeIdField.setPrimaryKey(true);
employeeIdField.setRequired(true);
DataSourceIntegerField reportsToField = new DataSourceIntegerField("ReportsTo", "Manager");
reportsToField.setRequired(true);
reportsToField.setForeignKey(id + ".EmployeeId");
reportsToField.setRootValue("1");
DataSourceTextField jobField = new DataSourceTextField("Job", "Title", 128);
DataSourceTextField emailField = new DataSourceTextField("Email", "Email", 128);
DataSourceTextField statusField = new DataSourceTextField("EmployeeStatus", "Status", 40);
DataSourceFloatField salaryField = new DataSourceFloatField("Salary", "Salary");
DataSourceTextField orgField = new DataSourceTextField("OrgUnit", "Org Unit", 128);
DataSourceTextField genderField = new DataSourceTextField("Gender", "Gender", 7);
genderField.setValueMap("male", "female");
DataSourceTextField maritalStatusField = new DataSourceTextField("MaritalStatus", "Marital Status", 10);
setFields(nameField, employeeIdField, reportsToField, jobField, emailField,
statusField, salaryField, orgField, genderField, maritalStatusField);
setDataURL("ds/test_data/employees.data.xml");
setClientOnly(true);
}
}
gev
April 7, 2009, 2:29pm
5
To solve problems 2,3 you must setup CSS property “visible” to “inherit”.
See this, for example:
http://forums.smartclient.com/showthread.php?t=4744&highlight=swf2gwt .
This is also actual not only for SWF. For some openlayer’s controls too.
@stephaneeybert No one has written such a thing yet but you could be the first
In SmartGWT EE there is a batch DataSource generator - see blog announcement . That’s a good starting point.