Exemplo n.º 1
0
 /**
  * Returns the current serialization options.
  *
  * @param mth consider specified serialization method (may be {@code null})
  * @return options
  * @throws BaseXException database exception
  */
 private SerializerOptions options(final SerialMethod mth) throws BaseXException {
   final SerializerOptions sopts = new SerializerOptions();
   sopts.assign(params.getText());
   sopts.set(SerializerOptions.METHOD, SerialMethod.valueOf(method.getSelectedItem()));
   sopts.set(SerializerOptions.ENCODING, encoding.getSelectedItem());
   if (mth == SerialMethod.JSON) {
     final JsonSerialOptions jopts = new JsonSerialOptions();
     jopts.assign(mparams.getText());
     sopts.set(SerializerOptions.JSON, jopts);
   } else if (mth == SerialMethod.CSV) {
     final CsvOptions copts = new CsvOptions();
     copts.assign(mparams.getText());
     sopts.set(SerializerOptions.CSV, copts);
   }
   return sopts;
 }
Exemplo n.º 2
0
 /**
  * Returns the chosen XML file or directory path.
  *
  * @return file or directory
  */
 public String path() {
   return path.getText().trim();
 }
Exemplo n.º 3
0
 /** Opens a file dialog to choose an XML document or directory. */
 private void choose() {
   final IOFile io = new BaseXFileChooser(CHOOSE_DIR, path.getText(), gui).select(Mode.DOPEN);
   if (io != null) path.setText(io.path());
 }