Ejemplo n.º 1
0
 /**
  * Check if the server is ok
  *
  * @return status code
  */
 protected int checkIfServerIsOk() {
   try {
     StringBuffer buff = getUrl(REQ_TEXT);
     appendKeyValue(buff, PROP_FILE, FILE_PUBLICSRV);
     URL url = new URL(buff.toString());
     URLConnection urlc = url.openConnection();
     InputStream is = urlc.getInputStream();
     is.close();
     return STATUS_OK;
   } catch (AddeURLException ae) {
     String aes = ae.toString();
     if (aes.indexOf("Invalid project number") >= 0) {
       LogUtil.userErrorMessage("Invalid project number");
       return STATUS_NEEDSLOGIN;
     }
     if (aes.indexOf("Invalid user id") >= 0) {
       LogUtil.userErrorMessage("Invalid user ID");
       return STATUS_NEEDSLOGIN;
     }
     if (aes.indexOf("Accounting data") >= 0) {
       return STATUS_NEEDSLOGIN;
     }
     if (aes.indexOf("cannot run server 'txtgserv") >= 0) {
       return STATUS_OK;
     }
     LogUtil.userErrorMessage("Error connecting to server. " + ae.getMessage());
     return STATUS_ERROR;
   } catch (Exception exc) {
     logException("Connecting to server:" + getServer(), exc);
     return STATUS_ERROR;
   }
 }
Ejemplo n.º 2
0
    /**
     * Create a Transferable to use as the source for a data transfer.
     *
     * @param c The component holding the data to be transfered. This argument is provided to enable
     *     sharing of TransferHandlers by multiple components.
     * @return The representation of the data to be transfered.
     */
    protected Transferable createTransferable(JComponent c) {
      Object[] values = null;
      if (c instanceof JList) {
        values = ((JList) c).getSelectedValues();
      } else if (c instanceof JTable) {
        JTable table = (JTable) c;
        int[] rows = table.getSelectedRows();
        if (rows != null) {
          values = new Object[rows.length];
          for (int i = 0; i < rows.length; i++) {
            values[i] = table.getValueAt(rows[i], 0);
          }
        }
      }
      if (values == null || values.length == 0) {
        return null;
      }

      StringBuffer plainBuf = new StringBuffer();
      StringBuffer htmlBuf = new StringBuffer();

      htmlBuf.append("<html>\n<body>\n<ul>\n");

      for (Object obj : values) {
        String val = ((obj == null) ? "" : obj.toString());
        plainBuf.append(val + "\n");
        htmlBuf.append("  <li>" + val + "\n");
      }

      // remove the last newline
      plainBuf.deleteCharAt(plainBuf.length() - 1);
      htmlBuf.append("</ul>\n</body>\n</html>");

      return new FileTransferable(plainBuf.toString(), htmlBuf.toString(), values);
    }
Ejemplo n.º 3
0
 /**
  * Get the <code>String</code> that represents this <code>MetSymbol</code>.
  *
  * @return <code>String</code> representation.
  */
 public String toString() {
   StringBuffer sb = new StringBuffer(super.toString());
   for (String s : paramIds) {
     sb.append(" param:" + s);
   }
   return sb.toString();
 }
Ejemplo n.º 4
0
  /** Capture an image for all ViewManagers */
  public void captureAll() {
    List vms = getViewManagers();

    String filename = FileManager.getWriteFile(FileManager.FILTER_IMAGE, FileManager.SUFFIX_JPG);
    if (filename == null) {
      return;
    }
    String root = IOUtil.stripExtension(filename);
    String ext = IOUtil.getFileExtension(filename);

    StringBuffer sb = new StringBuffer("<html>");
    sb.append("Since there were multiple images they were written out as:<ul>");
    for (int i = 0; i < vms.size(); i++) {
      ViewManager vm = (ViewManager) vms.get(i);
      String name = vm.getName();
      if ((name == null) || (name.trim().length() == 0)) {
        name = "" + (i + 1);
      }
      if (vms.size() != 1) {
        filename = root + name + ext;
      }

      sb.append("<li> " + filename);
      vm.writeImage(filename);
    }
    sb.append("</ul></html>");
    if (vms.size() > 1) {
      GuiUtils.showDialog("Captured Images", GuiUtils.inset(new JLabel(sb.toString()), 5));
    }
  }
    public void doActionOnButton3() {
      //            Sector sector = Sector.fromDegrees( 44d, 46d, -123.3d, -123.2d );

      ArrayList<LatLon> latlons = new ArrayList<LatLon>();

      latlons.add(LatLon.fromDegrees(45.50d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.51d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.52d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.53d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.54d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.55d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.56d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.57d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.58d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.59d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.60d, -123.3d));

      ElevationModel model = this.wwd.getModel().getGlobe().getElevationModel();

      StringBuffer sb = new StringBuffer();
      for (LatLon ll : latlons) {
        double e = model.getElevation(ll.getLatitude(), ll.getLongitude());
        sb.append("\n").append(e);
      }

      Logging.logger().info(sb.toString());
    }
