예제 #1
0
  /**
   * <code>guiInit()</code> defined for component initialization and setting up actions and models
   * of each component
   */
  private void guiInit() {
    setTitle(props.getProperty("page.name"));

    ButtonGroup typeButtonGroup = new ButtonGroup();
    typeButtonGroup.add(rdoCopyrightReq);
    typeButtonGroup.add(rdoDepositReq);

    ButtonGroup isAnsweredButtonGroup = new ButtonGroup();
    isAnsweredButtonGroup.add(rdoAnswerReq);
    isAnsweredButtonGroup.add(rdoNoAnswerReq);

    ButtonGroup hasNumberButtonGroup = new ButtonGroup();
    hasNumberButtonGroup.add(rdoHasNumber);
    hasNumberButtonGroup.add(rdoNoNumber);

    lblNumberSufix.setText(
        StringConsts.LRM
            + String.valueOf('\u062D')
            + " "
            + StringConsts.LRM
            + WorkflowConstants.NO_DATA);

    ConstantTableDefinition docType =
        ConstantPool.getInstance().findConstantTableByName(ConstantTables.COPYRIGHT_NONE_BOOK_TYPE);
    cmbDocType =
        ComponentFactory.createConstantTableCombo(
            docType, new Dimension(150, 16), true, screenLocale);
    cmbDocType.setSelectedIndex(0);

    componentsInit();

    btnSelectUser.setIcon(WorkflowUiUtils.SELECT_USER_ICON);
    btnSelectUser.setBorder(null);

    setGridColumns();

    setGridActions();
  }
예제 #2
0
/**
 * <code>CopyRightReportScreen</code> provides a user interface for user to generate different
 * reports by selecting different search keys.
 *
 * @author Mina Naeemi
 */
public class CopyRightReportScreen extends BaseScreen {
  /**
   * Components defined for showing specified TempCopyrightRecord list in a tabular fasion and
   * manipulate its row.
   */
  private UltraGrid grid;

  /** <code>Locale</code> object represents a specific language in this screen. */
  private Locale local;

  /**
   * The instance of <code>AuthorityReportRowData.AuthorityReportDataFetcher</code> for fetching
   * list of <code>TempCopyrightRecord</code> from DB.
   */
  private CopyRightReportRowData.copyRightReportDataFetcher dataFetcher;

  /** Property holds value of search keys for reporting copyright requests. */
  private TempRequestReport filterObject = new TempRequestReport();

  /** Property holds userId. */
  private long userId;

  /** Property holds value of selected radio button. */
  private String radioValue = new String();

  /** Property holds text of print and preview header. */
  private String previewHeaderText = new String();

  private String className = "";

  private String screenTitle;

  /** Components defined for showing labels on this screen. */
  private JLabel lblTitle = ComponentFactory.createLabel(props.getProperty("title.name"));

  private JLabel lblNumber =
      ComponentFactory.createLabel(props.getProperty("copyright_or_deposit_number.name"));
  private JLabel lbldocType = ComponentFactory.createLabel(props.getProperty("doc_type.name"));
  private JLabel lblFromDate = ComponentFactory.createLabel(props.getProperty("from_date.name"));
  private JLabel lblToDate = ComponentFactory.createLabel(props.getProperty("to_date.name"));
  private JLabel lblUserName = ComponentFactory.createLabel(props.getProperty("user.name"));
  private JLabel lblNumberSufix = ComponentFactory.createLabel("");

  /** Components defined for showing textfields on this screen. */
  private JTextField txfTitle = ComponentFactory.createTextField(17);

  private JTextField txfNumber = ComponentFactory.createLingualDigitTextField(true);
  private JTextField txfUserName = ComponentFactory.createTextField(30);
  private ExtDateField txfFromDate = ComponentFactory.createDateField(getScreenLocale());
  private ExtDateField txfToDate = ComponentFactory.createDateField(getScreenLocale());

  /** Components defined for showing radio buttons on this screen. */
  private JRadioButton rdoCopyrightReq =
      ComponentFactory.createRadioButton(props.getProperty("copy_right_req.name"));

