use of com.github.bordertech.wcomponents.ComponentModel in project wcomponents by BorderTech.
the class ObjectGraphDump method visitComponentModel.
/**
* Visits all the fields in the given ComponentModel.
*
* @param node the ObjectGraphNode containing the ComponentModel.
*/
private void visitComponentModel(final ObjectGraphNode node) {
ComponentModel model = (ComponentModel) node.getValue();
ComponentModel sharedModel = null;
List<Field> fieldList = ReflectionUtil.getAllFields(node.getValue(), true, false);
Field[] fields = fieldList.toArray(new Field[fieldList.size()]);
for (int i = 0; i < fields.length; i++) {
if (ComponentModel.class.equals(fields[i].getDeclaringClass()) && "sharedModel".equals(fields[i].getName())) {
sharedModel = (ComponentModel) readField(fields[i], model);
break;
}
}
visitComplexTypeWithDiff(node, sharedModel);
}
use of com.github.bordertech.wcomponents.ComponentModel in project wcomponents by BorderTech.
the class UicStats method createStat.
/**
* Creates statistics for a component in the given context.
*
* @param comp the component.
* @return the stats for the given component in the given context.
*/
private Stat createStat(final WComponent comp) {
Stat stat = new Stat();
stat.setClassName(comp.getClass().getName());
stat.setName(comp.getId());
if (stat.getName() == null) {
stat.setName("Unknown");
}
if (comp instanceof AbstractWComponent) {
Object obj = AbstractWComponent.replaceWComponent((AbstractWComponent) comp);
if (obj instanceof AbstractWComponent.WComponentRef) {
stat.setRef(obj.toString());
}
}
ComponentModel model = (ComponentModel) uic.getModel(comp);
stat.setModelState(Stat.MDL_NONE);
if (model != null) {
if (comp.isDefaultState()) {
stat.setModelState(Stat.MDL_DEFAULT);
} else {
addSerializationStat(model, stat);
}
}
return stat;
}
Aggregations