Esempio n. 1
0
  /** 查询 */
  private void search() {
    // 调用查询窗口
    Function function = new Function();
    Search search = new Search(this, staffInfo);
    function.setFunctionDialog(search);
    function.create();
    if (search.isUpdate()) {
      int searched = search.getSearched();

      switch (searched) {
        case 0:
          DMManage();
          break;
        case 1:
          break;
        case 3:
          break;
        case 4:
          break;
        case 5:
          break;
      }
      content = search.getResultContent();
      header = search.getResultHeader();
      displayPanel.setBorder(
          BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "查询结果"));
      setTable(content, header);
    }
  }
Esempio n. 2
0
  /** 人员管理 */
  private void DMManage() {
    print.setEnabled(true);
    printAction.setEnabled(true);

    // 删除原有内容
    if (displayPanel != null && tips != null) {
      contentPanel.remove(displayPanel);
      contentPanel.remove(tips);
      validate();
      repaint();
    }

    staffContent = GetInfo.getStaffInfo();
    staffTitle = GetInfo.getStaffTitle();

    content = VectorFilter.doubleFilter(VectorFilter.STAFFFILTER, staffContent);
    content = VectorFilter.dataFilter(1, staffInfo.getStaffName(), content); // 过滤自己
    content = VectorFilter.positionFilter(4, "部门经理", content); // 过滤得到部门经理
    header = VectorFilter.singleFilter(VectorFilter.STAFFFILTER, staffTitle);

    // 建立显示区面板
    displayPanel = new JPanel(new BorderLayout());
    displayPanel.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "人员管理"));

    // 加入JTable
    setTable(content, header);
    scrollPanel = new JScrollPane(table);
    displayPanel.add(scrollPanel, BorderLayout.CENTER);

    // 加入功能区
    Box functionBox = Box.createVerticalBox();
    Box functionTop = Box.createVerticalBox();
    Box functionCenter = Box.createHorizontalBox();
    Box functionUnderCenterTop = Box.createVerticalBox();
    Box functionUnderCenter = Box.createHorizontalBox();
    Box functionBottom = Box.createVerticalBox();

    functionTop.add(Box.createVerticalStrut(10));
    functionUnderCenterTop.add(Box.createVerticalStrut(10));
    functionBottom.add(Box.createVerticalStrut(20));

    JLabel sift = new JLabel("筛选");
    sift.setFont(font);
    siftKey.setText("");
    JLabel fun = new JLabel("功能");
    fun.setFont(font);
    viewDM.setText("查看");
    viewDM.setFont(font);
    addDM.setText("增加");
    addDM.setFont(font);
    deleteDM.setText("删除");
    deleteDM.setFont(font);
    modifyDM.setText("修改");
    modifyDM.setFont(font);
    modifyDMPassword.setText("设置密码");
    modifyDMPassword.setFont(font);
    hideOutDate.setFont(font);
    functionCenter.add(Box.createHorizontalStrut(2));
    functionCenter.add(sift);
    functionCenter.add(Box.createHorizontalStrut(10));
    functionCenter.add(siftKey);
    functionCenter.add(Box.createHorizontalStrut(100));
    functionCenter.add(hideOutDate);
    functionCenter.add(Box.createHorizontalStrut(180));
    functionUnderCenter.add(Box.createHorizontalStrut(2));
    functionUnderCenter.add(fun);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(viewDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(addDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(deleteDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(modifyDM);
    functionUnderCenter.add(Box.createHorizontalStrut(10));
    functionUnderCenter.add(modifyDMPassword);
    functionUnderCenter.add(Box.createHorizontalGlue());

    functionBox.add(functionTop);
    functionBox.add(functionCenter);
    functionBox.add(functionUnderCenterTop);
    functionBox.add(functionUnderCenter);
    functionBox.add(functionBottom);
    displayPanel.add(functionBox, BorderLayout.SOUTH);

    // 建立提示区面板
    tips = Box.createHorizontalBox();
    tips.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "系统提示"));
    tips.add(Box.createHorizontalStrut(200));

    // 加入系统提示
    // TODO 加入系统提示信息

    contentPanel.add(displayPanel, BorderLayout.CENTER);
    contentPanel.add(tips, BorderLayout.EAST);

    validate();
  }