Esempio n. 1
0
  public void onCreateViewContent(BuildSession session, ViewContext context) throws IOException {
    super.onCreateViewContent(session, context);
    CompositeMap view = context.getView();
    Map map = context.getMap();

    Integer width = (Integer) map.get(ComponentConfig.PROPERTITY_WIDTH);
    map.put(InputFieldConfig.PROPERTITY_INPUTWIDTH, new Integer(width.intValue() - 23));

    LovConfig lc = LovConfig.getInstance(view);

    //		addConfig(LovConfig.PROPERTITY_LOV_URL, lc.getLovUrl());
    //		addConfig(LovConfig.PROPERTITY_TITLE, lc.getTitle());
    //		addConfig(LovConfig.PROPERTITY_VALUE_FIELD, lc.getValueField());
    //		addConfig(LovConfig.PROPERTITY_DISPLAY_FIELD, lc.getDisplayField());
    //		addConfig(LovConfig.PROPERTITY_LOV_MODEL, lc.getLovModel());
    //		addConfig(LovConfig.PROPERTITY_LOV_SERVICE, lc.getLovService());
    //		addConfig(LovConfig.PROPERTITY_LOV_WIDTH, new Integer(lc.getLovWidth()));
    //		addConfig(LovConfig.PROPERTITY_LOV_AUTO_QUERY, new Boolean(lc.getLovAutoQuery()));
    //		addConfig(LovConfig.PROPERTITY_LOV_LABEL_WIDTH, new Integer(lc.getLovLabelWidth()));
    //		addConfig(LovConfig.PROPERTITY_LOV_HEIGHT, new Integer(lc.getLovHeight()));
    //		addConfig(LovConfig.PROPERTITY_LOV_GRID_HEIGHT, new Integer(lc.getLovGridHeight()));
    //		addConfig(LovConfig.PROPERTITY_FETCH_REMOTE, new Boolean(lc.getFetchRemote()));
    //		addConfig(LovConfig.PROPERTITY_FETCH_SINGLE, new Boolean(lc.getFetchSingle()));
    //
    //		String renderer = lc.getAutocompleteRenderer();
    //		if(renderer != null)addConfig(LovConfig.PROPERTITY_AUTOCOMPLETE_RENDERER, renderer);
    map.put(CONFIG, getConfigString());
  }
Esempio n. 2
0
  private void init(BuildSession session, ViewContext view_context) throws Exception {
    CompositeMap context = ServiceThreadLocal.getCurrentThreadContext();
    if (context == null)
      throw new IllegalStateException("No service context set in ThreadLocal yet");
    CompositeMap view = view_context.getView();
    CompositeMap base_model = view_context.getModel();
    HTMLIncludeConfig hic = HTMLIncludeConfig.getInstance(view);
    String path = TextParser.parse(hic.getPath(), base_model);
    version = TextParser.parse(hic.getVersion(), base_model);
    if (null != path && !path.isEmpty()) {
      int begin = path.indexOf("/release");
      if (begin < 0) return;
      path = path.substring(begin, path.length());
      articlePath = "../.." + path;
      sourcePath =
          session.getContextPath() + path.replaceAll("\\\\", "/").replaceAll("(.*/)[^/]*$", "$1");
      return;
    }
    String pathField = hic.getPathField();
    String model = hic.getModel();
    CompositeMap params = hic.getParams();
    Map map = new HashMap();
    if (null != params) {
      Iterator pit = params.getChildIterator();
      while (pit.hasNext()) {
        CompositeMap param = (CompositeMap) pit.next();
        map.put(
            param.get("name"),
            TextParser.parse((String) param.get("value"), view_context.getModel()));
      }
    }
    BusinessModelService service = factory.getModelService(model, context);

    CompositeMap resultMap = service.queryAsMap(map);
    if (null == resultMap || null == resultMap.getChilds()) {
      throw new ClassNotFoundException("文章未找到,输入的路径不正确。");
    }
    Iterator it = resultMap.getChildIterator();
    while (it.hasNext()) {
      path = ((CompositeMap) it.next()).getString(pathField);
      if (null != path) {
        articlePath = "../.." + path;
        sourcePath =
            session.getContextPath() + path.replaceAll("\\\\", "/").replaceAll("(.*/)[^/]*$", "$1");
        break;
      }
    }
  }
Esempio n. 3
0
 public void onCreateOptionBuilder(BuildSession session, ViewContext context) {
   context.setInstance(IOptionBuilder.class, new SelectOptionRenderer());
 }