setWidth(Home.WIDTH);
setBackgroundColor("#F8F8F8");
setPosition(Positioning.ABSOLUTE);
DynamicForm form = new DynamicForm();
form.setWidth100();
form.setNumCols(11);
form.setColWidths(120,30,100,"*",60,80,80,10,160,10,120);
DEPTH = new TextItem("depth","Initial Depth");
DEPTH.setWidth("*");
DEPTH.setValue(String.valueOf(Home.VIEW - 1));
URL = new TextItem("location","Online XML");
URL.setWidth("*");
URL.setValue(url);
URL.addKeyPressHandler(new KeyPressHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.KeyPressHandler#onKeyPress(com.smartgwt.client.widgets.form.fields.events.KeyPressEvent)
*/
public void onKeyPress(KeyPressEvent event){
if(event.getKeyName().equals("Enter")){
request((String) URL.getValue(), Integer.valueOf((String) DEPTH.getValue()));
}
}
});
DEPTH.addKeyPressHandler(new KeyPressHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.KeyPressHandler#onKeyPress(com.smartgwt.client.widgets.form.fields.events.KeyPressEvent)
*/
public void onKeyPress(KeyPressEvent event){
if(event.getKeyName().equals("Enter")){
request((String) URL.getValue(), Integer.valueOf((String) DEPTH.getValue()));
}
}
});
ButtonItem load = new ButtonItem("load","Load");
load.setStartRow(false);
load.setEndRow(false);
load.setWidth("*");
load.addClickHandler(new ClickHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.ClickHandler#onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent)
*/
public void onClick(ClickEvent event){
request((String) URL.getValue(), Integer.valueOf((String) DEPTH.getValue()));
}
});
ButtonItem centre = new ButtonItem("centre","Centre");
centre.setStartRow(false);
centre.setEndRow(false);
centre.setWidth("*");
centre.addClickHandler(new ClickHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.ClickHandler#onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent)
*/
public void onClick(ClickEvent event){
MindMap.get(MindMap.FOCUS_ID).centre();
}
});
ButtonItem local = new ButtonItem("local","Local XML");
local.setStartRow(false);
local.setEndRow(false);
local.setAutoFit(false);
local.setWidth("*");
local.addClickHandler(new ClickHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.ClickHandler#onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent)
*/
public void onClick(ClickEvent event){
try{
Desktop desktop = Factory.getInstance().createDesktop();
desktop.openFiles(new OpenFilesHandler(){
/* (non-Javadoc)
* @see com.google.gwt.gears.client.desktop.OpenFilesHandler#onOpenFiles(com.google.gwt.gears.client.desktop.OpenFilesHandler.OpenFilesEvent)
*/
public void onOpenFiles(OpenFilesEvent event){
File[] files = event.getFiles();
File file = files[0];
Blob data = file.getBlob();
BlobReader reader = new BlobReader(data);
String map = "";
while(!reader.endOfBlob())
map = map + reader.readLine() + "\n";
Home.webError(map);
Home.URLRead(map,Integer.valueOf((String) DEPTH.getValue()));
}
}, true);
}catch(Exception e){
Home.webError("Google Gears Plugin Required for this feature.");
}
}
});
AUTO = new NativeCheckboxItem("auto");
AUTO.setTitle("Apply Force Interaction");
AUTO.setStartRow(false);
AUTO.setEndRow(false);
AUTO.setValue(false);
AUTO.addChangeHandler(new ChangeHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.ChangeHandler#onChange(com.smartgwt.client.widgets.form.fields.events.ChangeEvent)
*/
public void onChange(ChangeEvent event){
if(Boolean.valueOf(String.valueOf(AUTO.getValue()))){
Position.AUTO = false;
AUTO.setValue(false);
Position.cancel();
}
else{
Position.AUTO = true;
AUTO.setValue(true);
Position.forceDrivenPositioning();
}
}
});
GRAPH_3D = new NativeCheckboxItem("3d");
GRAPH_3D.setTitle("3D Graph");
GRAPH_3D.setStartRow(false);
GRAPH_3D.setEndRow(false);
GRAPH_3D.setValue(false);
GRAPH_3D.addChangeHandler(new ChangeHandler(){
/* (non-Javadoc)
* @see com.smartgwt.client.widgets.form.fields.events.ChangeHandler#onChange(com.smartgwt.client.widgets.form.fields.events.ChangeEvent)
*/
public void onChange(ChangeEvent event){
if(Boolean.valueOf(String.valueOf(GRAPH_3D.getValue()))){
Position.cancel3D();
Position.GRAPH_3D = false;
GRAPH_3D.setValue(false);
AUTO.enable();
Position.forceDrivenPositioning();
MindMap.setCanDragEntity(true);
}
else{
Position.AUTO = true;
Position.GRAPH_3D = true;
Position.setRandomZ();
AUTO.setValue(true);
GRAPH_3D.setValue(true);
AUTO.disable();
Position.forceDrivenPositioning();
MindMap.get(MindMap.FOCUS_ID).centre();
MindMap.setCanDragEntity(false);
}
}
});
form.setFields(DEPTH,URL,load,local,centre,AUTO,GRAPH_3D);
addMember(new Label(Home.VERSION));
addMember(form);
if(!url.equals(""))