Hi community,
I seem to have a problem with the paintarea component.
What I'm trying to accomplish is, adding PAINTAREAPANEITEMComponentTag
to the paintarea from within my program. This works so far.
Then I'm serializing my Objects to XML for later restoring the state.
When I'm re-opening my page and initialize it with the previous objects,
the PAINTAREAPANEITEMs won't show until I call the "update" method again.
The update method is basically the one from the demo workplace and is called after the initialization in the constructor.
Code:
private void updateDesignArea()
{
if (m_designArea == null) return;
m_designArea.getChildren().clear();
for (int i=0; i<m_shapeInstances.size(); i++)
{
String expression = "#{wp.DemoShape.shapeInstances["+i+"]}";
expression = getOwningDispatcher().updateExpression(expression);
PAINTAREAITEMComponentTag pit = new PAINTAREAITEMComponentTag();
pit.setBgpaint(expression.replace("}",".bgpaint}"));
pit.setBounds(expression.replace("}",".bounds}"));
pit.setDragsend("shapeinstance:"+i);
pit.setDropreceive("shapeinstance");
pit.setActionListener(expression.replace("}",".onInstanceAction}"));
pit.setInvokeevent("click");
pit.setResizingenabled("true");
m_designArea.getChildren().add(pit.createBaseComponent());
}
for (int i=0; i<m_lineInstances.size(); i++)
{
String expression = "#{wp.DemoShape.lineInstances["+i+"]}";
expression = getOwningDispatcher().updateExpression(expression);
PAINTAREALINEITEMComponentTag pilt = new PAINTAREALINEITEMComponentTag();
pilt.setBounds(expression.replace("}",".bounds}"));
pilt.setLinecolor("#808080");
m_designArea.getChildren().add(pilt.createBaseComponent());
}
So when I call this method in the constructor after I added my items to the instances list, it won't show the items. But if I call it again, once the page is completely initialized (i.e. via a button) the items will be rendered just fine.
I already tried calling the method via the beanprocessing but none of the phases seem to solve the problem.
I hope this is not too confusing.
Looking forward to any comments.
Kind regards
Steffen