Package net.sf.jlogmicro.util.logging

Examples of net.sf.jlogmicro.util.logging.Logger


     */
  final private static RuntimeException handleError(String method,
      Throwable e) {
    Common.debugErr(e.getMessage());
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("View");
    logger.severe(method + " ", e);
    //#endif
    return new RuntimeException(e.getMessage());
  }
View Full Code Here


  throws Exception {
    //#ifdef DTEST
    Common.debug("estimateHeight() started");
    //#endif
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("View");
    boolean finestLoggable = logger.isLoggable(Level.FINEST);
    //#endif
    View view = new View();
    view.width = aWidth;
    view.height = aMaxHeight;
    view.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN |
          (aUnderlinedStyle ? Font.STYLE_UNDERLINED : 0),
        aFontSize));
    view.page = aPage;
    int svpos = aPage.getPosition();
    aPage.setPosition(0);
        view.setPosition(0);
    try {
      int count = 0;
      /* Use some upper limit to prevent an infinate loop. */
      int maxLines = (aMaxHeight > 0) ? (2 * view.screen.size()) :
        (aPage.size / 80);
      //#ifdef DLOGGING
      String line;
      for (; ((maxLines == 0) || (count < maxLines)) &&
          ((line = view.nextLine()) != null); count++) {
        //#ifdef DLOGGING
        if (finestLoggable) {logger.finest("estimateHeight count,line=" + count + "," + line);}
        //#endif
      }
      //#else
      for (; ((maxLines == 0) || (count < maxLines)) &&
          (view.nextLine() != null); count++) {
View Full Code Here

     */
  final private static RuntimeException handleError(String method,
      Throwable e) {
    Common.debugErr(e.getMessage());
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("View");
    logger.severe(method + " ", e);
    //#endif
    return new RuntimeException(e.getMessage());
  }
View Full Code Here

   * @author Irv Bunton
   */
    final public static Command getCmdRsc(String key, int commandType,
      int priority) {
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("UiUtil");
    logger.finest("key,commandType,priority=" + key + "," + commandType + "," + priority);
    //#endif
    return new Command(ResourceProviderME.get(key), commandType, priority);
  }
View Full Code Here

   * @author Irv Bunton
   */
    final public static Command getCmdRsc(String key, String lngkey,
      int commandType, int priority) {
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("UiUtil");
    logger.finest("key,lngkey,commandType,priority=" + key + "," + lngkey + "," + commandType + "," + priority);
    //#endif
    //#ifdef DMIDP20
    if (lngkey != null) {
      return new Command(ResourceProviderME.get(key),
          ResourceProviderME.get(lngkey), commandType, priority);
View Full Code Here

  }

  /* Restore previous values. */
  final static public void restorePrevValues(Item[] items, byte[] bdata) {
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("UiUtil");
    boolean finestLoggable = logger.isLoggable(Level.FINEST);
    //#endif
    DataInputStream dis = new DataInputStream(
        new ByteArrayInputStream(bdata));
    for (int ic = 0; ic < items.length; ic++) {
      try {
        final Item item = items[ic];
        if (item instanceof ChoiceGroup) {
          ((ChoiceGroup)item).setSelectedIndex(dis.readInt(),
            true);
          //#ifdef DLOGGING
          if (finestLoggable) {logger.finest("set selected " + ((ChoiceGroup)item).getSelectedIndex());}
          //#endif
        } else if (item instanceof TextField) {
          final int len = dis.readInt();
          byte [] bvalue = new byte[len];
          dis.read(bvalue);
          String value;
          try {
            value = new String(bvalue, "UTF-8");
          } catch (UnsupportedEncodingException e) {
            value = new String(bvalue);
            //#ifdef DLOGGING
            logger.severe("cannot convert value=" + value, e);
            //#endif
          }
          ((TextField)item).setString(value);
          //#ifdef DLOGGING
          if (finestLoggable) {logger.finest("set string " + ((TextField)item).getString());}
          //#endif
        }
      } catch (IOException e) {
        //#ifdef DLOGGING
        logger.severe("IOException reading selected.", e);
        //#endif
      }
    }
    if (dis != null) {
      try { dis.close(); } catch (IOException e) {}
View Full Code Here

  }

  /* Store current values. */
  final public static byte[] storeValues(Item[] items) {
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("UiUtil");
    boolean finestLoggable = logger.isLoggable(Level.FINEST);
    //#endif
    ByteArrayOutputStream bout = new
        ByteArrayOutputStream();
    DataOutputStream dout = new
        DataOutputStream( bout );
    for (int ic = 0; ic < items.length; ic++) {
      try {
        final Item item = items[ic];
        if (item instanceof ChoiceGroup) {
          dout.writeInt(((ChoiceGroup)item).getSelectedIndex());
          //#ifdef DLOGGING
          if (finestLoggable) {logger.finest("stored selected " + item.getLabel() + "," + ((ChoiceGroup)item).getSelectedIndex());}
          //#endif
        } else if (item instanceof TextField) {
          final String value = ((TextField)item).getString();
          dout.writeInt(value.length());
          byte [] bvalue;
          try {
            bvalue = value.getBytes("UTF-8");
          } catch (UnsupportedEncodingException e) {
            bvalue = value.getBytes();
            //#ifdef DLOGGING
            logger.severe("cannot store value=" + value, e);
            //#endif
          }
          dout.write( bvalue, 0, bvalue.length );
          //#ifdef DLOGGING
          if (finestLoggable) {logger.finest("set string " + item.getLabel() + "," + ((TextField)item).getString());}
          //#endif
        }
      } catch (IOException e) {
        //#ifdef DLOGGING
        logger.severe("IOException storing selected.", e);
        //#endif
      }
    }
    //#ifdef DLOGGING
    if (finestLoggable) {logger.finest("bout.toByteArray().length=" + bout.toByteArray().length);}
    //#endif
    if (dout != null) {
      try { dout.close(); } catch (IOException e) {}
    }
    return bout.toByteArray();
View Full Code Here

        }
        image = Image.createImage(is);
        is.close();
        //#endif
        //#ifdef DLOGGING
        Logger logger = Logger.getLogger("UiUtil");
        logger.warning(
            "Could not get icon, alternate worked icons ex: ", e);
        //#endif
      }
    } catch(Exception e) {
      //#ifdef DLOGGING
      Logger logger = Logger.getLogger("UiUtil");
      logger.severe("Could not get image " + imagePath, e);
      //#endif
      System.err.println("Error while getting mark image: " + e.toString());
    } finally {
      return image;
    }
View Full Code Here

  }

  public static void showAlert(MIDlet midlet, Alert alert,
      Displayable disp) {
    //#ifdef DLOGGING
    Logger logger = Logger.getLogger("UiUtil");
    logger.finest("alert,disp=" + alert.getString() + "," + alert.getType());
    //#endif
    if (alert.getType() == AlertType.CONFIRMATION) {
      //#ifdef DLOGGING
      logger.finest("Alert not displayed when type is CONFIRMATION, changing to INFO");
      //#endif
      alert.setType(AlertType.INFO);
    }
    Display.getDisplay(midlet).setCurrent(alert, disp);
  }
View Full Code Here

        text = replaceSpUniChars(text);
      }
      text = text.replace(CNON_BREAKING_SP, ' ');
    } catch (Throwable t) {
      //#ifdef DLOGGING
      Logger logger = Logger.getLogger("EncodingUtil");
            logger.severe("replaceSpChars error ", t);
      //#endif
            System.out.println("replaceSpChars error " + t + "," +
                     t.getMessage());
    }
    return text;
View Full Code Here

TOP

Related Classes of net.sf.jlogmicro.util.logging.Logger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.