  private JRadioButton rdoDepositReq =
      ComponentFactory.createRadioButton(props.getProperty("deposit_req.name"));
  private JRadioButton rdoNoAnswerReq =
      ComponentFactory.createRadioButton(props.getProperty("no_answered_req.name"));
  private JRadioButton rdoAnswerReq =
      ComponentFactory.createRadioButton(props.getProperty("answered_req.name"));
  private JRadioButton rdoNoNumber =
      ComponentFactory.createRadioButton(props.getProperty("no_number_req.name"));
  private JRadioButton rdoHasNumber =
      ComponentFactory.createRadioButton(props.getProperty("has_number_req.name"));

  /** Components defined for showing checkbox on this screen. */
  private JCheckBox chkRequestDate =
      ComponentFactory.createCheckBox(props.getProperty("request_date.name"));

  private JCheckBox chkAnswerDate =
      ComponentFactory.createCheckBox(props.getProperty("answer_date.name"));
  private JCheckBox chkSetNumberDate =
      ComponentFactory.createCheckBox(props.getProperty("set_number_date.name"));

  /** Components defined for showing combobox on this screen. */
  private ConstantTableComboBox cmbDocType;

  /**
   * Property holds NliAction instance, when triggered used for showing outputformat screen of
   * selected rows info. This action will be fired when user clicked on showInfo button.
   */
  private NliAction selectUserAction =
      new NliAction("selectUserAction", props.getProperty("selectUserAction.name")) {
        public void execute(ActionEvent e) {
          selectProfileActionPerformed();
        }
      };

  /** Components defined for showing buttons on this screen. */
  private JButton btnSelectUser = ComponentFactory.createButton(selectUserAction);

