public State mouseReleased(Widget widget, WidgetMouseEvent event) {
    if (mEditNode == null) {
      return State.REJECTED;
    }
    if (widget instanceof ImageWidget) {
      ((ImageWidget) widget).setPaintAsDisabled(false);
    }
    final PropertySheet propertySheetPanel = new PropertySheet();
    final Node editNodeRef = mEditNode;
    mEditNode = null;

    propertySheetPanel.setNodes(new Node[] {editNodeRef});
    final Object[] options = new Object[] {Constants.CLOSE};
    final DialogDescriptor descriptor =
        new DialogDescriptor(
            propertySheetPanel,
            NbBundle.getMessage(getClass(), "STR_PROPERTIES", editNodeRef.getDisplayName()),
            true,
            options,
            null,
            DialogDescriptor.DEFAULT_ALIGN,
            null,
            null);
    descriptor.setClosingOptions(options);

    final Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);

    // The dialog is modal, allow the action chain to continue while
    // we open the dialog later.
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            dlg.setVisible(true);
          }
        });

    return State.CONSUMED;
  }
  public State mousePressed(Widget widget, WidgetMouseEvent event) {
    mEditNode = null;

    if (event.getButton() != MouseEvent.BUTTON1) {
      return State.REJECTED;
    }
    if (!(widget instanceof ImageWidget)) {
      return State.REJECTED;
    }
    ((ImageWidget) widget).setPaintAsDisabled(true);
    while (widget instanceof CasaNodeWidget) {
      widget = widget.getParentWidget();
    }
    CasaModelGraphScene scene = (CasaModelGraphScene) widget.getScene();
    CasaComponent casaComponent = (CasaComponent) scene.findObject(widget);
    if (casaComponent == null) {
      return State.REJECTED;
    }
    mEditNode = scene.getNodeFactory().createNodeFor(casaComponent);
    if (mEditNode == null) {
      return State.REJECTED;
    }
    return State.CONSUMED;
  }