*/
public LabelPanel(final ModelContext modelContext,
final ViewContext viewContext) {
super(viewContext.getWicketId());
try {
IEntity entity = modelContext.getEntity();
PropertyConfig propertyConfig = modelContext.getPropertyConfig();
boolean shortContext = false;
if (!viewContext.getMoreArgs().isEmpty()) {
Boolean shortTextBoolean = (Boolean) viewContext.getMoreArgs()
.get("shortText");
shortContext = shortTextBoolean.booleanValue();
}
String propertyCode = propertyConfig.getCode();
Class propertyClass = propertyConfig.getPropertyClassObject();
String propertyValueText = "";
if (entity != null) {
if (propertyConfig.isReference()) {
String neighborCode = propertyConfig.getReferenceNeighbor();
NeighborConfig neighborConfig = entity.getConceptConfig()
.getNeighborsConfig().getNeighborConfig(
neighborCode);
String neighborConceptCode = neighborConfig
.getDestination();
App app = (App) getApplication();
IPersistentEntities persistentEntities = app.getDbContext()
.getPersistentModel().getPersistentEntry(
neighborConceptCode);
IOrderedEntities neighborEntities = null;
if (persistentEntities != null) {
neighborEntities = (IOrderedEntities) persistentEntities
.getEntities();
}
if (neighborEntities != null) {
Long referenceOid = (Long) entity
.getProperty(propertyCode);
Oid neighborParentOid = new Oid(referenceOid);
IEntity neighborParent = neighborEntities
.retrieveByOid(neighborParentOid);
if (neighborParent != null) {
PropertyConfig uniquelPropertyConfig = neighborParent
.getConceptConfig().getPropertiesConfig()
.getFirstUniquePropertyConfig();
if (uniquelPropertyConfig != null
&& uniquelPropertyConfig.getPropertyClass()
.equals("java.lang.String")) {
propertyValueText = (String) neighborParent
.getProperty(uniquelPropertyConfig
.getCode());
}
}
}