Ejemplo n.º 6
0
  protected String getFeatureText() {
    String txt = "";
    try {
      txt = ((HTMLDocument) getDocument()).getText(0, getDocument().getLength()).trim();

      StringBuffer buff = new StringBuffer();
      StringTokenizer tok = new StringTokenizer(txt, "/");
      int ntok = 0;

      while (tok.hasMoreTokens()) {
        String tokTxt = "/" + tok.nextToken().trim();

        int ind = tokTxt.indexOf("=");

        if (ntok != 0 && ind > -1 && qualifier.contains(tokTxt.substring(0, ind + 1)))
          buff.append("\n" + tokTxt);
        else buff.append(tokTxt);

        ntok++;
      }

      txt = buff.toString();
    } catch (BadLocationException ble) {
      ble.printStackTrace();
    }

    return txt;
  }
Ejemplo n.º 7
0
  private MainPanel() {
    super(new BorderLayout());
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < 100; i++) {
      String s = i + LF;
      buf.append(s);
    }

    final JScrollPane scrollPane = new JScrollPane(new JTextArea(buf.toString()));
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    JSpinner spinner =
        new JSpinner(
            new SpinnerNumberModel(
                scrollPane.getVerticalScrollBar().getUnitIncrement(1), 1, 100000, 1));
    spinner.setEditor(new JSpinner.NumberEditor(spinner, "#####0"));
    spinner.addChangeListener(
        new ChangeListener() {
          @Override
          public void stateChanged(ChangeEvent e) {
            JSpinner s = (JSpinner) e.getSource();
            scrollPane.getVerticalScrollBar().setUnitIncrement((Integer) s.getValue());
          }
        });
    Box box = Box.createHorizontalBox();
    box.add(new JLabel("Unit Increment:"));
    box.add(Box.createHorizontalStrut(2));
    box.add(spinner);
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(box, BorderLayout.NORTH);
    add(scrollPane);
    setPreferredSize(new Dimension(320, 240));
  }
Ejemplo n.º 8
0
 private String bigIntToHexString(BigInteger bi) {
   StringBuffer buf = new StringBuffer();
   buf.append("0x");
   String val = bi.toString(16);
   for (int i = 0; i < ((2 * addressSize) - val.length()); i++) {
     buf.append('0');
   }
   buf.append(val);
   return buf.toString();
 }
Ejemplo n.º 9
0
  protected void _save() {
    jEdit.setBooleanProperty("view.showToolbar", showToolbar.isSelected());

    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < listModel.getSize(); i++) {
      if (i != 0) buf.append(' ');
      Button button = (Button) listModel.elementAt(i);
      buf.append(button.actionName);
      jEdit.setProperty(button.actionName + ".icon", button.iconName);
    }
    jEdit.setProperty("view.toolbar", buf.toString());
  }
Ejemplo n.º 10
0
  /** Places the selected text into the clipboard. */
  public void copy() {
    if (selectionStart != selectionEnd) {
      Clipboard clipboard = getToolkit().getSystemClipboard();

      String selection = getSelectedText();

      int repeatCount = inputHandler.getRepeatCount();
      StringBuffer buf = new StringBuffer();
      for (int i = 0; i < repeatCount; i++) buf.append(selection);

      clipboard.setContents(new StringSelection(buf.toString()), null);
    }
  }
