Exemplo n.º 1
0
 public Component getListCellRendererComponent(
     JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
   JComponent c =
       (JComponent)
           render.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
   c.setBorder(null);
   JCheckBox lab = new JCheckBox();
   ListElement le = (ListElement) value;
   // if("r1-print".equals(le.getCategory()))
   //
   // lab.setIcon(ResourceManager.getIcon(com.kingdee.bos.ctrl.report.forapp.kdnote.client.ui.NoteFileDialogEx.class, "res.r1_print.gif"));
   // else
   //
   // lab.setIcon(ResourceManager.getIcon(com.kingdee.bos.ctrl.report.forapp.kdnote.client.ui.NoteFileDialogEx.class, "res/empty.gif"));
   lab.setSelected(le.isSelected());
   lab.setOpaque(true);
   lab.setBackground(c.getBackground());
   TableLayout tl = TableLayout.splitCol(2);
   tl.colStyle(0).setWidth(22);
   tl.colStyle(1).setPriX(1);
   KDPanel pan = new KDPanel(tl);
   pan.add(lab, tl.cell(0));
   pan.add(c, tl.cell(1));
   return pan;
 }
Exemplo n.º 2
0
 public String[] getNoteNameEx() {
   Vector<String> vec = new Vector<String>();
   for (int i = 0; i < _lstFile.getElementCount(); i++) {
     ListElement le = (ListElement) _lstFile.getElement(i);
     if (le.isSelected()) vec.add(le.getName());
   }
   return PublicUtils.vectorToString(vec);
 }
Exemplo n.º 3
0
  public void setNoteName(String noteName) {
    int idx = 0;
    int i = 0;
    for (int c = _lstFile.getElementCount() - 1; i < c; i++) {
      ListElement le = (ListElement) _lstFile.getElement(i);
      if (StringUtil.equalsIgnoreCase(le.getName(), noteName)) idx = i;
    }

    _lstFile.setSelectedIndex(idx);
    super.btnOk.setEnabled(idx != -1);
  }
Exemplo n.º 4
0
  private void refreshTemplateList() {
    TreeUINode selectedNode = _tree.getTreeUI().getSelectionNode();
    HashMap cacheValues = (HashMap) selectedNode.getUserObject();
    super.btnOk.setEnabled(false);
    _lstFile.removeAllElements();
    HashMap vals = null;
    if (cacheValues == null) {
      if (selectedNode.isChildrenLoaded()) return;
      vals = expandNode(selectedNode, getNoteDir());
    } else {
      vals = cacheValues;
    }
    if (vals == null) return;
    String names[] = (String[]) (String[]) vals.get("name");
    String alias[] = (String[]) (String[]) vals.get("alias");
    String categories[] = (String[]) (String[]) vals.get("category");
    String orgss[] = (String[]) (String[]) vals.get("eas_template_relation_orgs");
    if (names != null && log.isDebugEnabled())
      log.debug((new StringBuilder()).append("entries:").append(names.length).toString());
    boolean doFilter = _rightPanel.cbUseOrgFilter.isSelected();
    int idxKDFStart = 0;
    IBizContent bizCtn = _tree.getBizContent();
    for (int i = 0; i < names.length; i++) {
      boolean isKDF = "kdrs-form".equals(categories[i]);
      boolean isR1 = "r1-print".equals(categories[i]);
      if (!isKDF && !isR1 || !_rightPanel.lang.equal(Language.readTempLang(names[i])) && !isKDF)
        continue;
      try {
        boolean isCanUse =
            NoteUseUtil.isCanUse(
                bizCtn,
                (new StringBuilder())
                    .append(((ResObjectNode) selectedNode).getResPath())
                    .append("/")
                    .append(names[i])
                    .toString());
        if (!isCanUse) continue;
      } catch (KDRSException ex) {
        log.debug(
            (new StringBuilder())
                .append(selectedNode)
                .append("获取属性:NoteUseUtil.")
                .append("user_enabled_users")
                .append("失败")
                .toString());
        continue;
      }
      if (doFilter
          && (orgss[i] == null
              || orgss[i].length() == 0
              || orgss[i].indexOf(NoteUtil.getCurrentOrgUnitId()) == -1)) {
        if (log.isDebugEnabled())
          log.debug(
              (new StringBuilder())
                  .append("ignore teplate/r1templat:")
                  .append(names[i])
                  .toString());
        continue;
      }
      ListElement element = new ListElement(names[i], alias[i], categories[i]);
      element.setSeleted(true);
      int idx = idxKDFStart;
      if (isR1) {
        int j = 0;
        do {
          if (j >= idxKDFStart) break;
          if (element.compareTo(_lstFile.getElement(j)) < 0) {
            idx = j;
            break;
          }
          j++;
        } while (true);
        idxKDFStart++;
      } else if (isKDF) {
        int j = _lstFile.getElementCount() - 1;
        do {
          if (j < idxKDFStart) break;
          if (element.compareTo(_lstFile.getElement(j)) > 0) {
            idx = j + 1;
            break;
          }
          j--;
        } while (true);
      }
      _lstFile.insertElement(element, idx);
    }

    if (_lstFile.getElementCount() > 0) _lstFile.setSelectedIndex(0);
    btnOk.setEnabled(_lstFile.getSelectedIndex() != -1);
  }
Exemplo n.º 5
0
  public String getNoteAlias() {
    ListElement le = (ListElement) _lstFile.getSelectedValue();

    if (le != null) return le.getAlias();
    else return null;
  }