";
} else if ("com.smartgwt.client.widgets.Img".equals(value)) {
return "
 + defaults.getAttribute("src")) +
")
";
} else {
return null;
}
}
}
private static Record[] getTilePaletteData() {
PaletteNode blueComponent = new PaletteNode();
// Title as you want it to appear in the list
blueComponent.setTitle("Blue Canvas");
// type indicates the class of object to create for
// this component
blueComponent.setType("com.smartgwt.client.widgets.Canvas");
// defaults specifies the properties to use when
// creating the component
Canvas blueDefaults = new Canvas();
blueDefaults.setBackgroundColor("blue");
// By default, the EditPane will persist coordinates
// so setting canDrag and canDragResize is enough
// to allow simple editing of coordinates. You can
// turn the persistence of coordinates off in EditPane
// if you want to allow for editing them in a different
// way.
blueDefaults.setCanDragReposition(true);
blueDefaults.setCanDragResize(true);
blueDefaults.setKeepInParentRect(true);
blueDefaults.setDragAppearance(DragAppearance.TARGET);
blueComponent.setCanvasDefaults(blueDefaults);
PaletteNode redComponent = new PaletteNode();
redComponent.setTitle("Red Canvas");
redComponent.setType("com.smartgwt.client.widgets.Canvas");
Canvas redDefaults = new Canvas();
redDefaults.setBackgroundColor("red");
redDefaults.setCanDragReposition(true);
redDefaults.setCanDragResize(true);
redDefaults.setKeepInParentRect(true);
redDefaults.setDragAppearance(DragAppearance.TARGET);
redComponent.setCanvasDefaults(redDefaults);
PaletteNode alligatorComponent = new PaletteNode();
alligatorComponent.setTitle("Alligator");
alligatorComponent.setType("com.smartgwt.client.widgets.Img");
Img alligatorDefaults = new Img();
alligatorDefaults.setCanDragReposition(true);
alligatorDefaults.setCanDragResize(true);
alligatorDefaults.setKeepInParentRect(true);
alligatorDefaults.setDragAppearance(DragAppearance.TARGET);
alligatorDefaults.setSrc("tiles/images/Alligator.jpg");
alligatorComponent.setCanvasDefaults(alligatorDefaults);
PaletteNode anteaterComponent = new PaletteNode();
anteaterComponent.setTitle("Anteater");
anteaterComponent.setType("com.smartgwt.client.widgets.Img");
Img anteaterDefaults = new Img();
anteaterDefaults.setCanDragReposition(true);
anteaterDefaults.setCanDragResize(true);
anteaterDefaults.setKeepInParentRect(true);
anteaterDefaults.setDragAppearance(DragAppearance.TARGET);
anteaterDefaults.setSrc("tiles/images/AntEater.jpg");
anteaterComponent.setCanvasDefaults(anteaterDefaults);
return new Record[] {
redComponent, blueComponent, alligatorComponent, anteaterComponent
};
}
}