Ejemplo n.º 11
0
 /**
  * A utility method to make a name=value part of the adde request string
  *
  * @param buf The buffer to append to
  * @param name The property name
  * @param value The value
  */
 protected void appendKeyValue(StringBuffer buf, String name, String value) {
   if ((buf.length() == 0) || (buf.charAt(buf.length() - 1) != '?')) {
     buf.append("&");
   }
   buf.append(name);
   buf.append("=");
   buf.append(value);
 }
Ejemplo n.º 12
0
  /**
   * Attempts to insert a string into the document. Produces a system beep if the input does not
   * represent a positive (or zero) integer.
   */
  public void insertString(int offset, String str, AttributeSet a) throws BadLocationException {
    StringBuffer intString;

    // Ignore zero-length and null strings
    if (str == null || str.length() == 0) return;

    intString = new StringBuffer(getText(0, getLength()));
    intString.insert(offset, str);

    try {
      int theInt = new Integer(intString.toString()).intValue();
      if (theInt < 0 || !allowZero && theInt == 0) {
        throw new NumberFormatException();
      }
      super.insertString(offset, str, a);
    } catch (NumberFormatException e) {
      Toolkit.getDefaultToolkit().beep();
    }
  }
Ejemplo n.º 13
0
  // ask user for script file and name of new profile
  // return false if user cancelled operation
  private boolean getNewWkldInput(
      JFileChooser chooser, Object[] optionDlgMsg, StringBuffer name, StringBuffer scriptFile) {
    // let user select script file with queries
    boolean fileOk = false;
    int retval;
    File file = null;
    FileReader reader = null;
    while (!fileOk) {
      if ((retval = chooser.showDialog(this, "Ok")) != 0) {
        return false;
      }
      file = chooser.getSelectedFile();
      try {
        reader = new FileReader(file.getPath());
        fileOk = true;
        scriptFile.append(file.getPath());
      } catch (FileNotFoundException e) {
        JOptionPane.showMessageDialog(
            this,
            "Selected script file does not exist",
            "Error: New Profile",
            JOptionPane.ERROR_MESSAGE);
      }
    }

    // let user select filename for profile
    int response =
        JOptionPane.showOptionDialog(
            this,
            optionDlgMsg,
            "New Profile",
            JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.PLAIN_MESSAGE,
            null,
            null,
            null);
    if (response != JOptionPane.OK_OPTION) {
      return false;
    }
    JTextField textFld = (JTextField) optionDlgMsg[1];
    name.append(file.getParent() + "/" + textFld.getText());
    return true;
  }
Ejemplo n.º 14
0
 /**
  * Read the groups from the public.srv file on the server
  *
  * @return List of groups
  */
 protected List readGroups() {
   List groups = new ArrayList();
   try {
     String dataType = getDataType();
     String type = ((dataType.length() > 0) ? "TYPE=" + dataType : "TYPE=NOTYPE");
     StringBuffer buff = getUrl(REQ_TEXT);
     appendKeyValue(buff, PROP_FILE, FILE_PUBLICSRV);
     List lines = readTextLines(buff.toString());
     //            System.err.println ("lines:" + StringUtil.join("\n",lines));
     if (lines == null) {
       return null;
     }
     Hashtable seen = new Hashtable();
     for (int i = 0; i < lines.size(); i++) {
       String line = lines.get(i).toString();
       if (line.indexOf(type) < 0) {
         continue;
       }
       List toks = StringUtil.split(line, ",", true, true);
       if (toks.size() == 0) {
         continue;
       }
       String tok = (String) toks.get(0);
       int idx = tok.indexOf("=");
       if (idx < 0) {
         continue;
       }
       if (!tok.substring(0, idx).trim().equals("N1")) {
         continue;
       }
       String group = tok.substring(idx + 1).trim();
       if (seen.get(group) != null) {
         continue;
       }
       seen.put(group, group);
       groups.add(group);
     }
   } catch (Exception e) {
     return null;
   }
   return groups;
 }
