protected JPanel boxComponent(final ActivityDesigner designer){
Component comp = designer.getComponent();
JPanel compPanel;
ProxyPanel innerPanel= new ProxyPanel();
innerPanel.setArrowReceiveOrNot(!(designer instanceof ComplexActivityDesigner));
if (isVertical) {
innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
innerPanel.add(comp);
innerPanel.add(new Separator(true));
} else {
innerPanel.setLayout(new BorderLayout(0, 0));
innerPanel.add("West", comp);
innerPanel.add("Center", new HorizontalSeparator());
innerPanel.add("South", new PlaceHolder(new Dimension(30,5), true){
public void onDropped() {
setSelected(false);
Vector selectedComps = ActivityDesignerListener
.getSelectedComponents();
if (selectedComps != null) {
int where = designer.getParentDesigner().indexOf(
designer);
insertActivityDesigners(selectedComps, where+1);
}
}
});
innerPanel.add("North", new PlaceHolder(new Dimension(30,5), true){
public void onDropped() {
setSelected(false);
Vector selectedComps = ActivityDesignerListener
.getSelectedComponents();
if (selectedComps != null) {
int where = designer.getParentDesigner().indexOf(
designer);
insertActivityDesigners(selectedComps, where);
}
}
});
}
ArrowLabel startArrowLabel = new ArrowLabel() {
public void onDropped() {
Vector selectedComps = ActivityDesignerListener
.getSelectedComponents();
if (selectedComps != null) {
if (designer instanceof SequenceActivityDesigner) {
((SequenceActivityDesigner) designer)
.insertActivityDesigners(selectedComps, 0);
} else {
// ActivityDesigner droppingActivity =
// ((ActivityDesigner)selectedComps.elementAt(0));
SequenceActivity wrapperActivity = new SequenceActivity();
SequenceActivityDesigner wrapperActivityDesigner =
(SequenceActivityDesigner) wrapperActivity.createDesigner();
wrapperActivityDesigner.onDropped(selectedComps);
int where = designer.getParentDesigner().indexOf(
designer);
Vector compBag = new Vector();
compBag.add(designer);
wrapperActivityDesigner.onDropped(compBag);
selectedComps = new Vector();
selectedComps.add(wrapperActivityDesigner);
insertActivityDesigners(selectedComps, where);
}
}
setSelected(false);
}
};
ArrowLabel endArrowLabel = new ArrowLabel() {
public void onDropped() {
Vector selectedComps = ActivityDesignerListener
.getSelectedComponents();
if (selectedComps != null) {
if (designer instanceof SequenceActivityDesigner) {
designer.onDropped(selectedComps);
} else {
// ActivityDesigner droppingActivity =
// ((ActivityDesigner)selectedComps.elementAt(0));
SequenceActivity wrapperActivity = new SequenceActivity();
ActivityDesigner wrapperActivityDesigner = wrapperActivity
.createDesigner();
int where = designer.getParentDesigner().indexOf(
designer);
Vector compBag = new Vector();
compBag.add(designer);
wrapperActivityDesigner.onDropped(compBag);
wrapperActivityDesigner.onDropped(selectedComps);
selectedComps = new Vector();
selectedComps.add(wrapperActivityDesigner);
insertActivityDesigners(selectedComps, where);
}
}
setSelected(false);
}
};
if (isVertical) {
compPanel = new ProxyPanel();
compPanel.setLayout(new BoxLayout(compPanel, BoxLayout.Y_AXIS));
compPanel.add(startArrowLabel);
compPanel.add(innerPanel);
compPanel.add(endArrowLabel);
} else {
compPanel = new ProxyPanel(new BorderLayout(0, 0));
compPanel.add("West", startArrowLabel);
compPanel.add("Center", innerPanel);
compPanel.add("East", endArrowLabel);
}