Exemplo n.º 1
0
  @Override
  protected void updateLayoutPreference() {
    super.updateLayoutPreference();
    if (!(((DesignElementHandle) getModel()).getModuleHandle() instanceof ReportDesignHandle)) {
      return;
    }

    ReportDesignHandle handle =
        (ReportDesignHandle) ((DesignElementHandle) getModel()).getModuleHandle();
    String str = handle.getLayoutPreference();

    if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_AUTO_LAYOUT.equals(str)) {
      getContentPane().setLayoutManager(new TableLayout(this));
    } else if (DesignChoiceConstants.REPORT_LAYOUT_PREFERENCE_FIXED_LAYOUT.equals(str)) {
      getContentPane().setLayoutManager(new FixTableLayout(this));
    }
  }
Exemplo n.º 2
0
  protected void contentChange(Map info) {
    Object action = info.get(GraphicsViewModelEventProcessor.CONTENT_EVENTTYPE);
    if (action instanceof Integer) {
      int intValue = ((Integer) action).intValue();
      if (intValue == ViewsContentEvent.ADD
          || intValue == ViewsContentEvent.SHIFT
          || intValue == ViewsContentEvent.REMOVE) {
        if (((ReportItemHandle) getModel()).getViews().size() > 0) {
          final Object tempModel = getModel();
          final DeferredGraphicalViewer viewer = (DeferredGraphicalViewer) getViewer();
          markDirty(true);
          EditPart part = getParent();
          ((ReportElementEditPart) getParent()).removeChild(this);
          part.refresh();
          removeGuideFeedBack();
          Display.getCurrent()
              .asyncExec(
                  new Runnable() {

                    public void run() {
                      Object part = viewer.getEditPartRegistry().get(tempModel);
                      if (part != null) {
                        viewer.setSelection(new StructuredSelection(part));
                      }
                    }
                  });
          return;
        } else {
          ((ReportElementEditPart) getParent()).contentChange(info);
          return;
        }
      }
    }
    List old = new ArrayList(getChildren());
    super.contentChange(info);
    List newChildren = getChildren();
    for (int i = 0; i < old.size(); i++) {
      if (newChildren.contains(old.get(i))) {
        ((AbstractCellEditPart) old.get(i)).updateExistPart();
      }
    }
  }