コード例 #1
0
 /**
  * Show the compartment, adjust height according to the blockd procedures
  *
  * @param rectangleFigure
  * @param blockExtendedEditPart
  */
 protected void show(
     RectangleFigure rectangleFigure, BlockExtendedEditPart blockExtendedEditPart) {
   rectangleFigure.setVisible(true);
   Block block = (Block) (((View) blockExtendedEditPart.getModel()).getElement());
   if (block.getProcedures().size() <= 1) {
     BoundsRefreshment.refreshBounds(blockExtendedEditPart, null, 89);
   } else {
     BoundsRefreshment.refreshBounds(
         blockExtendedEditPart, null, 89 + ((block.getProcedures().size() - 1) * 45));
   }
   blockExtendedEditPart.putInnerMargin();
 }
コード例 #2
0
    @Override
    public void mousePressed(MouseEvent me) {

      EditPart root = editPart;
      while (root.getParent() instanceof BlockExtendedEditPart) {
        root = root.getParent();
      }
      // getting compartment holder figure
      BlockExtendedEditPart blockExtendedEditPart = (BlockExtendedEditPart) root;
      BlockFigure primaryShape = blockExtendedEditPart.getPrimaryShape();
      RectangleFigure rectangleFigure = (RectangleFigure) primaryShape.getChildren().get(1);

      // based on visibility status, hide or show the compartment
      if (rectangleFigure.isVisible()) {
        hide(rectangleFigure, blockExtendedEditPart);
      } else {
        show(rectangleFigure, blockExtendedEditPart);
      }
    }
コード例 #3
0
 /**
  * Hide the compartment, decrease the height to only show title of block
  *
  * @param rectangleFigure
  * @param blockExtendedEditPart
  */
 protected void hide(
     RectangleFigure rectangleFigure, BlockExtendedEditPart blockExtendedEditPart) {
   rectangleFigure.setVisible(false);
   BoundsRefreshment.refreshBounds(blockExtendedEditPart, null, 35);
   blockExtendedEditPart.clearBottomMargin();
 }