Ejemplo n.º 15
0
 private String physReadTextFile(File file) {
   // physically read text file
   try {
     BufferedReader input = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
     StringBuffer tmp = new StringBuffer();
     while (input.ready()) {
       tmp.append(input.readLine());
       tmp.append("\n");
     }
     return tmp.toString();
   } catch (FileNotFoundException e) {
     // not sure how this can happen
     showErrorDialog("Unable to load \"" + file.getName() + "\" (file not found)");
   } catch (IOException e) {
     // This happens if e.g. file already exists and
     // we do not have write permissions
     showErrorDialog("Unable to load \"" + file.getName() + "\" (I/O error)");
   }
   return new String("");
 }
Ejemplo n.º 16
0
  /*.................................................................................................................*/
  public void appendToConfigFileGeneral(StringBuffer config) {
    if (config != null) {
      config.append("\ndatafname=" + dataFileName);
      config.append("\nofprefix=" + ofprefix);

      if (useConstraintTree == 0) config.append("\nconstraintfile = none");
      else config.append("\nconstraintfile = constraintTree"); // important to be user-editable

      config.append("\nstreefname = random");

      config.append("\navailablememory = " + availMemory + " \n");
      config.append(" \noutputmostlyuselessfiles = 0");

      config.append("\n\nrandseed = " + randseed); // important to be user-editable

      config.append("\nsearchreps = " + numRuns);

      config.append("\n");
    }
  }
Ejemplo n.º 17
0
  /** Returns the selected text, or null if no selection is active. */
  public final String getSelectedText() {
    if (selectionStart == selectionEnd) return null;

    if (rectSelect) {
      // Return each row of the selection on a new line

      Element map = document.getDefaultRootElement();

      int start = selectionStart - map.getElement(selectionStartLine).getStartOffset();
      int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset();

      // Certain rectangles satisfy this condition...
      if (end < start) {
        int tmp = end;
        end = start;
        start = tmp;
      }

      StringBuffer buf = new StringBuffer();
      Segment seg = new Segment();

      for (int i = selectionStartLine; i <= selectionEndLine; i++) {
        Element lineElement = map.getElement(i);
        int lineStart = lineElement.getStartOffset();
        int lineEnd = lineElement.getEndOffset() - 1;
        int lineLen = lineEnd - lineStart;

        lineStart = Math.min(lineStart + start, lineEnd);
        lineLen = Math.min(end - start, lineEnd - lineStart);

        getText(lineStart, lineLen, seg);
        buf.append(seg.array, seg.offset, seg.count);

        if (i != selectionEndLine) buf.append('\n');
      }

      return buf.toString();
    } else {
      return getText(selectionStart, selectionEnd - selectionStart);
    }
  }
