Ejemplo n.º 1
0
 public void setTitle(String title) {
   lblTitle.setText(title);
 }
Ejemplo n.º 2
0
  public AbstractFieldProvider() {
    FPanel pnlTop = new FPanel();
    pnlTop.setLayout(new BorderLayout());
    pnlTitle = new FPanel();
    pnlTitle.setBorder();
    pnlTitle.setPreferredSize(new Dimension(90, 28));
    FlowLayout fl = new FlowLayout(FlowLayout.LEFT);

    // imgFocus = new ImagePanel(IMG_FOCUS);
    // imgFocus.transferFocusBackward();
    // imgFocus.setPreferredSize(new Dimension(20, 20));
    // imgFocus.setVisible(false);
    // pnlTitle.add(imgFocus);
    //
    // imgNotFocus = new ImagePanel(IMG_NOT_FOCUS);
    // imgNotFocus.transferFocusBackward();
    // imgNotFocus.setPreferredSize(new Dimension(20, 20));
    // pnlTitle.add(imgNotFocus);

    imgHor = new ImagePanel(IMG_HOR);
    imgHor.transferFocusBackward();
    imgHor.setPreferredSize(new Dimension(24, 24));
    imgHor.setVisible(false);
    pnlTitle.add(imgHor);

    imgVer = new ImagePanel(IMG_VER);
    imgVer.transferFocusBackward();
    imgVer.setPreferredSize(new Dimension(24, 24));
    pnlTitle.add(imgVer);

    imgNotUsed = new ImagePanel(IMG_NOT_USED);
    imgNotUsed.transferFocusBackward();
    imgNotUsed.setPreferredSize(new Dimension(24, 24));
    pnlTitle.add(imgNotUsed);

    pnlTitle.setLayout(fl);
    lblTitle = new FLabel();
    lblTitle.setText("数据");
    pnlTitle.add(lblTitle);
    pnlTitle.setBackground(colDisactived);

    cbxUseType = new FComboBox();
    cbxUseType.setTitle("使用状态");
    // cbxUseType.setTitleVisible(false);
    cbxUseType.setRefModel(TYPEREF);
    cbxUseType.setValue(USE_NO_USE);
    cbxUseType.setPreferredSize(new Dimension(200, 20));
    cbxUseType.addValueChangeListener(
        new ValueChangeListener() {

          public void valueChanged(ValueChangeEvent arg0) {
            setEnabled(USE_HOR.equals(arg0.getNewValue()));
            setStatusByUseType(!USE_NO_USE.equals(arg0.getNewValue()));
            focusListener.changeUseType(AbstractFieldProvider.this);
          }
        });

    pnlTop.add(pnlTitle, BorderLayout.NORTH);
    pnlTop.add(cbxUseType, BorderLayout.CENTER);

    this.setLayout(new BorderLayout());
    this.add(pnlTop, BorderLayout.NORTH);
    pnlBody = new FPanel();
    pnlBody.setLayout(new BorderLayout());
    this.add(pnlBody, BorderLayout.CENTER);
    this.setBorder(new LineBorder(new Color(127, 157, 185), 1));
    // this.setBorder(new BevelBorder(BevelBorder.LOWERED));
    this.setPreferredSize(PREFERRED_SIZE_ENABLE);

    cbxUseType.addMouseListener(comCick);
    cbxUseType.getEditor().addMouseListener(comCick);
    // Component[] subCmps = cbxUseType.getComponents();
    // if (subCmps != null && subCmps.length > 0) {
    // for (int i = 0; i < subCmps.length; i++) {
    // Component component = subCmps[i];
    // if (component != null)
    // component.addMouseListener(comCick);
    // }
    // }
    lblTitle.addMouseListener(comCick);
    // imgFocus.addMouseListener(comCick);
    // imgNotFocus.addMouseListener(comCick);
    imgHor.addMouseListener(comCick);
    imgVer.addMouseListener(comCick);
    imgNotUsed.addMouseListener(comCick);
    lblTitle.addMouseListener(comCick);
    pnlTitle.addMouseListener(comCick);
    pnlBody.addMouseListener(comCick);
    init();
  }
