示例#1
0
  /**
   * 构造每个bop的布局样式 R2(C2(bop1, bop2)) 或 R2(bop3, C2(bop1, bop2))
   * <li>1. 遍历表达式, 解析子元素;
   * <li>2. 遇到左括号,将R2, C2 表达式压入表达式栈顶;
   * <li>3. 遇到逗号, 如果栈不为空, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap; 如果栈为空, 直接略过;
   * <li>4. 遇到右括号, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap, 从表达式栈顶弹出一项.
   *
   * @param str
   */
  private void interpertFormCell(String str) {
    // 表达式栈, 存储 R1, C1, R2, C2等合并单元格的表达式
    Stack<String> stack = new Stack<String>();

    // 表达式的元素
    String atom = "";
    // 遍历表达式, 解析子元素
    for (int i = 0, length = str.length(); i < length; i++) {
      char ch = str.charAt(i);
      // 遇到左括号,将R2, C2 表达式压入表达式栈顶
      if (LEFT_BRACKET == ch) {
        stack.push(atom);
        atom = "";
      }
      // 遇到逗号, 如果栈不为空, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap;
      // 如果栈为空, 直接略过;
      else if (FC_SPLIT == ch) {
        if (ContainerUtil.isNotNull(stack)) formatCell(atom, stack);
        atom = "";
      }
      // 遇到右括号, 将栈中的所有表达式代表的含义赋予bop, 将bop压入cellMap, 从表达式栈顶弹出一项
      else if (RIGHT_BRACKET == ch) {
        if (StringUtils.isNotEmpty(atom)) formatCell(atom, stack);
        stack.pop();
        atom = "";
      } else {
        atom += ch;
      }
    }
  }
示例#2
0
  @Override
  public List<ProjectModuleBO> findModules(BOTemplate bot) {
    Element rootElement = getRootElement();
    if (rootElement == null) return null;

    List<Element> moduleElements = getElmentsByXpath(getXPath_ModuleAll(), rootElement);
    if (ContainerUtil.isNull(moduleElements)) return null;

    List<ProjectModuleBO> modules = new LinkedList<ProjectModuleBO>();
    for (Element element : moduleElements) {
      ProjectModuleBO module = convertElementToModule(element);

      if (bot == null || ContainerUtil.isNull(bot.getBotMap())) {
        modules.add(module);
        continue;
      }

      // 判断查询结果是否符合查询条件
      boolean inQuery = true;
      // 模块名称
      if (StringUtils.isNotEmpty((String) bot.getBotMap().get("moduleName"))) {
        if (!StringUtils.hasSubString(
            module.getModuleName(), bot.getBotMap().get("moduleName").toString())) {
          inQuery = false;
        }
      }
      // 开发人员
      if (inQuery && StringUtils.isNotEmpty((String) bot.getBotMap().get("developers"))) {
        if (!StringUtils.hasSubString(
            module.getDevelopers(), bot.getBotMap().get("developers").toString())) {
          inQuery = false;
        }
      }
      // 模块ID
      if (inQuery && StringUtils.isNotEmpty((String) bot.getBotMap().get("id"))) {
        if (!StringUtils.isEqual(module.getId() + "", bot.getBotMap().get("id").toString())) {
          inQuery = false;
        }
      }
      if (inQuery) modules.add(module);
    }

    return modules;
  }
示例#3
0
  /**
   * 变量影响表单中的控制组件状态
   *
   * @param btnList
   * @param simpleContainer
   * @param vcId
   * @param bcId
   */
  public static final void var2Btn(
      Map<String, CommandButton> btnList,
      SimpleContainer simpleContainer,
      String vcId,
      String bcId) {
    Map<String, SimpleBtn> simpleBtnList = simpleContainer.getBtnList();
    if (ContainerUtil.isNull(simpleBtnList) || ContainerUtil.isNull(btnList)) return;

    for (Entry<String, SimpleBtn> entry : simpleBtnList.entrySet()) {
      String btnName = VCUtil.createOperateName(vcId, bcId, entry.getKey());
      if (!btnList.containsKey(btnName)) continue;
      OperateBOP bop = btnList.get(btnName).getBc();
      if (bop == null) continue;

      bop.getStatus().setDisable(entry.getValue().isDisable());
      bop.getStatus().setHidden(entry.getValue().isHidden());
      bop.getStatus().setReadonly(entry.getValue().isReadonly());
    }
  }