Ejemplo n.º 18
0
  /** Inserts the clipboard contents into the text. */
  public void paste() {
    if (editable) {
      Clipboard clipboard = getToolkit().getSystemClipboard();
      try {
        // The MacOS MRJ doesn't convert \r to \n,
        // so do it here
        String selection =
            ((String) clipboard.getContents(this).getTransferData(DataFlavor.stringFlavor))
                .replace('\r', '\n');

        int repeatCount = inputHandler.getRepeatCount();
        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < repeatCount; i++) buf.append(selection);
        selection = buf.toString();
        setSelectedText(selection);
      } catch (Exception e) {
        getToolkit().beep();
        System.err.println("Clipboard does not" + " contain a string");
      }
    }
  }
    public void doActionOnButton2() {
      ArrayList<LatLon> latlons = new ArrayList<LatLon>();

      latlons.add(LatLon.fromDegrees(45.50d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.51d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.52d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.53d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.54d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.55d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.56d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.57d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.58d, -123.3d));
      //            latlons.add( LatLon.fromDegrees( 45.59d, -123.3d ) );
      latlons.add(LatLon.fromDegrees(45.60d, -123.3d));

      Sector sector = Sector.fromDegrees(44d, 46d, -123d, -121d);
      //            Sector sector = Sector.boundingSector( latlons );

      double[] elevations = new double[latlons.size()];

      // request resolution of DTED2 (1degree / 3600 )
      double targetResolution = Angle.fromDegrees(1d).radians / 3600;

      double resolutionAchieved =
          this.wwd
              .getModel()
              .getGlobe()
              .getElevationModel()
              .getElevations(sector, latlons, targetResolution, elevations);

      StringBuffer sb = new StringBuffer();
      for (double e : elevations) {
        sb.append("\n").append(e);
      }
      sb.append("\nresolutionAchieved = ").append(resolutionAchieved);
      sb.append(", requested resolution = ").append(targetResolution);

      Logging.logger().info(sb.toString());
    }
  /**
   * ************************************************************************ Initialize Table
   * access - create SQL, dateColumn. <br>
   * The driving table is "hdr", e.g. for hdr.C_BPartner_ID=.. The line table is "lin", e.g. for
   * lin.M_Product_ID=.. You use the dateColumn/qtyColumn variable directly as it is table specific.
   * <br>
   * The sql is dependent on MatchMode: - If Matched - all (fully or partially) matched records are
   * listed - If Not Matched - all not fully matched records are listed
   *
   * @param display (Invoice, Shipment, Order) see MATCH_*
   * @param matchToType (Invoice, Shipment, Order) see MATCH_*
   */
  private static void tableInit() {
    m_sql = new StringBuffer();

    if (tableInit_option == 0) {
      m_sql.append(
          "SELECT value,tab.M_Product_ID,tab.Name "
              + "FROM M_Product tab "
              + "WHERE XX_VMR_VENDORPRODREF_ID="
              + LineRefProv.getXX_VMR_VendorProdRef_ID()
              + " "
              + "AND ISACTIVE='Y' "
              + "AND M_ATTRIBUTESET_ID = "
              + Env.getCtx().getContextAsInt("#XX_L_P_ATTRIBUTESETST_ID"));

      /*//Si caracteristica larga es null
      if(LineRefProv.getXX_VMR_LongCharacteristic_ID()!=0)
      {
      	m_sql.append("AND XX_VMR_LONGCHARACTERISTIC_ID="+LineRefProv.getXX_VMR_LongCharacteristic_ID()+" ");
      }
      else{
      	m_sql.append("AND XX_VMR_LONGCHARACTERISTIC_ID IS NULL ");
      }*/

      m_orderBy = " order by M_Product_ID";
    } else if (tableInit_option == 1) {
      m_sql.append(
          "SELECT value,tab.M_Product_ID,tab.Name "
              + "FROM M_Product tab "
              + "WHERE tab.M_Product_ID IN "
              + "(select M_Product from XX_VMR_REFERENCEMATRIX where XX_VMR_PO_LINEREFPROV_ID="
              + (Integer) LineRefProv.getXX_VMR_PO_LineRefProv_ID()
              + ")");
    } else if (tableInit_option == 2) {
      m_sql.append(
          "SELECT value,tab.M_Product_ID,tab.Name "
              + "FROM M_Product tab "
              + "WHERE XX_VMR_VENDORPRODREF_ID = 0 AND M_PRODUCT_ID = 0");
    }
  } //  tableInit
 private InputStream getReport(
     HttpServletRequest request,
     HttpServletResponse response,
     Tab tab,
     TableModel tableModel,
     Integer columnCountLimit)
     throws ServletException, IOException {
   StringBuffer suri = new StringBuffer();
   suri.append("/xava/jasperReport");
   suri.append("?language=");
   suri.append(Locales.getCurrent().getLanguage());
   suri.append("&widths=");
   suri.append(Arrays.toString(getWidths(tableModel)));
   if (columnCountLimit != null) {
     suri.append("&columnCountLimit=");
     suri.append(columnCountLimit);
   }
   response.setCharacterEncoding(XSystem.getEncoding());
   return Servlets.getURIAsStream(request, response, suri.toString());
 }
  /**
   * Fill the table using m_sql
   *
   * @param table table
   */
  private static void tableLoad(MiniTable table) {
    //	log.finest(m_sql + " - " +  m_groupBy);
    String sql =
        MRole.getDefault()
                .addAccessSQL(m_sql.toString(), "tab", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO)
            + m_groupBy
            + m_orderBy;

    log.finest(sql);
    try {
      Statement stmt = DB.createStatement();
      ResultSet rs = stmt.executeQuery(sql);
      table.loadTable(rs);
      stmt.close();
    } catch (SQLException e) {
      log.log(Level.SEVERE, sql, e);
    }
  } //  tableLoad
