コード例 #1
0
ファイル: ViewDwr.java プロジェクト: mlavelle42/mango
  /**
   * Allows the setting of a given data point. Overrides BaseDwr to resolve the point view id.
   *
   * @param pointId
   * @param valueStr
   * @return
   */
  @MethodFilter
  public String setViewPoint(String viewComponentId, String valueStr) {
    User user = Common.getUser();
    View view = user.getView();
    DataPointVO point = view.findDataPoint(viewComponentId);

    if (point != null) {
      // Check that setting is allowed.
      int access = view.getUserAccess(user);
      if (!(access == ShareUser.ACCESS_OWNER || access == ShareUser.ACCESS_SET))
        throw new PermissionException("Not allowed to set this point", user);

      // Try setting the point.
      setPointImpl(point, valueStr, user);
    }

    return viewComponentId;
  }
コード例 #2
0
ファイル: ViewDwr.java プロジェクト: mlavelle42/mango
  private void addPointComponentState(
      ViewComponent viewComponent,
      RuntimeManager rtm,
      Map<String, Object> model,
      HttpServletRequest request,
      View view,
      User user,
      List<ViewComponentState> states,
      boolean edit,
      boolean add) {
    if (viewComponent.isPointComponent() && (edit || viewComponent.isVisible())) {
      PointComponent pointComponent = (PointComponent) viewComponent;

      DataPointRT dataPointRT = null;
      if (pointComponent.tgetDataPoint() != null)
        dataPointRT = rtm.getDataPoint(pointComponent.tgetDataPoint().getId());

      ViewComponentState state =
          preparePointComponentState(pointComponent, user, dataPointRT, model, request);

      if (!edit) {
        if (pointComponent.isSettable()) {
          int access = view.getUserAccess(user);
          if (access == ShareUser.ACCESS_OWNER || access == ShareUser.ACCESS_SET)
            setChange(pointComponent.tgetDataPoint(), state, dataPointRT, request, model);
        }

        if (pointComponent.tgetDataPoint() != null)
          setChart(pointComponent.tgetDataPoint(), state, request, model);
      }

      if (add) states.add(state);

      model.clear();
    }
  }