Ejemplo n.º 3
0
  public ColWhereSetPnl(final CalcColumnDialog calcColumnDialog) {
    this.calcColumnDialog = calcColumnDialog;

    // 数据源组合框
    dataSourceCbx = new MyFComboBox("数据源:", calcColumnDialog.getQuerySource());
    ((JComboBox) dataSourceCbx.getComponent(1)).addItemListener(new SelectItemListener());

    // 字段名
    FLabel fieldNameLbl = new FLabel();
    fieldNameLbl.setTitle("字段名:");
    // 升降序选择
    FLabel operateLbl = new FLabel();
    operateLbl.setText("操作:");
    // 条件值
    FLabel whereValueLbl = new FLabel();
    whereValueLbl.setText("值:");

    // 字段名称组合框
    cbxFieldName = new FComboBox();
    cbxFieldName.setTitleVisible(false);
    ((JComboBox) cbxFieldName.getComponent(1))
        .addItemListener(
            new ItemListener() {

              public void itemStateChanged(ItemEvent arg0) {
                if (cbxFieldName.getValue() == null) {
                  return;
                }

                String sFieldTyp = getFieldType();
                // 判断字段类型,如果是数值型包含和不包含不显示
                if (DefinePub.checkCharVal(sFieldTyp)) {
                  cbxCompare.setRefModel(CompareType.COMPARE_TYPE);
                } else {
                  cbxCompare.setRefModel(CompareType.COMPARE_TYPE_NUM);
                }
                cbxCompare.setSelectedIndex(-1);
                // 得到基础信息选择列的值,根据报表id和ename值
                if (!Common.isNullStr(dataSourceCbx.getValue().toString())
                    && !Common.isNullStr(cbxFieldName.getValue().toString())) {
                  String sFeildEname = cbxFieldName.getValue().toString();
                  sFeildEname = sFeildEname.substring(0, sFeildEname.indexOf(":"));

                  List lstInputValue = null;
                  try {
                    lstInputValue =
                        DefineReportI.getMethod()
                            .getBasSelectInputValue(
                                dataSourceCbx.getValue().toString(), sFeildEname);
                  } catch (Exception e) {
                    e.printStackTrace();
                    new MessageBox(
                            calcColumnDialog,
                            "错误信息:" + e.getMessage(),
                            MessageBox.ERROR,
                            MessageBox.BUTTON_OK)
                        .show();
                  }
                  cbxWhereValue.setEditable(true);
                  addRefValue(cbxWhereValue, lstInputValue, IDefineReport.CODE, IDefineReport.NAME);
                  cbxWhereValue.setSelectedIndex(-1);
                } else {
                  cbxWhereValue.removeAllItems();
                }
              }
            });

    // 比较类型
    cbxCompare = new FComboBox();
    cbxCompare.setTitleVisible(false);
    cbxCompare.setRefModel(CompareType.COMPARE_TYPE);
    cbxCompare.setSelectedIndex(-1);

    // 条件值
    // txtWhereValue = new FTextField(false);
    cbxWhereValue = new FComboBox();
    ((JComboBox) cbxWhereValue.getEditor()).setEditable(true);
    cbxWhereValue.setTitleVisible(false);

    // 定义条件面板
    FPanel orderPnl = new FPanel();
    orderPnl.setLayout(new RowPreferedLayout(5));

    FLabel flblEmpty = new FLabel();
    // 数据来源
    orderPnl.addControl(dataSourceCbx, new TableConstraints(1, 2, false, true));
    orderPnl.addControl(flblEmpty, new TableConstraints(1, 3, false, true));
    // Label
    orderPnl.addControl(fieldNameLbl, new TableConstraints(1, 2, false, true));
    orderPnl.addControl(operateLbl, new TableConstraints(1, 1, false, true));
    orderPnl.addControl(whereValueLbl, new TableConstraints(1, 2, false, true));
    // 编码框
    orderPnl.addControl(cbxFieldName, new TableConstraints(1, 2, false, true));
    orderPnl.addControl(cbxCompare, new TableConstraints(1, 1, false, true));
    orderPnl.add(cbxWhereValue, new TableConstraints(1, 2, false, true));

    // 定义条件类型
    frdoType = new FRadioGroup("", FRadioGroup.HORIZON);
    frdoType.setRefModel(JoinBefore.JOIN_BEFORE);
    frdoType.setTitleVisible(false);
    frdoType.setValue("and");

    // 增加、修改按钮
    FButton addBtn = new FButton("addBtn", "增加");
    addBtn.addActionListener(new AddActionListener());

    FButton modifyBtn = new FButton("addBtn", "修改");
    modifyBtn.addActionListener(new ModifyActionListener());
    // FFlowLayoutPanel editBtnPnl = new FFlowLayoutPanel();
    FPanel editBtnPnl = new FPanel();
    RowPreferedLayout rEditBtnLay = new RowPreferedLayout(2);
    rEditBtnLay.setColumnGap(1);
    rEditBtnLay.setColumnWidth(70);
    editBtnPnl.setLayout(rEditBtnLay);
    // editBtnPnl.setAlignment(FlowLayout.RIGHT);
    editBtnPnl.addControl(addBtn, new TableConstraints(1, 1, false, false));
    editBtnPnl.addControl(modifyBtn, new TableConstraints(1, 1, false, false));

    FLabel flbEmpty = new FLabel();
    FPanel fpnlEdit = new FPanel();
    RowPreferedLayout rEditLay = new RowPreferedLayout(4);
    rEditLay.setColumnWidth(140);
    fpnlEdit.setLayout(rEditLay);

    fpnlEdit.addControl(flbEmpty, new TableConstraints(1, 1, true, true));
    fpnlEdit.addControl(frdoType, new TableConstraints(1, 2, true, true));
    fpnlEdit.addControl(editBtnPnl, new TableConstraints(1, 1, true, false));

    // 定义条件树
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("过滤条件");
    DefaultTreeModel treeModel = new DefaultTreeModel(root);
    treWhere = new MyTree(treeModel);
    // 变换树节点,刷新显示框信息事件
    treWhere.addTreeSelectionListener(new WhereTreeSelectionListener());
    JScrollPane fpnltalRela = new JScrollPane(treWhere);

    // 过滤条件按钮面板
    FPanel btnPnl = new BtnPnl();

    JTabbedPane pnlWhere = new JTabbedPane();
    RowPreferedLayout rLay = new RowPreferedLayout(2);
    FPanel pnlCol = new FPanel();
    pnlCol.setLayout(rLay);
    rLay.setColumnWidth(70);
    rLay.setColumnGap(1);

    pnlCol.addControl(orderPnl, new TableConstraints(3, 2, false, true));
    pnlCol.addControl(fpnlEdit, new TableConstraints(1, 2, false, true));
    pnlCol.add(fpnltalRela, new TableConstraints(1, 1, true, true));
    pnlCol.addControl(btnPnl, new TableConstraints(1, 1, true, false));

    txtSql = new FTextArea();
    txtSql.setTitleVisible(false);
    txtSql.setEditable(false);

    FScrollPane spnlSql = new FScrollPane(txtSql);

    pnlWhere.add("列条件信息", pnlCol);
    pnlWhere.add("分栏设置条件", spnlSql);
    this.setLayout(new BorderLayout());
    this.add(pnlWhere, BorderLayout.CENTER);
  }