Exemplo n.º 1
0
  public ExampleQueriesPanel(String caption, SearchUI ui) {
    super(caption);
    this.ui = ui;
    this.mainTab = ui.getTabSheet();

    //
    egContainer = new BeanItemContainer<ExampleQuery>(ExampleQuery.class);
    setContainerDataSource(egContainer);
  }
Exemplo n.º 2
0
  private void hideTabSheet() {
    if (mainTab == null) {
      mainTab = ui.getMainTab();
    }

    if (mainTab != null) {
      tab = mainTab.getTab(this);

      if (tab != null) {
        tab.setEnabled(false);
      }
    }
  }
Exemplo n.º 3
0
  /** Shows the tab and put into the foreground, if no query is executed yet. */
  private void showTab() {
    if (mainTab == null) {
      mainTab = ui.getMainTab();
    }

    if (mainTab != null) {
      tab = mainTab.getTab(this);
      tab.getComponent().addStyleName("example-queries-tab");
      tab.setEnabled(true);

      if (!(mainTab.getSelectedTab() instanceof ResultViewPanel)) {
        mainTab.setSelectedTab(tab);
      }
    }
  }
Exemplo n.º 4
0
  public BiblioSearchLimitPanel(
      DatabankSchema schema, MarcQueryBuilder queryBuilder, int language, SearchUI utils) {
    super(new GridBagLayout(), queryBuilder);
    this.schema = schema;
    this.language = language;
    ButtonGroup g;

    props = PropertyUtils.loadProperties(getClass().getName(), LocaleUtils.getLocale(language));
    GuiUtils.setActionName(dateRangeAction, props.getProperty("date_range.name"));
    GuiUtils.setActionName(yearAction, props.getProperty("year.name"));
    this.utils = utils;

    lblCodingLevel = new JLabel(props.getProperty("coding_level.name"));
    cmCodingLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_17);
    cmCodingLevel.setName("biblioCodingLevel");
    lblCodingLevel.setLabelFor(cmCodingLevel);

    lblCataloguingForm = new JLabel(props.getProperty("cataloguing_form.name"));
    cmCataloguingForm = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_18);
    cmCataloguingForm.setName("biblioCataloguingForm");
    lblCataloguingForm.setLabelFor(cmCataloguingForm);

    rBetween = new JRadioButton(props.getProperty("between.name"));
    rBetween.setName("biblioBetweenYears");
    rLt = new JRadioButton(props.getProperty("lt.name"));
    rLt.setName("biblioLessThanYear");
    rGt = new JRadioButton(props.getProperty("gt.name"));
    rGt.setName("biblioGreaterThanYear");
    txfYear = utils.queryTextField(4);
    txfYear.setName("biblioYearEquals");
    rYear = new JRadioButton(yearAction);
    rYear.setName("biblioYear");
    rDateRange = new JRadioButton(dateRangeAction);
    rDateRange.setName("biblioDateRange");
    lblDoctype = new JLabel(props.getProperty("biblio_doctype.name"));
    lblFrom = new JLabel(props.getProperty("from.name"));
    lblTo = new JLabel(props.getProperty("to.name"));
    lblLanguage = new JLabel(props.getProperty("language.name"));
    lblLocation = new JLabel(props.getProperty("location.name"));
    lblRetriveNo = new JLabel(props.getProperty("retriveNo.name"));
    lblRecType = new JLabel(props.getProperty("rectype.name"));
    lblRecStatus = new JLabel(props.getProperty("recstatus.name"));
    lblCalendar = new JLabel(props.getProperty("calendar.name"));
    lblBiblevel = new JLabel(props.getProperty("biblevel.name"));
    lblHierarchicalLevel = new JLabel(props.getProperty("hierarchical_level.name"));
    cmDoctype = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_DOC_TYPE);
    cmDoctype.setName("biblioDocType");
    cmLocation = utils.constantTableLookup(SearchEngineDocumentModel.LOCATION);
    cmLocation.setName("biblioLocation");
    cmLanguage = utils.constantTableLookup(SearchEngineDocumentModel.LANGUAGE);
    cmLanguage.setName("biblioLanguage");
    cmBiblevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_7);
    cmBiblevel.setName("biblioLevel");
    cmHierarchicalLevel = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_8);
    cmHierarchicalLevel.setName("biblioHierarchicalLevel");
    cmRecType = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_6);
    cmRecType.setName("biblioRecType");
    cmRecStatus = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_LEADER_5);
    cmRecStatus.setName("biblioRecStatus");
    cmCalendar = utils.constantTableLookup(SearchEngineDocumentModel.CALENDAR);
    cmCalendar.setName("biblioCalendar");
    txfFrom = utils.queryTextField(10);
    txfFrom.setName("biblioFromYear");
    txfTo = utils.queryTextField(10);
    txfTo.setName("biblioToYear");
    txfRetriveNo = utils.queryTextField(10);
    txfRetriveNo.setName("retriveNo");
    lblDoctype.setLabelFor(cmDoctype);
    lblLocation.setLabelFor(cmLocation);
    lblLanguage.setLabelFor(cmLanguage);
    lblFrom.setLabelFor(txfFrom);
    lblTo.setLabelFor(txfTo);
    lblRetriveNo.setLabelFor(txfRetriveNo);
    lblTo.setVerticalTextPosition(JLabel.BOTTOM);
    lblCalendar.setHorizontalAlignment(JLabel.TRAILING);
    lblLanguage.setHorizontalAlignment(JLabel.TRAILING);
    lblRecType.setHorizontalAlignment(JLabel.TRAILING);
    lblDoctype.setHorizontalAlignment(JLabel.TRAILING);
    lblLocation.setHorizontalAlignment(JLabel.TRAILING);
    cbHasAttachment = new JCheckBox(props.getProperty("attachment.name"));
    cbIsOpenShelf = new JCheckBox(props.getProperty("openShelf.name"));
    cbIsLendable = new JCheckBox(props.getProperty("lendable.name"));
    rWithAttachment = new JRadioButton(props.getProperty("attachment-present.name"));
    rWithoutAttachment = new JRadioButton(props.getProperty("attachment-notpresent.name"));
    cbHasAttachment.setName("biblioAttachment");
    cbIsOpenShelf.setName("holdingIsOpenShelf");
    cbIsLendable.setName("holdingIsLendable");
    rWithAttachment.setName("biblioAttachmentPresent");
    rWithoutAttachment.setName("biblioAttachmentNotPresent");
    cbHasAttachment.addChangeListener(attachmentChangedListener);
    rWithAttachment.setEnabled(false);
    rWithoutAttachment.setEnabled(false);
    cbHasAttachment.setSelected(false);
    cbIsOpenShelf.setSelected(false);
    cbIsLendable.setSelected(false);
    g = new ButtonGroup();
    g.add(rWithAttachment);
    g.add(rWithoutAttachment);

    g = new ButtonGroup();
    g.add(rBetween);
    g.add(rLt);
    g.add(rGt);
    g = new ButtonGroup();
    g.add(rDateRange);
    g.add(rYear);
    rYear.setSelected(true);
    dateCriteriaChanged();

    lblDescriptionLevel = new JLabel(props.getProperty("level-of-description.name"));
    cmDescriptionLevel =
        utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_ISAD_LEVEL_OF_DESCRIPTION);
    cmDescriptionLevel.setName("biblioDescriptionLevel");
    lblDescriptionLevel.setLabelFor(cmDescriptionLevel);

    lblGMD = new JLabel(props.getProperty("general-material.name"));
    cmGMD = utils.constantTableLookup(SearchEngineDocumentModel.BIBLIO_GMD_LIST);
    cmGMD.setName("biblioGMD");
    lblGMD.setLabelFor(cmGMD);

    lblLCClass = new JLabel(props.getProperty("lcclass.name"));
    txfLCClass = new JTextField(20);
    GuiUtils.localeSupport(txfLCClass);
    GuiUtils.setComponentOrientation(txfLCClass, ComponentOrientation.LEFT_TO_RIGHT);
    lblLCClass.setLabelFor(txfLCClass);

    LayoutFacility lf = new LayoutFacility(this);
    /*
            lf.add(lblCodingLevel,
                    new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
            lf.add(cmCodingLevel,
                    new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */
    int y = 0;
    lf.add(
        lblDoctype,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmDoctype,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecType,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecType,
        new GridBagConstraints(
            3,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblGMD,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmGMD,
        new GridBagConstraints(
            1,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lblLocation,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLocation,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblLanguage,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmLanguage,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblBiblevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmBiblevel,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCataloguingForm,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCataloguingForm,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblHierarchicalLevel,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmHierarchicalLevel,
        new GridBagConstraints(
            3,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblRecStatus,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmRecStatus,
        new GridBagConstraints(
            5,
            y++,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    ////
    lf.add(
        lblCodingLevel,
        new GridBagConstraints(
            4,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCodingLevel,
        new GridBagConstraints(
            5,
            y,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        rYear,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        txfYear,
        new GridBagConstraints(
            1,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        lblCalendar,
        new GridBagConstraints(
            2,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    lf.add(
        cmCalendar,
        new GridBagConstraints(
            3,
            y++,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        rDateRange,
        new GridBagConstraints(
            0,
            y,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.FIRST_LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility datelf = new LayoutFacility(new JPanel());
    datelf.add(
        lblFrom,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfFrom,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rGt,
        new GridBagConstraints(
            3,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rBetween,
        new GridBagConstraints(
            4,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        rLt,
        new GridBagConstraints(
            5,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        lblTo,
        new GridBagConstraints(
            6,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    datelf.add(
        txfTo,
        new GridBagConstraints(
            7,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));
    datelf.add(
        Box.createHorizontalGlue(),
        new GridBagConstraints(
            8,
            1,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_END,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        datelf.container,
        new GridBagConstraints(
            1,
            y++,
            GridBagConstraints.REMAINDER,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility lcClasslf = new LayoutFacility(new JPanel());
    lcClasslf.add(
        lblLCClass,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 5, 2, 5),
            0,
            0));
    lcClasslf.add(
        txfLCClass,
        new GridBagConstraints(
            2,
            1,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    lf.add(
        lcClasslf.container,
        new GridBagConstraints(
            0,
            y++,
            2,
            1,
            1.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL,
            new Insets(2, 2, 2, 2),
            0,
            0));

    LayoutFacility attLf = LayoutFacility.createLayoutFacility();
    int x = 0;
    attLf.add(
        cbHasAttachment,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    attLf.add(
        cbIsOpenShelf,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        attLf.add(cbIsLendable,
    //        		new GridBagConstraints(x++, 0, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.NONE, new Insets(2, 2, 2, 10), 0, 0));
    attLf.add(
        lblRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 20, 2, 2),
            0,
            0));
    attLf.add(
        txfRetriveNo,
        new GridBagConstraints(
            x++,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            25,
            0));

    if (SystemUtils.isISADAvailable()) {
      attLf.add(
          lblDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.HORIZONTAL,
              new Insets(2, 20, 2, 2),
              0,
              0));
      attLf.add(
          cmDescriptionLevel,
          new GridBagConstraints(
              x++,
              0,
              1,
              1,
              0.0,
              0.0,
              GridBagConstraints.LINE_START,
              GridBagConstraints.NONE,
              new Insets(2, 2, 2, 2),
              0,
              0));
    }

    /*
            attLf.add(rWithAttachment,
                    new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
            attLf.add(rWithoutAttachment,
                    new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));
    */

    lf.add(
        attLf.container,
        new GridBagConstraints(
            0,
            y,
            GridBagConstraints.REMAINDER,
            1,
            0.0,
            0.0,
            GridBagConstraints.LINE_START,
            GridBagConstraints.NONE,
            new Insets(2, 2, 2, 2),
            0,
            0));
    //        lf.add(Box.createHorizontalGlue(),
    //                new GridBagConstraints(1, 4, 0, 1, 0.0, 0.0, GridBagConstraints.LINE_START,
    // GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));

    ChangeListener limitChangeListener =
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            txfFrom.setEditable(!rLt.isSelected() && rDateRange.isSelected());
            txfTo.setEditable(!rGt.isSelected() && rDateRange.isSelected());
          }
        };
    rGt.addChangeListener(limitChangeListener);
    rLt.addChangeListener(limitChangeListener);
    rBetween.addChangeListener(limitChangeListener);
    rGt.setSelected(true);
  }