コード例 #1
0
  @Override
  public void activate() {
    super.activate();
    pictogramContainerFigure = new PictogramContainerFigure();
    for (final Pictogram pictogram : getPictograms()) {
      final PictogramFigure pictogramFigure = new PictogramFigure(pictogram, getHost().getFigure());
      pictogramFigures.put(pictogram, pictogramFigure);
      pictogramContainerFigure.add(pictogramFigure);
      figureListeners.put(
          pictogramFigure,
          new MouseListener() {

            public void mouseDoubleClicked(final MouseEvent event) {}

            public void mousePressed(final MouseEvent event) {
              executePictogramHandler(pictogram, event);
            }

            public void mouseReleased(final MouseEvent event) {}
          });
      pictogramFigure.addMouseListener(figureListeners.get(pictogramFigure));
    }
    // add pictogram figure to layer, keep it attached to the original
    // figure using a locator
    getFeedbackLayer().add(pictogramContainerFigure);
    registerFigureListener(hostFigureListener);
    registerAncestorListener(hostFigureAncestorListener);
    registerSemanticModelListener(modelListener);
    registerGraphModelListener(modelListener);
    layoutPictogramContainer();
    if (getHost().resolveSemanticElement() != null) {
      updatePictogramFigureStates();
    }
  }
コード例 #2
0
 @Override
 public void deactivate() {
   unregisterGraphModelListener(modelListener);
   unregisterSemanticModelListener(modelListener);
   unregisterFigureListener(hostFigureListener);
   unregisterAncestorListener(hostFigureAncestorListener);
   getFeedbackLayer().remove(pictogramContainerFigure);
   for (final Pictogram pictogram : getPictograms()) {
     final PictogramFigure pictogramFigure = pictogramFigures.get(pictogram);
     pictogramFigure.removeMouseListener(figureListeners.get(pictogramFigure));
   }
   super.deactivate();
 }