Exemple #1
0
 @Override
 public void action(final Object cmp) {
   creds.setText(TRANSLATION + COLS + creds(lang.getSelectedItem().toString()));
   if (cmp == names) {
     gui.gprop.set(GUIProp.SHOWNAME, names.isSelected());
     gui.notify.layout();
   }
   final int mh = hitsAsProperty();
   label.setText(mh == -1 ? ALL : Integer.toString(mh));
 }
Exemple #2
0
  /**
   * Evaluates the info message resulting from a parsed or executed query.
   *
   * @param msg info message
   * @param ok {@code true} if evaluation was successful
   * @param up update
   */
  public void info(final String msg, final boolean ok, final boolean up) {
    ++threadID;
    errPos = -1;
    errFile = null;
    getEditor().resetError();

    final String m =
        msg.replaceAll("^.*\r?\n\\[.*?\\]", "")
            .replaceAll(".*" + LINE_X.replaceAll("%", ".*?") + COL, "");
    if (ok) {
      info.setCursor(GUIConstants.CURSORARROW);
      info.setText(m, Msg.SUCCESS).setToolTipText(null);
    } else {
      info.setCursor(error(msg) ? GUIConstants.CURSORHAND : GUIConstants.CURSORARROW);
      info.setText(m, Msg.ERROR).setToolTipText(msg);
    }

    if (up) {
      stop.setEnabled(false);
      refreshMark();
    }
  }
Exemple #3
0
    @Override
    public Component getListCellRendererComponent(
        final JList<?> list,
        final Object value,
        final int index,
        final boolean selected,
        final boolean expanded) {

      file = new IOFile(value.toString());
      label.setIcon(BaseXImages.file(file));
      label.setText("");
      label.setToolTipText(ProjectFile.toString(file, true));

      if (selected) {
        label.setBackground(getSelectionBackground());
        label.setForeground(getSelectionForeground());
      } else {
        label.setBackground(GUIConstants.BACK);
        label.setForeground(GUIConstants.TEXT);
      }
      return label;
    }
Exemple #4
0
  @Override
  public void action(final Object comp) {
    final String pth = path();
    final IOFile io = new IOFile(pth);
    String inf = io.isDir() && io.children().length > 0 ? DIR_NOT_EMPTY : null;
    ok = !pth.isEmpty();

    final SerialMethod mth = SerialMethod.valueOf(method.getSelectedItem());
    final OptionsOption<? extends Options> opts =
        mth == SerialMethod.JSON
            ? SerializerOptions.JSON
            : mth == SerialMethod.CSV ? SerializerOptions.CSV : null;
    final boolean showmparams = opts != null;
    mparams.setEnabled(showmparams);

    if (ok) {
      gui.gopts.set(GUIOptions.INPUTPATH, pth);
      try {
        if (comp == method) {
          if (showmparams) {
            final Options mopts = options(null).get(opts);
            mparams.setToolTipText(tooltip(mopts));
            mparams.setText(mopts.toString());
          } else {
            mparams.setToolTipText(null);
            mparams.setText("");
          }
        }
        Serializer.get(new ArrayOutput(), options(mth));
      } catch (final IOException ex) {
        ok = false;
        inf = ex.getMessage();
      }
    }

    info.setText(inf, ok ? Msg.WARN : Msg.ERROR);
    enableOK(buttons, B_OK, ok);
  }
Exemple #5
0
 @Override
 public void eval(final Object arg) {
   final int[] lc = getEditor().pos();
   pos.setText(lc[0] + " : " + lc[1]);
 }
Exemple #6
0
 /**
  * Sets the status text.
  *
  * @param txt the text to be set
  */
 public void setError(final String txt) {
   label.setText(txt);
   label.setForeground(GUIConstants.RED);
 }
Exemple #7
0
 /**
  * Sets the status text.
  *
  * @param txt the text to be set
  */
 public void setText(final String txt) {
   label.setText(txt);
   label.setForeground(Color.BLACK);
 }