}
private Property getCellComplexProperty(WidgetInfo component) throws Exception {
ClassLoader editorLoader = JavaInfoUtils.getClassLoader(panel);
// "width"
GenericPropertyImpl widthProperty;
{
ExpressionAccessor expressionAccessor =
new CellExpressionAccessor(panel, "setCellWidth", "java.lang.String");
widthProperty =
new GenericPropertyImpl(component,
"width",
new ExpressionAccessor[]{expressionAccessor},
"",
StringConverter.INSTANCE,
StringPropertyEditor.INSTANCE);
}
// "height"
GenericPropertyImpl heightProperty;
{
ExpressionAccessor expressionAccessor =
new CellExpressionAccessor(panel, "setCellHeight", "java.lang.String");
heightProperty =
new GenericPropertyImpl(component,
"height",
new ExpressionAccessor[]{expressionAccessor},
"",
StringConverter.INSTANCE,
StringPropertyEditor.INSTANCE);
}
// "horizontalAlignment"
GenericPropertyImpl horizontalAlignmentProperty;
{
StaticFieldPropertyEditor propertyEditor = new StaticFieldPropertyEditor();
Class<?> hasHorizontalAlignmentClass =
editorLoader.loadClass("com.google.gwt.user.client.ui.HasHorizontalAlignment");
ExpressionAccessor expressionAccessor =
new CellExpressionAccessor(panel,
"setCellHorizontalAlignment",
"com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant");
propertyEditor.configure(hasHorizontalAlignmentClass, new String[]{
"ALIGN_LEFT",
"ALIGN_CENTER",
"ALIGN_RIGHT",
"ALIGN_DEFAULT"});
Object defaultValue =
ReflectionUtils.getFieldObject(hasHorizontalAlignmentClass, "ALIGN_DEFAULT");
horizontalAlignmentProperty =
new GenericPropertyImpl(component,
"horizontalAlignment",
new ExpressionAccessor[]{expressionAccessor},
defaultValue,
null,
propertyEditor);
}
// "verticalAlignment"
GenericPropertyImpl verticalAlignmentProperty;
{
StaticFieldPropertyEditor propertyEditor = new StaticFieldPropertyEditor();
Class<?> hasVerticalAlignmentClass =
editorLoader.loadClass("com.google.gwt.user.client.ui.HasVerticalAlignment");
propertyEditor.configure(hasVerticalAlignmentClass, new String[]{
"ALIGN_TOP",
"ALIGN_MIDDLE",
"ALIGN_BOTTOM"});
ExpressionAccessor expressionAccessor =
new CellExpressionAccessor(panel,
"setCellVerticalAlignment",
"com.google.gwt.user.client.ui.HasVerticalAlignment.VerticalAlignmentConstant");
Object defaultValue =
ReflectionUtils.getFieldObject(hasVerticalAlignmentClass, "ALIGN_TOP");
verticalAlignmentProperty =
new GenericPropertyImpl(component,
"verticalAlignment",
new ExpressionAccessor[]{expressionAccessor},
defaultValue,
null,
propertyEditor);