Hi,
I am getting some other problems with this implementation. I have extended the example as shown below:
[code] package research;
import java.awt.Color;
import javax.swing.JApplet;
import com.mindfusion.jdiagram.Arrow; import com.mindfusion.jdiagram.AttachToNode; import com.mindfusion.jdiagram.Box; import com.mindfusion.jdiagram.FlowChart; import com.mindfusion.jdiagram.FlowChartAdapter; import com.mindfusion.jdiagram.Group; import com.mindfusion.jdiagram.Item; import com.mindfusion.jdiagram.ItemList; import com.mindfusion.jdiagram.ShadowsStyle; import com.mindfusion.jdiagram.SolidBrush; import com.mindfusion.jdiagram.ValidationEvent;
public class Goop extends JApplet { private static final long serialVersionUID = 1L;
private FlowChart flowChart;
@Override public void init() { super.init();
flowChart = new FlowChart(); flowChart.setSelectionOnTop(false); flowChart.setBackBrush(new SolidBrush(Color.WHITE)); flowChart.setShadowsStyle(ShadowsStyle.None); this.getContentPane().add(flowChart);
testContainment(); }
Box four, five;
private void testContainment() { Box three = new Box(flowChart); three.setBounds(5, 5, 90, 60);
Box one = new Box(flowChart); one.setBounds(10, 10, 15, 15);
Box two = new Box(flowChart); two.setBounds(40, 10, 15, 15);
four = new Box(flowChart); four.setBounds(60, 10, 15, 15);
five = new Box(flowChart); five.setBounds(160, 110, 15, 15);
flowChart.addFlowChartListener(new FlowChartAdapter() { @Override public void itemModifying(ValidationEvent e) { if (e.getItem() instanceof Box && e.getSelectionHandle() != 8) {
ItemList attachedItems = new ItemList();
if (e.getItem().getSubordinateGroup() == null) { return; }
for (Item item : ((Box) e.getItem()).getSubordinateGroup() .getAttachedItems()) { attachedItems.add(item); }
Group g = e.getItem().getSubordinateGroup(); for (Item item : attachedItems) { Box box = (Box)item;
if (box == four) { continue; }
for (Arrow a : box.getIncomingArrows()) if (g.getArrowsToMove().contains(a)) g.getArrowsToMove().remove(a);
for (Arrow a : box.getOutgoingArrows()) if (g.getArrowsToMove().contains(a)) g.getArrowsToMove().remove(a);
((Box) item).detach(); ((Box) item).cancelModify(item.getFlowChart().getInteraction()); } flowChart.recreateCacheImage(); } } });
flowChart.add(three); flowChart.add(one); flowChart.add(two); flowChart.add(four);
flowChart.add(five);
Arrow arrow = new Arrow(flowChart, one, two); flowChart.add(arrow); one.attachTo(three, AttachToNode.TopCenter); two.attachTo(three, AttachToNode.TopCenter); four.attachTo(three, AttachToNode.TopCenter); } }
[/code]
Resize the biggest box (the one which contains the the three boxes).
The box to the bottom right disappears.
If I remove
[code] flowChart.recreateCacheImage(); [/code]
the symbol stops disappearing.
Is that line really required, or can I lose it?
|