VariantType type =
(VariantType)selectedVariant.
getPropertyProxy(PolicyModel.VARIANT_TYPE).getModelObject();
ContentBuilder content =
(ContentBuilder) selectedVariant.
getPropertyProxy(PolicyModel.CONTENT).getModelObject();
handlingEvents = false;
setDefaultEnabledState();
if (type == VariantType.NULL) {
// We have a null asset
setNullCheckbox(true);
setEmbeddedCheckbox(false);
setEmbeddedText("");
setURLText("");
setBaseURL("");
setLayoutEnabled(false);
setFragmentName("");
setSegmentName("");
setThemeEnabled(false);
} else if (content == null) {
// We have a normal but probably uninitialised asset
setNullCheckbox(false);
setEmbeddedCheckbox(false);
setEmbeddedText("");
setURLText("");
setBaseURL("");
setLayoutEnabled(false);
setFragmentName("");
setSegmentName("");
setThemeEnabled(false);
} else {
// We have a normal asset
ContentBuilderVisitor updateDisplayVisitor = new ContentBuilderVisitor() {
public void visit(AutoURLSequenceBuilder content) {
// TODO later implement this
}
public void visit(EmbeddedContentBuilder content) {
setNullCheckbox(false);
setEmbeddedCheckbox(true);
setEmbeddedText(content.getData());
setURLText("");
setBaseURL("");
setLayoutEnabled(false);
setThemeEnabled(false);
}
public void visit(LayoutContentBuilder content) {
setNullCheckbox(false);
setEmbeddedCheckbox(false);
setEmbeddedText("");
setURLText("");
setBaseURL("");
setLayoutEnabled(true);
setThemeEnabled(false);
// Retrieve the default fragment/segment values where
// appropriate.
refreshTargets();
Layout layout = ((InternalLayoutContentBuilder)content).getLayout();
if (layout != null && layout.getDefaultFragmentName() != null) {
setFragmentName(layout.getDefaultFragmentName());
} else {
setFragmentName("");
}
if (layout != null && layout.getDefaultSegmentName() != null) {
setSegmentName(layout.getDefaultSegmentName());
} else {
setSegmentName("");
}
}
public void visit(ThemeContentBuilder content) {
setNullCheckbox(false);
setEmbeddedCheckbox(false);
setEmbeddedText("");
setURLText("");
setBaseURL("");
setLayoutEnabled(false);
setThemeEnabled(true);
boolean importParent = ((InternalThemeContentBuilder)content).getImportParent();
setImportParent(importParent);
}
public void visit(URLContentBuilder content) {
setNullCheckbox(false);
setEmbeddedCheckbox(false);
setEmbeddedText("");
setURLText(content.getURL());
setLayoutEnabled(false);
setThemeEnabled(false);
PolicyReference baseUrl = content.getBaseURLPolicyReference();
if (baseUrl != null && baseUrl.getName() != null) {
setBaseURL(baseUrl.getName());
} else {
setBaseURL("");
}
composite.setProperty(
PolicyModel.BASE_LOCATION, content.getBaseLocation());
}
};
((InternalContentBuilder) content).accept(updateDisplayVisitor);