示例#4
0
  /**
   * 变量影响表单中的细粒度组件的值、状态
   *
   * @param fcList
   * @param simpleContainer
   */
  public static final void var2FC(
      Map<String, FinegrainedComponent> fcList, SimpleContainer simpleContainer) {
    Map<String, SimpleFC> simpleFCList = simpleContainer.getFcList();
    if (ContainerUtil.isNull(simpleFCList) || ContainerUtil.isNull(fcList)) return;

    for (Entry<String, SimpleFC> entry : simpleFCList.entrySet()) {
      if (!fcList.containsKey(entry.getKey())) continue;
      BOProperty bop = fcList.get(entry.getKey()).getBc();
      if (bop == null) continue;

      if (entry.getValue().isDisable() != null)
        bop.getStatus().setDisable(entry.getValue().isDisable());
      if (entry.getValue().isHidden() != null)
        bop.getStatus().setHidden(entry.getValue().isHidden());
      if (entry.getValue().isReadonly() != null)
        bop.getStatus().setReadonly(entry.getValue().isReadonly());
      if (StringUtils.isNotEmpty(entry.getValue().getValueStr()))
        bop.setValue(entry.getValue().getValueStr());
    }
  }
示例#5
0
  @SuppressWarnings("unchecked")
  @Override
  public DemoMobileBaseBO find(String comparateId, Class<? extends DemoMobileBaseBO> calsz)
      throws Exception {
    QewebDetachedCriteria detachedCriteria =
        (QewebDetachedCriteria) QewebDetachedCriteria.forClass(calsz);
    detachedCriteria.add(Restrictions.eq("comparateId", comparateId));

    List<DemoMobileBaseBO> result = findByCriteria(detachedCriteria);

    return ContainerUtil.isNull(result) ? calsz.newInstance() : result.get(0);
  }
示例#6
0
  /**
   * 判断是否有枚举值
   *
   * @return
   */
  public boolean hasItems() {
    boolean result = false;

    Set<Range> rangeList = getBc().getRange().getRangeList();
    for (Range rang : rangeList) {
      if (rang instanceof EnumRange) {
        EnumRange enumRange = (EnumRange) rang;
        Map<String, String> map = enumRange.getResult();
        if (ContainerUtil.isNotNull(map)) result = true;
      }
    }

    return result;
  }
示例#7
0
  @SuppressWarnings("unchecked")
  @Override
  public DemoMobileBaseBO findSaveInfo(
      long shopId, long vistorId, Class<? extends DemoMobileBaseBO> calsz) throws Exception {
    QewebDetachedCriteria detachedCriteria =
        (QewebDetachedCriteria) QewebDetachedCriteria.forClass(calsz);
    detachedCriteria.add(Restrictions.eq("submitFlag", StringUtils.convertToInt(SubmitBOP.NO)));
    detachedCriteria.add(Restrictions.eq(IBaseDao.FIELD_DELETEFLAG, IBaseDao.UNDELETE_SIGNE));
    detachedCriteria.add(Restrictions.eq("shopBO.id", shopId));
    detachedCriteria.add(Restrictions.eq("visitor.id", vistorId));

    List<DemoMobileBaseBO> result = findByCriteria(detachedCriteria);

    return ContainerUtil.isNull(result) ? calsz.newInstance() : result.get(0);
  }
示例#8
0
  @SuppressWarnings("unchecked")
  @Override
  public void update(ProjectModuleBO module) {
    Element rootElement = getRootElement();
    if (rootElement == null) return;

    List<Element> elements = getElmentsByXpath(getXPath_ModuleId(module.getId()), rootElement);
    if (ContainerUtil.isNull(elements)) return;

    // 修改moduleElement节点
    Element moduleElement = elements.get(0);
    moduleElement.setAttribute(ATTR_NAME, module.getModuleName());
    moduleElement.setAttribute(ATTR_REMARK, module.getRemark());

    // 修改developers节点
    Element developElement = moduleElement.getChild(NODE_DEV);
    developElement.setAttribute(ATTR_ID, module.getDevelopers());

    // 修改package节点
    Element packageElement = moduleElement.getChild(NODE_PACKAGE);
    List<Element> childElements = packageElement.getChildren();
    for (Element packElement : childElements) {
      if (StringUtils.isEqual(NODE_SRC, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getSrcPackage());
      else if (StringUtils.isEqual(NODE_JSP, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getJspPackage());
      else if (StringUtils.isEqual(NODE_HBM, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getHbmPackage());
      else if (StringUtils.isEqual(NODE_SPRING, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getSpringPackage());
      else if (StringUtils.isEqual(NODE_PAGEFLOW, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getPageflowPackage());
      else if (StringUtils.isEqual(NODE_VAR, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getVarPackage());
      else if (StringUtils.isEqual(NODE_I18N, packElement.getName()))
        packElement.setAttribute(ATTR_NAME, module.getI18nPackage());
    }

    saveXML(rootElement);
  }