Ejemplo n.º 23
0
 public String toString() {
   if (StringUtil.isEmptyString(alias)) return name;
   if (isShowFileName()) {
     StringBuffer sb = new StringBuffer();
     sb.append(alias);
     sb.append("(");
     sb.append(name);
     sb.append(")");
     return sb.toString();
   } else {
     return alias;
   }
 }
 private String fileNameString(File[] files) {
   StringBuffer buf = new StringBuffer();
   for (int i = 0; files != null && i < files.length; i++) {
     if (i > 0) {
       buf.append(" ");
     }
     if (files.length > 1) {
       buf.append("\"");
     }
     buf.append(fileNameString(files[i]));
     if (files.length > 1) {
       buf.append("\"");
     }
   }
   return buf.toString();
 }
Ejemplo n.º 25
0
  private void update() {
    int lower = -1;
    int upper = -1;

    try {
      Object obj = _getMethod.invoke(_container.getTarget(), _noArg);
      if (obj instanceof MMultiplicity) {
        MMultiplicity mult = (MMultiplicity) obj;
        lower = mult.getLower();
        upper = mult.getUpper();
      }
    } catch (Exception e) {
      System.out.println(e.toString() + " in UMLMultiplicityComboBox.update()");
    }
    boolean match = false;
    for (int i = 0; i < _mults.length; i++) {
      if (lower == _lower[i] && upper == _upper[i]) {
        setSelectedIndex(i);
        match = true;
        break;
      }
    }
    if (!match) {
      StringBuffer buf = new StringBuffer();
      if (lower <= 0) {
        buf.append("0..");
      } else {
        buf.append(Integer.toString(lower));
        buf.append("..");
      }
      if (upper < 0) {
        buf.append("*");
      } else {
        buf.append(Integer.toString(upper));
      }
      setSelectedItem(buf.toString());
    }
  }
Ejemplo n.º 26
0
  /**
   * 「サービスの名称を取得する。」のためのSQLを返します。
   *
   * @param sqlParam SQL構築に必要なパラメタを格納したハッシュマップ
   * @throws Exception 処理例外
   * @return SQL文
   */
  public String getSQL_GET_SPECIAL_PUBLIC_EXPENSE(VRMap sqlParam) throws Exception {
    StringBuffer sb = new StringBuffer();
    Object[] inValues;
    Stack conditionStack = new Stack();
    boolean firstCondition = true;
    Object obj;

    sb.append("SELECT");

    sb.append(" FIRST 1 M_KOHI_SERVICE.KOHI_TYPE");

    sb.append(" FROM");

    sb.append(" M_KOHI_SERVICE");

    sb.append(" WHERE");

    sb.append("(");

    sb.append(" M_KOHI_SERVICE.KOHI_TYPE");

    sb.append(" =");

    sb.append(
        ACSQLSafeIntegerFormat.getInstance().format(VRBindPathParser.get("KOHI_TYPE", sqlParam)));

    sb.append(")");

    sb.append("AND");

    sb.append("(");

    sb.append(" M_KOHI_SERVICE.SYSTEM_SERVICE_KIND_DETAIL");

    sb.append(" =");

    sb.append(
        ACSQLSafeIntegerFormat.getInstance()
            .format(VRBindPathParser.get("SYSTEM_SERVICE_KIND_DETAIL", sqlParam)));

    sb.append(")");

    sb.append("AND");

    sb.append("(");

    sb.append(" M_KOHI_SERVICE.APPLICATION_TYPE");

    sb.append(" =");

    sb.append(
        ACSQLSafeIntegerFormat.getInstance()
            .format(VRBindPathParser.get("APPLICATION_TYPE", sqlParam)));

    sb.append(")");

    return sb.toString();
  }
