modelContext);
parentModelContext.setEntity(parentEntity);
parentModelContext
.setPropertyConfig(parentConceptPropertyConfig);
ViewContext parentViewContext = new ViewContext(
viewContext);
parentViewContext.setWicketId("valuePanel");
Panel parentPropertyValuePanel;
if (parentConceptPropertyConfig
.getPropertyClass().equals(
"java.net.URL")
|| parentConceptPropertyConfig
.getPropertyClass()
.equals(
"org.dmlite.type.email.Email")) {
parentPropertyValuePanel = new ExternalLinkPanel(
parentModelContext,
parentViewContext);
} else {
parentPropertyValuePanel = new LabelPanel(
parentModelContext,
parentViewContext);
}
if (!app.isNeighborDisplayAllowed(
getAppSession(), neighborConfig)) {
parentPropertyNameLabel.setVisible(false);
parentPropertyValuePanel.setVisible(false);
} else if (!app.isPropertyDisplayAllowed(
getAppSession(),
parentConceptPropertyConfig)) {
parentPropertyNameLabel.setVisible(false);
parentPropertyValuePanel.setVisible(false);
}
propertyNameLabelValuePanelPair
.setPropertyValuePanel(parentPropertyValuePanel);
propertyNameLabelValuePanelPairs
.add(propertyNameLabelValuePanelPair);
} // if
} // if
} // for
} // if
} // if
} // for
PropertiesConfig propertiesConfig = conceptConfig
.getPropertiesConfig();
for (IEntity config : propertiesConfig) {
PropertyConfig propertyConfig = (PropertyConfig) config;
String propertyCode = propertyConfig.getCode();
String propertyKey = conceptConfig.getCode() + "."
+ propertyCode;
String propertyName = getLocalizer().getString(propertyKey,
this);
PropertyNameLabelValuePanelPair propertyNameLabelValuePanelPair = new PropertyNameLabelValuePanelPair();
Label propertyNameLabel = new Label("propertyName",
propertyName);
propertyNameLabelValuePanelPair
.setPropertyNameLabel(propertyNameLabel);
ModelContext entityModelContext = new ModelContext(modelContext);
entityModelContext.setPropertyConfig(propertyConfig);
Panel propertyValuePanel;
if (propertyConfig.getPropertyClass().equals(
"java.lang.Boolean")) {
ViewContext checkBoxPanelContext = new ViewContext(
viewContext);
checkBoxPanelContext.setWicketId("valuePanel");
propertyValuePanel = new CheckBoxPanel(entityModelContext,
checkBoxPanelContext);
} else if (propertyConfig.getPropertyClass().equals(
"java.lang.String")
&& propertyConfig.getDisplayLengthInt() > App.MIN_LONG_TEXT_LENGTH) {
ViewContext textAreaPanelContext = new ViewContext(
viewContext);
textAreaPanelContext.setWicketId("valuePanel");
propertyValuePanel = new TextAreaPanel(entityModelContext,
textAreaPanelContext);
} else if (propertyConfig.isReference()) {
String neighborCode = propertyConfig.getReferenceNeighbor();
NeighborConfig neighborConfig = conceptConfig
.getNeighborsConfig().getNeighborConfig(
neighborCode);
String neighborConceptCode = neighborConfig
.getDestination();
IPersistentEntities persistentEntities = app.getDbContext()
.getPersistentModel().getPersistentEntry(
neighborConceptCode);
IOrderedEntities lookupEntities = null;
if (persistentEntities != null) {
lookupEntities = (IOrderedEntities) persistentEntities
.getEntities();
}
if (lookupEntities != null) {
ModelContext neighborModelContext = new ModelContext(
modelContext);
neighborModelContext.setPropertyConfig(propertyConfig);
neighborModelContext.setLookupEntities(lookupEntities);
ViewContext lookupViewContext = new ViewContext(
viewContext);
lookupViewContext.setWicketId("valuePanel");
if (neighborConfig.getMinInt() == 0) {
propertyValuePanel = new LookupEmptyPanel(
neighborModelContext, lookupViewContext);
} else {
propertyValuePanel = new LookupPanel(
neighborModelContext, lookupViewContext);
}
} else {
ViewContext textFieldPanelContext = new ViewContext(
viewContext);
textFieldPanelContext.setWicketId("valuePanel");
propertyValuePanel = new TextFieldPanel(entityModelContext,
textFieldPanelContext);
}
} else if (propertyConfig.isValidateType()
&& propertyConfig
.isValidatationTypeEntities(domainModel)) {
ViewContext dropDownChoicePanelContext = new ViewContext(
viewContext);
dropDownChoicePanelContext.setWicketId("valuePanel");
propertyValuePanel = new TypeValueDropDownChoicePanel(
entityModelContext, dropDownChoicePanelContext);
} else {
ViewContext textFieldPanelContext = new ViewContext(
viewContext);
textFieldPanelContext.setWicketId("valuePanel");
propertyValuePanel = new TextFieldPanel(entityModelContext,
textFieldPanelContext);
} // end if
if (!app.isPropertyDisplayAllowed(getAppSession(),
propertyConfig)) {
propertyNameLabel.setVisible(false);
propertyValuePanel.setVisible(false);
} else if (!app.isPropertyUpdateAllowed(getAppSession(),
propertyConfig)) {
ViewContext labelPanelContext = new ViewContext(viewContext);
labelPanelContext.setWicketId("valuePanel");
propertyValuePanel = new LabelPanel(entityModelContext,
labelPanelContext);
}
propertyNameLabelValuePanelPair
.setPropertyValuePanel(propertyValuePanel);
propertyNameLabelValuePanelPairs
.add(propertyNameLabelValuePanelPair);
} // end for
ListView propertyNameLabelValuePanelListView = new PropertyNameLabelValuePanelListView(
"propertyNameLabelValuePanelListView",
propertyNameLabelValuePanelPairs);
add(propertyNameLabelValuePanelListView);
if (!app.isConceptDisplayAllowed(getAppSession(), conceptConfig)) {
propertyNameLabelValuePanelListView.setVisible(false);
}
add(new Button("cancel") {
static final long serialVersionUID = 200721L;
protected void onSubmit() {
App app = viewContext.getApp();
ModelContext entityUpdateTablePageModelContext = new ModelContext(
modelContext);
entityUpdateTablePageModelContext.setUpdateEntity(null);
ViewContext entityUpdateTablePageViewContext = new ViewContext(
viewContext);
setResponsePage(app.getViewMeta().getPage(
"EntityUpdateTablePage",
entityUpdateTablePageModelContext,
entityUpdateTablePageViewContext));