  ///////////////////////////////////////////////// G U I   M E T H O D S
  // \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  public CopyRightReportScreen(SubsystemApp subsystemApp, String screenTitle, Locale local) {
    super(subsystemApp);
    className = getClass().getName();
    this.screenTitle = screenTitle;
    this.local = local;
    dataFetcher = new CopyRightReportRowData.copyRightReportDataFetcher(local);
    dataFetcher.setReportObject(null);
    guiInit();
    layoutComponents();
  }

  /**
   * <code>guiInit()</code> defined for component initialization and setting up actions and models
   * of each component
   */
  private void guiInit() {
    setTitle(props.getProperty("page.name"));

    ButtonGroup typeButtonGroup = new ButtonGroup();
    typeButtonGroup.add(rdoCopyrightReq);
    typeButtonGroup.add(rdoDepositReq);

    ButtonGroup isAnsweredButtonGroup = new ButtonGroup();
    isAnsweredButtonGroup.add(rdoAnswerReq);
    isAnsweredButtonGroup.add(rdoNoAnswerReq);

    ButtonGroup hasNumberButtonGroup = new ButtonGroup();
    hasNumberButtonGroup.add(rdoHasNumber);
    hasNumberButtonGroup.add(rdoNoNumber);

    lblNumberSufix.setText(
        StringConsts.LRM
            + String.valueOf('\u062D')
            + " "
            + StringConsts.LRM
            + WorkflowConstants.NO_DATA);

    ConstantTableDefinition docType =
        ConstantPool.getInstance().findConstantTableByName(ConstantTables.COPYRIGHT_NONE_BOOK_TYPE);
    cmbDocType =
        ComponentFactory.createConstantTableCombo(
            docType, new Dimension(150, 16), true, screenLocale);
    cmbDocType.setSelectedIndex(0);

    componentsInit();

    btnSelectUser.setIcon(WorkflowUiUtils.SELECT_USER_ICON);
    btnSelectUser.setBorder(null);

    setGridColumns();

    setGridActions();
  }

  /** <code> layoutComponents() </code> defined for layout components in this screen. */
  private void layoutComponents() {
    this.setLayout(new GridBagLayout());
    JPanel panel1 = new JPanel(new GridBagLayout());
    panel1.setBorder(BorderFactory.createTitledBorder(""));
    ComponentFactory.addComponent(
        panel1,
        rdoCopyrightReq,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoDepositReq,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoAnswerReq,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoNoAnswerReq,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoHasNumber,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 4, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoNoNumber,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        this,
        panel1,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    JPanel panel2 = new JPanel(new GridBagLayout());
    JPanel panel3 = new JPanel(new GridBagLayout());
    JPanel panel4 = new JPanel(new GridBagLayout());
    panel4.setBorder(BorderFactory.createTitledBorder(props.getProperty("search_base.name")));
    ComponentFactory.addComponent(
        panel2,
        chkRequestDate,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel2,
        chkAnswerDate,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel2,
        chkSetNumberDate,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        panel2,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        lblFromDate,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 8, 0, 8),
            0,
            0));
    txfFromDate.setPreferredSize(new Dimension(140, 20));
    txfToDate.setPreferredSize(new Dimension(140, 20));
    ComponentFactory.addComponent(
        panel3,
        txfFromDate,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 10),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        lblToDate,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 8, 0, 8),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        txfToDate,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 10),
            0,
            0));
    ComponentFactory.addComponent(
        panel4,
        panel3,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    JPanel panel5 = new JPanel(new GridBagLayout());
    ComponentFactory.addComponent(
        panel5,
        lbldocType,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(10, 2, 8, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        cmbDocType,
        new GridBagConstraints(
            1,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        lblTitle,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        txfTitle,
        new GridBagConstraints(
            1,
            1,
            2,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        lblNumber,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 8, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        txfNumber,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.5,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        lblNumberSufix,
        new GridBagConstraints(
            2,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel4,
        panel5,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    JPanel panel8 = new JPanel(new GridBagLayout());
    ComponentFactory.addComponent(
        panel8,
        lblUserName,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel8,
        txfUserName,
        new GridBagConstraints(
            1,
            0,
            2,
            1,
            2.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel8,
        btnSelectUser,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel4,
        panel8,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            2.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        this,
        panel4,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    ComponentFactory.addComponent(
        this,
        grid,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(4, 2, 0, 2),
            0,
            0));
  }

  private void componentsInit() {
    rdoCopyrightReq.setSelected(true);
    rdoNoAnswerReq.setSelected(true);
    rdoHasNumber.setSelected(true);
    cmbDocType.setEnabled(false);
    txfFromDate.setEnabled(false);
    txfToDate.setEnabled(false);
    txfUserName.setEnabled(false);

    chkAnswerDate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (chkAnswerDate.isSelected()) {
              txfFromDate.setEnabled(true);
              txfToDate.setEnabled(true);
            } else {
              if (!chkRequestDate.isSelected() && !chkSetNumberDate.isSelected()) {
                txfFromDate.setEnabled(false);
                txfToDate.setEnabled(false);
              }
            }
          }
        });

    chkRequestDate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (chkRequestDate.isSelected()) {
              txfFromDate.setEnabled(true);
              txfToDate.setEnabled(true);
            } else {
              if (!chkAnswerDate.isSelected() && !chkSetNumberDate.isSelected()) {
                txfFromDate.setEnabled(false);
                txfToDate.setEnabled(false);
              }
            }
          }
        });

    chkSetNumberDate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (chkSetNumberDate.isSelected()) {
              txfFromDate.setEnabled(true);
              txfToDate.setEnabled(true);
            } else {
              if (!chkAnswerDate.isSelected() && !chkRequestDate.isSelected()) {
                txfFromDate.setEnabled(false);
                txfToDate.setEnabled(false);
              }
            }
          }
        });

    GuiUtils.switchKeyboardOnFocus(txfTitle, LocaleUtils.PERSIAN_LOCALE);
    GuiUtils.switchKeyboardOnFocus(txfNumber, LocaleUtils.ENGLISH_LOCALE);
    txfTitle.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            if (!(e.getSource() instanceof JTextComponent) || !Character.isDigit(e.getKeyChar()))
              return;
            JTextComponent tc = (JTextComponent) e.getSource();
            if (tc.getInputContext() == null || tc.getInputContext().getLocale() == null) return;
            Locale locale = tc.getInputContext().getLocale();
            if ("fa".equals(locale.getLanguage()))
              e.setKeyChar(StringUtils.latinToExtendedArabicDigit(e.getKeyChar()));
            else if ("ar".equals(locale.getLanguage()))
              e.setKeyChar(StringUtils.latinToArabicDigit(e.getKeyChar()));
          }
        });

    ActionListener actionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (rdoCopyrightReq.isSelected()) {
              cmbDocType.setEnabled(false);
              lblNumberSufix.setText(
                  StringConsts.LRM
                      + String.valueOf('\u062D')
                      + " "
                      + StringConsts.LRM
                      + WorkflowConstants.NO_DATA);
            }
            if (rdoDepositReq.isSelected()) {
              cmbDocType.setEnabled(true);
              lblNumberSufix.setText(
                  StringConsts.LRM
                      + String.valueOf('\u0648')
                      + " "
                      + StringConsts.LRM
                      + WorkflowConstants.NO_DATA);
            }
          }
        };
    rdoCopyrightReq.addActionListener(actionListener);
    rdoDepositReq.addActionListener(actionListener);
  }

  private void setGridColumns() {
    CopyRightReportRowData rowData = new CopyRightReportRowData(local);
    GridColumnModel model = new GridColumnModel();
    GridColumn column = null;

    column =
        new GridColumn(
            CopyRightReportRowData.TITLE_COL,
            rowData.getDisplayName(CopyRightReportRowData.TITLE_COL),
            65);
    column.setAlignment(SwingConstants.RIGHT);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.WRITER_COL,
            rowData.getDisplayName(CopyRightReportRowData.WRITER_COL),
            65);
    column.setAlignment(SwingConstants.RIGHT);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.PUBLISHER_COL,
            rowData.getDisplayName(CopyRightReportRowData.PUBLISHER_COL),
            65);
    column.setAlignment(SwingConstants.RIGHT);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.REQUEST_DATE_COL,
            rowData.getDisplayName(CopyRightReportRowData.REQUEST_DATE_COL),
            65);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.ANSWER_DATE_COL,
            rowData.getDisplayName(CopyRightReportRowData.ANSWER_DATE_COL),
            65);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.NUMBER_DATE_COL,
            rowData.getDisplayName(CopyRightReportRowData.NUMBER_DATE_COL),
            65);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.NUMBER_COL,
            rowData.getDisplayName(CopyRightReportRowData.NUMBER_COL),
            65);
    model.addColumn(column);

    column =
        new GridColumn(
            CopyRightReportRowData.USER_COL,
            rowData.getDisplayName(CopyRightReportRowData.USER_COL),
            65);
    column.setAlignment(SwingConstants.RIGHT);
    model.addColumn(column);

    grid = new UltraGrid(screenTitle, model, dataFetcher, local);
  }

  private void setGridActions() {
    java.util.List actions = grid.getActions();

    actions.add(
        0,
        new GridAction(
            "reportAction", props.getProperty("reportAction.name"), WorkflowUiUtils.REPORT_ICON) {
          public void execute(ActionEvent e) {
            reportActionPerformed();
          }
        });

    actions.add(
        1,
        new GridAction(
            "showInfoAction",
            props.getProperty("showInfoAction.name"),
            WorkflowUiUtils.PREVIEW_ICON) {
          public void execute(ActionEvent e) {
            showInfoActionPerformed();
          }
        });

    actions.add(
        2,
        new GridAction(
            "printAction", props.getProperty("printAction.name"), WorkflowUiUtils.PRINT_ICON) {
          public void execute(ActionEvent e) {
            printActionPerformed();
          }
        });

    actions.add(
        3,
        new GridAction(
            "clearAction", props.getProperty("clearAction.name"), WorkflowUiUtils.CLEAR_ICON) {
          public void execute(ActionEvent e) {
            clearActionPerformed();
          }
        });

    actions.add(
        4,
        new GridAction(
            "helpAction", props.getProperty("helpAction.name"), WorkflowUiUtils.HELP_ICON) {
          public void execute(ActionEvent e) {
            try {
              Main.getHelpSystem().showHelp(className);
            } catch (HelpException e1) {
              e1.printStackTrace();
            }
          }
        });

    grid.setActions(actions);
  }

  ////////////////////////////////////////// G E N E R A L S    M E T H O D S
  // \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

  /** <code>clearActionPerformed()</code> defines for reseting all components. */
  private void clearActionPerformed() {
    txfTitle.setText("");
    txfNumber.setText("");
    txfFromDate.setDate(null);
    txfToDate.setDate(null);
    txfUserName.setText("");
    rdoCopyrightReq.setSelected(true);
    rdoNoAnswerReq.setSelected(true);
    rdoHasNumber.setSelected(true);
    chkAnswerDate.setSelected(false);
    chkRequestDate.setSelected(false);
    chkSetNumberDate.setSelected(false);
    txfFromDate.setEnabled(false);
    txfToDate.setEnabled(false);
    cmbDocType.setEnabled(false);
    userId = 0;
    dataFetcher.setReportObject(null);
    grid.refresh();
  }

  private void showInfoActionPerformed() {
    java.util.List itemList = grid.getCheckedRows();
    if (itemList.size() > 0) {
      ViewRecordScreen screen = new ViewRecordScreen(getSubsystemApp());
      List selectedRows = new ArrayList();
      for (int i = 0; i < itemList.size(); i++) {
        CopyRightReportRowData data = (CopyRightReportRowData) itemList.get(i);
        TempCopyrightRecord copyrightRecord = (TempCopyrightRecord) data.getEntity();
        selectedRows.add(copyrightRecord);
      }
      screen.setData(selectedRows);
      screen.showModal();
    } else {
      MessagePanes.showWarningDialog(
          this, props.getProperty(StandardActionNames.SELECT_ONE_ROW), local);
    }
  }

  private void selectProfileActionPerformed() {
    WorkflowUiUtils.selectProfile(this, Sections.COPY_RIGHT_SECTION, 0);
  }

  public void setProfile(long profileId) {
    String profileName = WorkflowUiUtils.getProfileName(profileId);
    txfUserName.setText(profileName);
    this.userId = profileId;
  }

  /**
   * <code>reportActionPerformed()</code> defiens for searching copyrights in DB according to search
   * keys.
   */
  private void reportActionPerformed() {
    filterObject = new TempRequestReport();
    int counter = 0;
    previewHeaderText = new String();
    radioValue = new String();

    if (!txfTitle.getText().equals(""))
      filterObject.setTitle((txfTitle.getText().toUpperCase().trim()));

    if (!txfNumber.getText().equals(""))
      filterObject.setNumber(StringUtils.arabicToLatinDigit(txfNumber.getText()).trim());

    if (rdoAnswerReq.isSelected()) {
      filterObject.setIsAnswered(WorkflowConstants.IS_ANSWERED_REQUEST);
      radioValue = props.getProperty("print_answered_req.name");
    } else if (rdoNoAnswerReq.isSelected()) {
      filterObject.setIsAnswered(WorkflowConstants.IS_NOT_ANSWERED_REQUEST);
      radioValue = props.getProperty("print_no_answered_req.name");
    }

    if (rdoHasNumber.isSelected()) {
      filterObject.setHasNumber(WorkflowConstants.HAS_NUMBER);
      radioValue += " " + props.getProperty("print_has_number_req.name");
    } else if (rdoNoNumber.isSelected()) {
      filterObject.setHasNumber(WorkflowConstants.NO_NUMBER);
      radioValue += " " + props.getProperty("print_no_number_req.name");
    }

    if (txfUserName.getText() != null
        && txfUserName.getText() != ""
        && txfUserName.getText().length() != 0) filterObject.setUserId(userId);

    if (rdoCopyrightReq.isSelected()) {
      filterObject.setType(WorkflowConstants.COPY_RIGHT_BOOK_TYPE);
      filterObject.setDocType("");
      radioValue += " " + props.getProperty("print_copy_right_req.name");
    } else if (rdoDepositReq.isSelected()) {
      filterObject.setType(WorkflowConstants.COPY_RIGHT_NON_BOOK_TYPE);
      if (cmbDocType.getSelectedIndex() != 0) {
        filterObject.setDocType(((ConstantTableItem) cmbDocType.getSelected()).getCode());
      } else filterObject.setDocType("");
      radioValue += " " + props.getProperty("print_deposit_req.name");
    }

    if (chkAnswerDate.isSelected()) {
      filterObject.setAnswerDate(WorkflowConstants.SELECTED);
      previewHeaderText = props.getProperty("answer_date.name");
      counter++;
    }
    if (chkRequestDate.isSelected()) {
      filterObject.setRequestDate(WorkflowConstants.SELECTED);
      if (counter > 0)
        previewHeaderText += " " + '\u060c' + " " + props.getProperty("request_date.name");
      else previewHeaderText += " " + props.getProperty("request_date.name");
      counter++;
    }

    if (chkSetNumberDate.isSelected()) {
      filterObject.setSetNumberDate(WorkflowConstants.SELECTED);
      if (counter > 0)
        previewHeaderText += " " + '\u060c' + " " + props.getProperty("set_number_date.name");
      else previewHeaderText += " " + props.getProperty("set_number_date.name");
    }

    if (txfFromDate.getDate() != null && txfToDate.getDate() != null) {
      if (txfFromDate.getDate().getTime() > txfToDate.getDate().getTime()) {
        MessagePanes.showErrorDialog(
            this, props.getProperty("from_date_larger.name"), LocaleUtils.PERSIAN);
        return;
      }
    }

    if (txfFromDate.getDate() != null) {
      filterObject.setFromDate(txfFromDate.getDate());
      if (!previewHeaderText.equals(""))
        previewHeaderText +=
            " "
                + props.getProperty("from_date.name")
                + " "
                + StringUtils.RTL_MARK
                + txfFromDate.getDate();
    }
    if (txfToDate.getDate() != null) {
      filterObject.setToDate(txfToDate.getDate());
      if (!previewHeaderText.equals(""))
        previewHeaderText +=
            " "
                + props.getProperty("to_date.name")
                + " "
                + StringUtils.RTL_MARK
                + txfToDate.getDate();
    }
    if (txfToDate.getDate() == null && txfFromDate.getDate() == null)
      previewHeaderText = new String();

    dataFetcher.setReportObject(filterObject);
    grid.refresh();
    if (grid.getDataModel().getData().getDataList() == null
        || grid.getDataModel().getData().getDataList().size() == 0)
      MessagePanes.showInfoDialog(this, props.getProperty("empty_list.name"), LocaleUtils.PERSIAN);
  }

  /** <code>print()</code> defines for showing print or print preview of results. */
  private void printActionPerformed() {
    Hashtable parameters = new Hashtable();
    parameters.put(props.getProperty("printHeader.name"), radioValue);
    if (StringUtils.isNotEmpty(previewHeaderText))
      parameters.put(props.getProperty("header1.name"), previewHeaderText);
    ReportData reportData = new ReportData(grid, new HashMap(), grid.getLocale());
    java.util.List itemList = new ArrayList();
    itemList = grid.getDataModel().getData().getDataList();
    reportData.setTitle(getTitle());
    reportData.setConditionMap(parameters);
    reportData.setSelectedRows(itemList);
    PrintSetupScreen.showPrintSetupScreen(this.getSubsystemApp(), screenLocale, reportData);
  }
}
예제 #3
0
  /** <code> layoutComponents() </code> defined for layout components in this screen. */
  private void layoutComponents() {
    this.setLayout(new GridBagLayout());
    JPanel panel1 = new JPanel(new GridBagLayout());
    panel1.setBorder(BorderFactory.createTitledBorder(""));
    ComponentFactory.addComponent(
        panel1,
        rdoCopyrightReq,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoDepositReq,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoAnswerReq,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoNoAnswerReq,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoHasNumber,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 4, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel1,
        rdoNoNumber,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        this,
        panel1,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    JPanel panel2 = new JPanel(new GridBagLayout());
    JPanel panel3 = new JPanel(new GridBagLayout());
    JPanel panel4 = new JPanel(new GridBagLayout());
    panel4.setBorder(BorderFactory.createTitledBorder(props.getProperty("search_base.name")));
    ComponentFactory.addComponent(
        panel2,
        chkRequestDate,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel2,
        chkAnswerDate,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel2,
        chkSetNumberDate,
        new GridBagConstraints(
            2,
            0,
            1,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        panel2,
        new GridBagConstraints(
            0,
            0,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        lblFromDate,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 8, 0, 8),
            0,
            0));
    txfFromDate.setPreferredSize(new Dimension(140, 20));
    txfToDate.setPreferredSize(new Dimension(140, 20));
    ComponentFactory.addComponent(
        panel3,
        txfFromDate,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 10),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        lblToDate,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 8, 0, 8),
            0,
            0));
    ComponentFactory.addComponent(
        panel3,
        txfToDate,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 10),
            0,
            0));
    ComponentFactory.addComponent(
        panel4,
        panel3,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    JPanel panel5 = new JPanel(new GridBagLayout());
    ComponentFactory.addComponent(
        panel5,
        lbldocType,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(10, 2, 8, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        cmbDocType,
        new GridBagConstraints(
            1,
            0,
            2,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        lblTitle,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        txfTitle,
        new GridBagConstraints(
            1,
            1,
            2,
            1,
            0.3,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        lblNumber,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 8, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        txfNumber,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.5,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel5,
        lblNumberSufix,
        new GridBagConstraints(
            2,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel4,
        panel5,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    JPanel panel8 = new JPanel(new GridBagLayout());
    ComponentFactory.addComponent(
        panel8,
        lblUserName,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel8,
        txfUserName,
        new GridBagConstraints(
            1,
            0,
            2,
            1,
            2.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel8,
        btnSelectUser,
        new GridBagConstraints(
            3,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        panel4,
        panel8,
        new GridBagConstraints(
            0,
            1,
            2,
            1,
            2.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));
    ComponentFactory.addComponent(
        this,
        panel4,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL,
            new Insets(4, 2, 0, 2),
            0,
            0));

    ComponentFactory.addComponent(
        this,
        grid,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(4, 2, 0, 2),
            0,
            0));
  }
  private void initGuiComponents() {
    this.setTitle(props.getProperty("title.text"));
    btnConfirm = ComponentFactory.createButton(confirmAction);
    btnCancel = ComponentFactory.createButton(cancelAction);

    txfImageURL = ComponentFactory.createTextField(20);
    txfDatabaseURL = ComponentFactory.createTextField(20);
    txfUserName = ComponentFactory.createTextField(20);
    txfPassword = new JPasswordField(20);
    txfFromMemberNo = ComponentFactory.createTextField(20);
    txfToMemberNo = ComponentFactory.createTextField(20);
    txfProfileDatabase = ComponentFactory.createTextField(20);
    txfMultimediaDatabase = ComponentFactory.createTextField(20);

    libraryList =
        NliUserManagementServiceProxy.getInstance().findAllWorkGroupsByType(LibraryUnit.class);

    tblLibrary = ComponentFactory.createTable();
    initTable(libraryList);

    cmbLocations = ComponentFactory.createComboBox();
    List list = NliProfileServiceProxy.getInstance().findLocationsAtFirstLevel();
    cmbLocations.setModel(new DefaultComboBoxModel(list.toArray()));
    cmbLocations.setRenderer(
        new DefaultListCellRenderer() {
          @Override
          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Location location = (Location) value;
            Component listCellRendererComponent =
                super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            if (location != null) setText(location.getTitle());
            return listCellRendererComponent;
          }
        });

    cbUseUniqueNameToFindUser = new JCheckBox(props.getProperty("useUniqueNameToFindUser.text"));
    cbIsOrg = new JCheckBox(props.getProperty("isOrg.text"));
    cbIsUniversity = new JCheckBox(props.getProperty("isUniversity.text"));
    cbUseProfileSetting = new JCheckBox(props.getProperty("useProfileSetting.text"));

    txfDatabaseURL.setText(
        "jdbc:sqlserver://192.168.1.17:1433;databaseName=ParsProfile_ParsAzarakhsh;integratedSecurity=false");
    txfUserName.setText("digilibadminlogin");
    txfPassword.setText("manager");
    txfImageURL.setText("F:\\pimage");
    txfFromMemberNo.setText("1");
    txfToMemberNo.setText("10");
    txfProfileDatabase.setText("ParsLibrary_ParsAzarakhsh");
    txfMultimediaDatabase.setText("ParsMultimedia_ParsAzarakhsh");
  }
  private JPanel createMemberEchangeRangePanel() {
    lblImageURL = ComponentFactory.createLabel(props.getProperty("image-url.text"));
    lblFromMembershipNo = ComponentFactory.createLabel(props.getProperty("from-member-no.text"));
    lblToMembershipNo = ComponentFactory.createLabel(props.getProperty("to-membership-no.text"));

    lblMultimediaDatabase =
        ComponentFactory.createLabel(props.getProperty("multimedia-database.text"));

    JPanel p1 = new JPanel(new GridBagLayout());
    p1.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(), props.getProperty("member-range.text")));
    p1.add(
        lblImageURL,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p1.add(
        txfImageURL,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        lblMultimediaDatabase,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p1.add(
        txfMultimediaDatabase,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        lblFromMembershipNo,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p1.add(
        txfFromMemberNo,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        lblToMembershipNo,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p1.add(
        txfToMemberNo,
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        cbUseUniqueNameToFindUser,
        new GridBagConstraints(
            0,
            4,
            2,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        cbIsOrg,
        new GridBagConstraints(
            0,
            5,
            2,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        cbIsUniversity,
        new GridBagConstraints(
            0,
            6,
            2,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p1.add(
        cbUseProfileSetting,
        new GridBagConstraints(
            0,
            7,
            2,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 10, 2, 10),
            0,
            0));
    return p1;
  }
  private JPanel createDatabaseConnectionInfoPanel() {
    lblDatabaseURL = ComponentFactory.createLabel(props.getProperty("database-url.text"));
    lblUserName = ComponentFactory.createLabel(props.getProperty("username.text"));
    lblPassword = ComponentFactory.createLabel(props.getProperty("password.text"));
    lblLibrary = ComponentFactory.createLabel(props.getProperty("library.text"));
    lblLoanGroup = ComponentFactory.createLabel(props.getProperty("loanGroup.text"));
    lblLocations = ComponentFactory.createLabel(props.getProperty("locations.text"));
    lblProfileDatabase = ComponentFactory.createLabel(props.getProperty("profile-database.text"));

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(), props.getProperty("database-properties.text")));

    p.add(
        lblDatabaseURL,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p.add(
        txfDatabaseURL,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p.add(
        lblProfileDatabase,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p.add(
        txfProfileDatabase,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p.add(
        lblUserName,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p.add(
        txfUserName,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p.add(
        lblPassword,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p.add(
        txfPassword,
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));

    p.add(
        lblLocations,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            0,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 10, 2, 10),
            0,
            0));
    p.add(
        cmbLocations,
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            1,
            0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 10, 2, 10),
            0,
            0));

    return p;
  }
예제 #7
0
  public SimpleSearchScreen(
      BaseScreen screen,
      DatabankIdentity databank,
      DatabankSchema schema,
      MarcQueryBuilder queryBuilder,
      int language,
      String field,
      String value,
      boolean showAuthorityButton,
      boolean modal) {
    super(screen.getSubsystemApp(), modal);
    setAskBaseScreenClosed(false);
    setSingleInstance(false);
    props = ResourceSystem.get(language, SimpleSearchScreen.class);
    searchPanel = new SimpleSearchPanel(databank, schema, queryBuilder, language);
    //        searchPanel.txfValue.setColumns(200);// to support long texts
    setTitle(props.getProperty("title.name"));
    searchPanel.cmField.setSelectedItem(field);
    searchPanel.txfValue.setText(value);
    searchPanel.txfValue.getCaret().setDot(0);

    btnSearch = ComponentFactory.createButton(actSearch);
    btnClose = ComponentFactory.createButton(actClose);
    btnHelp =
        ComponentFactory.createHelpButton(
            language, getClass().getName() + "." + databank.toString().charAt(0));
    btnAuthority = ComponentFactory.createButton(actAuthorityPrivate);
    LayoutFacility lf = new LayoutFacility(this);
    lf.add(
        searchPanel,
        new GridBagConstraints(
            0,
            0,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            1.0,
            GridBagConstraints.PAGE_START,
            GridBagConstraints.BOTH,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ButtonsLayout btns = new ButtonsLayout();
    btns.add(btnSearch);
    if (showAuthorityButton) {
      btns.add(btnAuthority);
    }
    btns.add(btnHelp);
    btns.add(btnClose);
    lf.add(
        btns.layoutHorizontallyUsingGrid(1, 0, 4, 4),
        new GridBagConstraints(
            0,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.PAGE_END,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    GuiUtils.setActionName(actClose, props.getProperty("cancel.name"));
    GuiUtils.setActionName(actSearch, props.getProperty("search.name"));
    GuiUtils.setActionName(actAuthorityPrivate, props.getProperty("authority.name"));
    setDefaultButton(btnSearch);
    actAuthority.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            actAuthorityPrivate.firePropertyChange(
                evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
          }
        });
  }