final Document doc = this.xulDomContainer.getDocumentRoot();
final DefaultBindingFactory bindingFactory = new DefaultBindingFactory();
bindingFactory.setDocument(doc);
bindingFactory.setBindingType(Binding.Type.BI_DIRECTIONAL);
wrapper = new DrillDownModelWrapper(model);
final XulComponent pathElement = doc.getElementById("path");//NON-NLS
if (pathElement != null)
{
bindingFactory.createBinding(wrapper, DrillDownModel.DRILL_DOWN_PATH_PROPERTY, "path", "value");//NON-NLS
}
final XulComponent configElement = doc.getElementById("config");//NON-NLS
if (configElement != null)
{
bindingFactory.createBinding(wrapper, DrillDownModel.DRILL_DOWN_CONFIG_PROPERTY, "config", "value");//NON-NLS
}
final XulComponent linkTargetElement = doc.getElementById("link-target");//NON-NLS
if (linkTargetElement != null)
{
bindingFactory.createBinding(wrapper, DrillDownModel.TARGET_FORMULA_PROPERTY, "link-target", "value");//NON-NLS
}
final XulComponent linkTooltipElement = doc.getElementById("link-tooltip");//NON-NLS
if (linkTooltipElement != null)
{
bindingFactory.createBinding(wrapper, DrillDownModel.TOOLTIP_FORMULA_PROPERTY, "link-tooltip", "value");//NON-NLS
}
final XulComponent previewElement = doc.getElementById("preview");//NON-NLS
if (previewElement != null)
{
final BindingFactory singleSourceBinding = new DefaultBindingFactory();
singleSourceBinding.setBindingType(Binding.Type.ONE_WAY);
singleSourceBinding.setDocument(doc);
singleSourceBinding.createBinding(wrapper, "preview", "preview", "value");//NON-NLS
}
// we manage the binding between the table and the outside world manually
wrapper.refresh();
final XulComponent paramTableElement = doc.getElementById("parameter-table");//NON-NLS
if (paramTableElement instanceof XulDrillDownParameterTable)
{
final XulDrillDownParameterTable parameterTable = (XulDrillDownParameterTable) paramTableElement;
table = parameterTable.getTable();
table.setExtraFields(fields);
table.setReportDesignerContext(reportDesignerContext);
table.setDrillDownParameter(model.getDrillDownParameter());
table.addPropertyChangeListener(DrillDownParameterTable.DRILL_DOWN_PARAMETER_PROPERTY, new TableModelBinding());
}
if (model.isLimitedEditor())
{
final XulComponent tooltipAndTargetElement = doc.getElementById("tooltip-and-target-panel");//NON-NLS
if (tooltipAndTargetElement != null)
{
tooltipAndTargetElement.setVisible(false);
}
}
SwingUtilities.invokeLater(new RefreshParameterTask());
}