Ejemplo n.º 27
0
 /*.................................................................................................................*/
 public String preparePreferencesForXML() {
   StringBuffer buffer = new StringBuffer(200);
   StringUtil.appendXMLTag(buffer, 2, "availMemory", availMemory);
   buffer.append(super.preparePreferencesForXML());
   return buffer.toString();
 }
 /** Reflow XML */
 public void doFormat() {
   Vector parts = new Vector();
   char[] chars = original.toCharArray();
   int index = 0;
   int first = 0;
   String part = null;
   while (index < chars.length) {
     // Check for start of tag
     if (chars[index] == '<') {
       // Did we have data before this tag?
       if (first < index) {
         part = new String(chars, first, index - first);
         part = part.trim();
         // Save non-whitespace data
         if (part.length() > 0) {
           parts.addElement(part);
         }
       }
       // Save the start of tag
       first = index;
     }
     // Check for end of tag
     if (chars[index] == '>') {
       // Save the tag
       part = new String(chars, first, index - first + 1);
       parts.addElement(part);
       first = index + 1;
     }
     // Check for end of line
     if ((chars[index] == '\n') || (chars[index] == '\r')) {
       // Was there data on this line?
       if (first < index) {
         part = new String(chars, first, index - first);
         part = part.trim();
         // Save non-whitespace data
         if (part.length() > 0) {
           parts.addElement(part);
         }
       }
       first = index + 1;
     }
     index++;
   }
   // Reflow as XML
   StringBuffer buf = new StringBuffer();
   Object[] list = parts.toArray();
   int indent = 0;
   int pad = 0;
   index = 0;
   while (index < list.length) {
     part = (String) list[index];
     if (buf.length() == 0) {
       // Just add first tag (should be XML header)
       buf.append(part);
     } else {
       // All other parts need to start on a new line
       buf.append('\n');
       // If we're at an end tag then decrease indent
       if (part.startsWith("</")) {
         indent--;
       }
       // Add any indent
       for (pad = 0; pad < indent; pad++) {
         buf.append("  ");
       }
       // Add the tag or data
       buf.append(part);
       // If this is a start tag then increase indent
       if (part.startsWith("<") && !part.startsWith("</") && !part.endsWith("/>")) {
         indent++;
         // Check for special <tag>data</tag> case
         if ((index + 2) < list.length) {
           part = (String) list[index + 2];
           if (part.startsWith("</")) {
             part = (String) list[index + 1];
             if (!part.startsWith("<")) {
               buf.append(part);
               part = (String) list[index + 2];
               buf.append(part);
               index = index + 2;
               indent--;
             }
           }
         }
       }
     }
     index++;
   }
   formatted = new String(buf);
 }
Ejemplo n.º 29
0
 /**
  * Get the miscellaneous URL keywords
  *
  * @return the key value pairs
  */
 public String getMiscKeywords() {
   StringBuffer buff = new StringBuffer();
   appendMiscKeyValues(buff);
   return buff.toString();
 }
Ejemplo n.º 30
0
  public void echoCmd(LibgistCommand cmd) {
    if (!showCmdsItem.getState()) {
      return;
    }

    echoBuffer.setLength(0); // reset
    switch (cmd.cmdType) {
      case LibgistCommand.INSERT:
        echoBuffer.append("insert \"").append(cmd.key);
        echoBuffer.append("\" \"").append(cmd.data).append("\"");
        break;

      case LibgistCommand.REMOVE:
        echoBuffer.append("delete \"").append(cmd.qual);
        echoBuffer.append("\"");
        break;

      case LibgistCommand.FETCH:
        echoBuffer.append("select ");
        if (cmd.fetchLimit > 0) {
          echoBuffer.append(cmd.fetchLimit).append(" ");
        }
        echoBuffer.append("\"").append(cmd.qual).append("\"");
        break;

      case LibgistCommand.CREATE:
        echoBuffer.append("create ").append(cmd.indexName);
        echoBuffer.append(" ").append(cmd.extension);
        break;

      case LibgistCommand.OPEN:
        echoBuffer.append("open ").append(cmd.indexName);
        break;

      case LibgistCommand.CLOSE:
        echoBuffer.append("close");
        break;

      case LibgistCommand.FLUSH:
        echoBuffer.append("flush");
        break;

      case LibgistCommand.OPENANL:
        echoBuffer.append("openanl ").append(cmd.analysisFile.getPath());
        break;

      case LibgistCommand.CLOSEANL:
        echoBuffer.append("closeanl");
        break;

      case LibgistCommand.CREATEANL:
        echoBuffer.append("createanl");
        break;

      case LibgistCommand.SCRIPT:
        echoBuffer.append("executing script...");
        break;

      default:
        // something wrong here
    }
    consoleFrame.echoCmd(echoBuffer.toString());
  }