public String getMenuDescription(RequestProperties reqState, String parentMenuName) {
   PrivateLabel privLabel = reqState.getPrivateLabel();
   I18N i18n = privLabel.getI18N(ReportMenuDriverPerformance.class);
   return super._getMenuDescription(
       reqState,
       i18n.getString("ReportMenuDriverPerformance.menuDesc", "Driver Performance Reports"));
 }
 public String getMenuHelp(RequestProperties reqState, String parentMenuName) {
   PrivateLabel privLabel = reqState.getPrivateLabel();
   I18N i18n = privLabel.getI18N(ReportMenuDriverPerformance.class);
   return super._getMenuHelp(
       reqState,
       i18n.getString(
           "ReportMenuDriverPerformance.menuHelp", "Display various driver performance reports"));
 }
Exemplo n.º 3
0
 public String toString(I18N i18n, String dftVal) {
   String dv = (dftVal != null) ? dftVal : this.dft;
   if (i18n != null) {
     return i18n.getString(this.getKey(), dv);
   } else {
     return I18N.decodeNewLine(dv);
   }
 }
Exemplo n.º 4
0
 public String toString(Locale loc, String dftVal) {
   String dv = (dftVal != null) ? dftVal : this.dft;
   if ((loc != null) && (this.pkg != null)) {
     return this.toString(I18N.getI18N(this.pkg, loc), dv);
   } else {
     return I18N.decodeNewLine(dv);
   }
 }
Exemplo n.º 5
0
 /**
  * ** Gets the Localized value for the specified key. The default String text is return if ** the
  * specified key does not exist ** @param key The LocalStrings key ** @param dft The default
  * String text to return if the LocalStrings key does not exist ** @param args An array of
  * replacement fields ** @return The Localized String text
  */
 public String getString(String key, String dft, Object args[]) {
   String val = this.getString(key, dft);
   if ((args != null) && (args.length > 0) && (val != null)) {
     try {
       MessageFormat mf = new MessageFormat(val);
       mf.setLocale(this.locale);
       StringBuffer sb = mf.format(args, new StringBuffer(), null);
       return I18N.decodeNewLine(sb).toString();
     } catch (Throwable th) {
       Print.logInfo("Exception: " + key + " ==> " + val);
     }
   }
   return I18N.decodeNewLine(val);
 }
Exemplo n.º 6
0
 /**
  * ** Returns the specified Locale, or the default Locale if the specified Locale is null
  * ** @param loc The default Locale ** @return A Java Locale instance
  */
 public static Locale getLocale(Locale loc) {
   if (loc != null) {
     return loc;
   } else {
     return I18N.getDefaultLocale();
   }
 }
Exemplo n.º 7
0
  /**
   * ** Returns an I18N instance based on the specified package name and Locale ** @param pkgName
   * The resource package name ** @param loc The Locale resource from with the localized text is
   * loaded
   */
  public static I18N getI18N(String pkgName, Locale loc) {
    if (pkgName != null) {
      loc = I18N.getLocale(loc);

      /* get package map for specific Locale */
      Map<String, I18N> packageMap = localeMap.get(loc);
      if (packageMap == null) {
        packageMap = new HashMap<String, I18N>();
        localeMap.put(loc, packageMap);
      }

      /* get I18N instance for package */
      I18N i18n = packageMap.get(pkgName);
      if (i18n == null) {
        i18n = new I18N(pkgName, loc);
        packageMap.put(pkgName, i18n);
      }
      return i18n;

    } else {

      /* no package specified */
      return null;
    }
  }
Exemplo n.º 8
0
 /**
  * ** Gets the Localized value for the specified key. The default String text is returned ** if
  * the specified key does not exist ** @param key The LocalStrings key ** @param dft The default
  * String text to return if the LocalStrings key does not exist ** @return The Localized String
  * text
  */
 public String getString(String key, String dft) {
   if (!StringTools.isBlank(key) && (this.resBundle != null)) {
     RTProperties cfgProps = RTConfig.getConfigFileProperties();
     if (!cfgProps.hasProperty(key) || cfgProps.getBoolean(key, true)) {
       try {
         String s = this.resBundle.getString(key);
         if (s != null) {
           return I18N.decodeNewLine(s);
         }
       } catch (Throwable th) {
         // Print.logException("",th);
         // MissingResourceException - if no object for the given key can be found
         // ClassCastException - if the object found for the given key is not a string
       }
     }
   }
   return I18N.decodeNewLine(dft);
 }
Exemplo n.º 9
0
 public String toString() {
   String locStr = RTConfig.getString(RTKey.SESSION_LOCALE, null);
   if (StringTools.isBlank(locStr)) {
     return this.getDefault();
   } else {
     Locale loc = I18N.getLocale(locStr);
     return this.toString(loc);
   }
 }
Exemplo n.º 10
0
  /** ** Debug/Testing entry point ** @param argv The command-line args */
  public static void main(String argv[]) {
    RTConfig.setCommandLineArgs(argv);

    if (RTConfig.hasProperty(ARG_PACKAGE)) {
      String pkg = RTConfig.getString(ARG_PACKAGE, "org.opengts.util");
      String loc = RTConfig.getString(ARG_LOCALE, "en");
      String key = RTConfig.getString(ARG_KEY, "");
      Locale locale = I18N.getLocale(loc);
      Print.sysPrintln("Package: " + pkg);
      Print.sysPrintln("Locale : " + locale + " [" + loc + "]");
      Print.sysPrintln("Key    : " + key);
      I18N i18n = I18N.getI18N(pkg, locale);
      if (i18n != null) {
        Print.sysPrintln("String : " + i18n.getString(key, "Undefined"));
      } else {
        Print.sysPrintln("Package resource not found");
      }
      System.exit(0);
    }

    if (RTConfig.hasProperty("test")) {
      I18N i18n = getI18N(I18N.class, null);
      i18n.printKeyValues();
      String m3 =
          i18n.getString(
              "m.m3",
              "{0}",
              new Object() {
                public String toString() {
                  return mainStr;
                }
              });
      String m2 = i18n.getString("m.m2", "How Now Brown {0}", m3);
      String m1 = i18n.getString("m.m1", "Message: \\n{0}", m2);
      Print.sysPrintln(m1);
      mainStr = "Horse";
      Print.sysPrintln(m1);
    }
  }
Exemplo n.º 11
0
 /**
  * ** Constructor ** @param pkgName The resource package name ** @param loc The Locale resource
  * from with the localized text is loaded
  */
 private I18N(String pkgName, Locale loc) {
   String bundleName = null;
   try {
     this.locale = I18N.getLocale(loc);
     bundleName =
         ((pkgName == null) || pkgName.equals("")) ? LOCAL_STRINGS : (pkgName + _LOCAL_STRINGS);
     this.resBundle = ResourceBundle.getBundle(bundleName, this.locale);
     // Print.logInfo("Found bundle: " + bundleName);
   } catch (Throwable th) {
     // MissingResourceException
     if (loc != null) {
       // quietly ignore this exception if (loc == null)
       Print.logInfo("Bundle not found: " + bundleName + " [" + th);
     }
     this.resBundle = null;
   }
 }
Exemplo n.º 12
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(RoleAcl.class, loc);
   return i18n.getString(
       "RoleAcl.description", "This table defines " + "Role specific Access Control permissions.");
 }
Exemplo n.º 13
0
 /**
  * ** Returns an I18N instance based on the specified package name and Locale ** @param pkgClz The
  * class from which the class package is derived ** @param loc The Locale resource from with the
  * localized text is loaded
  */
 public static I18N getI18N(Class pkgClz, Locale loc) {
   return I18N.getI18N(pkgClz.getPackage().getName(), loc);
 }
Exemplo n.º 14
0
 /**
  * ** Returns an I18N instance based on the specified package name and Locale ** @param pkg The
  * resource package ** @param loc The Locale resource from with the localized text is loaded
  */
 public static I18N getI18N(Package pkg, Locale loc) {
   return I18N.getI18N(pkg.getName(), loc);
 }
Exemplo n.º 15
0
 /**
  * ** Returns an I18N.Text instance used for lazy localization ** @param clazz The class from
  * which the package is derived ** @param key The localization key ** @param dft The default
  * localized text ** @return An I18N.Text instance used for lazy localization
  */
 public static I18N.Text getString(Class clazz, String key, String dft) {
   // i18n 'key' is separately specified
   String pkg = (clazz != null) ? clazz.getPackage().getName() : null;
   return I18N.parseText(pkg, key, dft);
 }
Exemplo n.º 16
0
  private int _writeHTML(PrintWriter out, int level, ReportData rd, int ndx)
      throws ReportException {
    RequestProperties reqState = rd.getRequestProperties();
    boolean isEMail = reqState.getEncodeEMailHTML();
    PrivateLabel privLabel = rd.getPrivateLabel();
    I18N i18n = privLabel.getI18N(ReportTable.class);

    out.print("<center>\n");
    out.print("<table cellspacing='0' cellpadding='0' border='0'>\n");

    /* report title row */
    {
      String rptTitle = rd.getReportTitle();
      out.print(
          "<tr><td colSpan='3'><H1 class=\"rptTitle\">"
              + FilterText(rptTitle)
              + "</H1></td></tr>\n");
    }

    /* report subtitle row */
    {
      out.print("<tr>\n");

      // "Refresh"
      out.print("<td>");
      StringBuffer linkSB_L = new StringBuffer();
      String refreshURL = (!isEMail && (ndx <= 0)) ? EncodeURL(reqState, rd.getRefreshURL()) : null;
      if (!StringTools.isBlank(refreshURL)) {
        String refreshDesc = i18n.getString("ReportTable.refreshReport", "Refresh");
        if (linkSB_L.length() > 0) {
          linkSB_L.append("&nbsp;&nbsp;");
        } // add space between links
        linkSB_L.append(
            "<a href='" + refreshURL + "' target='_self'>" + refreshDesc + "</a>"); // target='_top'
      }
      // ...
      if (linkSB_L.length() > 0) {
        out.print(linkSB_L.toString());
      } else {
        out.print("&nbsp;");
      }
      out.print("</td>\n");

      // Report subtitle
      out.print("<td width='100%'>");
      String rptSubtt = rd.getReportSubtitle();
      if (!StringTools.isBlank(rptSubtt)) {
        out.print("<H2 class=\"rptSubtitle\">" + FilterText(rptSubtt) + "</H2>");
      } else {
        out.print("&nbsp;");
      }
      out.print("</td>\n");

      // "Graph", "Map" links
      out.print("<td>");
      StringBuffer linkSB_R = new StringBuffer();
      String graphURL =
          (!isEMail && (ndx < 0) && rd.getSupportsGraphDisplay())
              ? EncodeURL(reqState, rd.getGraphURL())
              : null;
      if (!StringTools.isBlank(graphURL)) {
        MapDimension sz = rd.getGraphWindowSize();
        String desc = rd.getGraphLinkDescription();
        if (StringTools.isBlank(desc)) {
          desc = i18n.getString("ReportTable.displayGraph", "Graph");
        }
        if (linkSB_R.length() > 0) {
          linkSB_R.append("&nbsp;&nbsp;");
        } // add space between links
        linkSB_R.append(
            "<span class='spanLink' onclick=\"javascript:openResizableWindow('"
                + graphURL
                + "','ReportGraph',"
                + sz.getWidth()
                + ","
                + sz.getHeight()
                + ");\">"
                + desc
                + "</span>");
      }
      String mapURL =
          (!isEMail && (ndx < 0) && rd.getSupportsMapDisplay())
              ? EncodeURL(reqState, rd.getMapURL())
              : null;
      if (!StringTools.isBlank(mapURL)) {
        MapDimension sz = rd.getMapWindowSize();
        String desc = rd.getMapLinkDescription();
        if (StringTools.isBlank(desc)) {
          desc = i18n.getString("ReportTable.displayMap", "Map");
        }
        if (linkSB_R.length() > 0) {
          linkSB_R.append("&nbsp;&nbsp;");
        } // add space between links
        linkSB_R.append(
            "<span class='spanLink' onclick=\"javascript:openResizableWindow('"
                + mapURL
                + "','ReportMap',"
                + sz.getWidth()
                + ","
                + sz.getHeight()
                + ");\">"
                + desc
                + "</span>");
      }
      String kmlURL =
          (!isEMail
                  && (ndx < 0)
                  && rd.getSupportsKmlDisplay()
                  && privLabel.getBooleanProperty(
                      PrivateLabel.PROP_ReportDisplay_showGoogleKML, false))
              ? EncodeURL(reqState, rd.getKmlURL())
              : null;
      if (!StringTools.isBlank(kmlURL)) {
        String desc = rd.getKmlLinkDescription();
        if (StringTools.isBlank(desc)) {
          desc = i18n.getString("ReportTable.displayKML", "KML");
        }
        if (linkSB_R.length() > 0) {
          linkSB_R.append("&nbsp;&nbsp;");
        } // add space between links
        linkSB_R.append("<a href='" + kmlURL + "' target='_blank'>" + desc + "</a>");
      }
      // ...
      if (linkSB_R.length() > 0) {
        out.print(linkSB_R.toString());
      } else {
        out.print("&nbsp;");
      }
      out.print("</td>\n");

      out.print("</tr>\n");
    }

    /* start report */
    out.print("<tr>\n");
    out.print("<td colSpan='3'>\n");
    String tableClass =
        rd.getReportFactory().isTableSortable() ? CSS_CLASS_TABLE_SORT : CSS_CLASS_TABLE;
    out.print(
        "<table class='"
            + tableClass
            + "' width='100%' cellspacing='0' cellpadding='0' border='0'>\n");
    out.print("<!-- Report Header -->\n");
    this.rptHeader.writeHTML(out, level + 1, rd);
    out.print("<!-- Report Data -->\n");
    this.rptBody.writeHTML(out, level + 1, rd);
    out.print("</table>\n");
    out.print("</td>\n");
    out.print("</tr>\n");

    /* no/partial data indication */
    if (this.rptBody.getRecordCount() <= 0) {
      out.print("<tr>\n");
      out.print("<td colSpan='3'><H2 class=\"rptNoData\">");
      String t = i18n.getString("ReportTable.noData", "This report contains no data");
      out.print(FilterText(t));
      out.print("</H2></td>\n");
      out.print("</tr>\n");
    } else if (this.rptBody.isPartial()) {
      out.print("<tr>\n");
      out.print("<td colSpan='3'><H2 class=\"rptPartial\">");
      String t =
          i18n.getString(
              "ReportTable.partialData",
              "This report has reached it's record display limit and may only contain a portion of the possible data");
      out.print(FilterText(t));
      out.print("</H2></td>\n");
      out.print("</tr>\n");
    }

    out.print("</table>\n");
    out.print("</center>\n");
    return this.rptBody.getRecordCount();
  }
Exemplo n.º 17
0
  public enum EntityType implements EnumTools.StringLocale, EnumTools.IntValue {
    TRAILER(
        0,
        "TRAILER",
        I18N.getString(
            EntityManager.class, "EntityManager.EntityType.trailer", "Trailer")), // default
    DRIVER(
        100,
        "DRIVER",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.driver", "Driver")),
    PERSON(
        200,
        "PERSON",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.person", "Person")),
    ANIMAL(
        300,
        "ANIMAL",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.animal", "Animal")),
    CONTAINER(
        400,
        "CONTAINER",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.container", "Container")),
    PACKAGE(
        500,
        "PACKAGE",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.package", "Package")),
    TOOL(600, "TOOL", I18N.getString(EntityManager.class, "EntityManager.EntityType.tool", "Tool")),
    EQUIPMENT(
        700,
        "EQUIPMENT",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.equipment", "Equipment")),
    RFID_00(
        900,
        "RFID_00",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.rfid_0", "RFID Type 0")),
    RFID_01(
        901,
        "RFID_01",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.rfid_1", "RFID Type 1")),
    RFID_02(
        902,
        "RFID_02",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.rfid_2", "RFID Type 2")),
    RFID_03(
        903,
        "RFID_03",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.rfid_3", "RFID Type 3")),
    RFID_04(
        904,
        "RFID_04",
        I18N.getString(EntityManager.class, "EntityManager.EntityType.rfid_4", "RFID Type 4"));
    // ---
    private int vv = 0;
    private String nn = "";
    private I18N.Text aa = null;

    EntityType(int v, String n, I18N.Text a) {
      vv = v;
      nn = n;
      aa = a;
    }

    public String getName() {
      return nn;
    }

    public int getIntValue() {
      return vv;
    }

    public String toString() {
      return aa.toString();
    }

    public String toString(Locale loc) {
      return aa.toString(loc);
    }

    public boolean isTrailer() {
      return this.equals(TRAILER);
    }

    public boolean isDriver() {
      return this.equals(DRIVER);
    }

    public boolean isType(int type) {
      return this.getIntValue() == type;
    }
  }
Exemplo n.º 18
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(StatusCode.class, loc);
   return i18n.getString(
       "StatusCode.description",
       "This table defines " + "Device specific StatusCode descriptions.");
 }
Exemplo n.º 19
0
 public String getDefault(boolean decodeNewLine) {
   return decodeNewLine ? I18N.decodeNewLine(this.dft) : this.dft; // never null
 }
Exemplo n.º 20
0
  /* write mapping support JS to stream */
  protected void writeJSVariables(PrintWriter out, RequestProperties reqState) throws IOException {
    // This var initilizations must not use any functions defined in 'jsmap.js'
    PrivateLabel privLabel = reqState.getPrivateLabel();
    I18N i18n = privLabel.getI18N(JSMap.class);
    Locale locale = reqState.getLocale();
    GeoPoint dftCenter = this.getDefaultCenter(null);
    boolean isFleet = reqState.isFleet();
    Account account = reqState.getCurrentAccount();
    long maxPushpins = this.getMaxPushpins(reqState);
    out.write("// --- Map support Javascript [" + this.getName() + "]\n");
    JavaScriptTools.writeJSVar(out, "MAP_PROVIDER_NAME", this.getName());

    /* properties */
    boolean wrotePropHeader = false;
    RTProperties rtp = this.getProperties();
    for (Iterator<?> i = rtp.keyIterator(); i.hasNext(); ) {
      Object key = i.next();
      if (!this._skipPropKey(key)) {
        if (!wrotePropHeader) {
          // out.write("\n");
          out.write("// Defined properties\n");
          wrotePropHeader = true;
        }
        String val[] = StringTools.parseStringArray(rtp.getProperty(key, "").toString(), '\n');
        String propVar = "PROP_" + key.toString().replace('.', '_').replace('-', '_');
        if (val.length == 1) {
          if (StringTools.isDouble(val[0], true)
              || StringTools.isLong(val[0], true)
              || StringTools.isBoolean(val[0], true)) {
            JavaScriptTools.writeJSVar(out, propVar, val[0], false);
          } else {
            JavaScriptTools.writeJSVar(out, propVar, val[0]);
          }
        } else if (val.length > 1) {
          JavaScriptTools.writeJSVar(out, propVar, StringTools.join(val, "\\n"));
        }
      }
    }

    /* speed units */
    Account.SpeedUnits speedUnits = reqState.getSpeedUnits();
    boolean speedIsKph = speedUnits.equals(Account.SpeedUnits.KPH);
    double altUnitsMult = speedIsKph ? 1.0 : GeoPoint.FEET_PER_METER;
    String altUnitsName =
        speedIsKph
            ? i18n.getString("JSMap.altitude.meters", "Meters")
            : i18n.getString("JSMap.altitude.feet", "Feet");

    /* constants (these do not change during the user session) */
    out.write("// Element IDs\n");
    JavaScriptTools.writeJSVar(out, "MAP_ID", this.getMapID());
    JavaScriptTools.writeJSVar(out, "ID_DETAIL_TABLE", ID_DETAIL_TABLE);
    JavaScriptTools.writeJSVar(out, "ID_DETAIL_CONTROL", ID_DETAIL_CONTROL);
    JavaScriptTools.writeJSVar(out, "ID_LAT_LON_DISPLAY", ID_LAT_LON_DISPLAY);
    JavaScriptTools.writeJSVar(out, "ID_DISTANCE_DISPLAY", ID_DISTANCE_DISPLAY);
    JavaScriptTools.writeJSVar(out, "ID_LATEST_EVENT_DATE", ID_LATEST_EVENT_DATE);
    JavaScriptTools.writeJSVar(out, "ID_LATEST_EVENT_TIME", ID_LATEST_EVENT_TIME);
    JavaScriptTools.writeJSVar(out, "ID_LATEST_EVENT_TMZ", ID_LATEST_EVENT_TMZ);
    JavaScriptTools.writeJSVar(out, "ID_LATEST_BATTERY", ID_LATEST_BATTERY);
    JavaScriptTools.writeJSVar(out, "ID_MESSAGE_TEXT", ID_MESSAGE_TEXT);
    out.write("// Geozone IDs\n");
    JavaScriptTools.writeJSVar(out, "ID_ZONE_LATITUDE_", ID_ZONE_LATITUDE_);
    JavaScriptTools.writeJSVar(out, "ID_ZONE_LONGITUDE_", ID_ZONE_LONGITUDE_);
    JavaScriptTools.writeJSVar(out, "ID_ZONE_RADIUS_M", ID_ZONE_RADIUS_M);
    out.write("// Session constants\n");
    JavaScriptTools.writeJSVar(out, "PUSHPINS_SHOW", rtp.getBoolean(PROP_map_pushpins, true));
    JavaScriptTools.writeJSVar(out, "MAX_PUSH_PINS", maxPushpins);
    JavaScriptTools.writeJSVar(out, "MAX_CREATION_AGE_SEC", rtp.getInt(PROP_map_maxCreationAge, 0));
    JavaScriptTools.writeJSVar(out, "MAP_WIDTH", this.getDimension().getWidth());
    JavaScriptTools.writeJSVar(out, "MAP_HEIGHT", this.getDimension().getHeight());
    JavaScriptTools.writeJSVar(out, "IS_FLEET", isFleet);
    JavaScriptTools.writeJSVar(
        out, "SHOW_SAT_COUNT", rtp.getBoolean(PROP_detail_showSatCount, false));
    JavaScriptTools.writeJSVar(out, "SHOW_SPEED", rtp.getBoolean(PROP_info_showSpeed, true));
    JavaScriptTools.writeJSVar(
        out, "COMBINE_SPEED_HEAD", rtp.getBoolean(PROP_combineSpeedHeading, true));
    JavaScriptTools.writeJSVar(out, "SHOW_ALTITUDE", rtp.getBoolean(PROP_info_showAltitude, false));
    JavaScriptTools.writeJSVar(out, "SHOW_ADDR", reqState.getShowAddress());
    JavaScriptTools.writeJSVar(
        out, "INCL_BLANK_ADDR", rtp.getBoolean(PROP_info_inclBlankAddress, true));
    JavaScriptTools.writeJSVar(
        out, "SHOW_OPT_FIELDS", rtp.getBoolean(PROP_info_showOptionalFields, true));
    JavaScriptTools.writeJSVar(
        out, "INCL_BLANK_OPT_FIELDS", rtp.getBoolean(PROP_info_inclBlankOptFields, true));
    JavaScriptTools.writeJSVar(
        out, "LATLON_FORMAT", Account.getLatLonFormat(account).getIntValue());
    JavaScriptTools.writeJSVar(
        out, "DISTANCE_KM_MULT", reqState.getDistanceUnits().getMultiplier());
    JavaScriptTools.writeJSVar(out, "SPEED_KPH_MULT", speedUnits.getMultiplier());
    JavaScriptTools.writeJSVar(out, "SPEED_UNITS", speedUnits.toString(locale));
    JavaScriptTools.writeJSVar(out, "ALTITUDE_METERS_MULT", altUnitsMult);
    JavaScriptTools.writeJSVar(out, "ALTITUDE_UNITS", altUnitsName);
    JavaScriptTools.writeJSVar(out, "TIME_ZONE", reqState.getTimeZoneString(null)); // long
    JavaScriptTools.writeJSVar(
        out,
        "DEFAULT_CENTER",
        "{ lat:" + dftCenter.getLatitude() + ", lon:" + dftCenter.getLongitude() + " }",
        false);
    JavaScriptTools.writeJSVar(out, "DEFAULT_ZOOM", this.getDefaultZoom(JSMap.DEFAULT_ZOOM, false));
    JavaScriptTools.writeJSVar(out, "PUSHPIN_ZOOM", this.getDefaultZoom(JSMap.PUSHPIN_ZOOM, true));
    JavaScriptTools.writeJSVar(out, "MAP_AUTHORIZATION", this.getAuthorization());
    JavaScriptTools.writeJSVar(
        out, "SCROLL_WHEEL_ZOOM", rtp.getBoolean(PROP_scrollWheelZoom, false));
    JavaScriptTools.writeJSVar(out, "DEFAULT_VIEW", rtp.getString(PROP_map_view, "").toLowerCase());
    JavaScriptTools.writeJSVar(out, "ROUTE_LINE_SHOW", rtp.getBoolean(PROP_map_routeLine, true));
    JavaScriptTools.writeJSVar(
        out, "ROUTE_LINE_COLOR", rtp.getString(PROP_map_routeLine_color, "#FF2222"));
    JavaScriptTools.writeJSVar(
        out, "ROUTE_LINE_ARROWS", rtp.getBoolean(PROP_map_routeLine_arrows, false));
    JavaScriptTools.writeJSVar(
        out,
        "ROUTE_SNAP_TO_ROAD",
        rtp.getBoolean(PROP_map_routeLine_snapToRoad, false)); // Google V2 only
    JavaScriptTools.writeJSVar(out, "REPLAY_INTERVAL", this.getReplayInterval());
    JavaScriptTools.writeJSVar(out, "REPLAY_SINGLE", this.getReplaySinglePushpin());

    /* address title */
    String adrTitles[] = reqState.getAddressTitles();
    String adrTitle = ListTools.itemAt(adrTitles, 0, null);

    /* device title */
    String devTitles[] = reqState.getDeviceTitles();
    String devTitle = ListTools.itemAt(devTitles, 0, null);

    /* labels */
    out.write("// Localized Text/Labels\n");
    JavaScriptTools.writeJSVar(
        out,
        "HEADING",
        "new Array("
            + "\""
            + GeoPoint.CompassHeading.N.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.NE.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.E.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.SE.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.S.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.SW.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.W.toString(locale)
            + "\","
            + "\""
            + GeoPoint.CompassHeading.NW.toString(locale)
            + "\")",
        false);
    JavaScriptTools.writeJSVar(out, "TEXT_INFO_DATE", i18n.getString("JSMap.info.date", "Date"));
    JavaScriptTools.writeJSVar(out, "TEXT_INFO_GPS", i18n.getString("JSMap.info.gps", "GPS"));
    JavaScriptTools.writeJSVar(out, "TEXT_INFO_SATS", i18n.getString("JSMap.info.sats", "#Sats"));
    JavaScriptTools.writeJSVar(out, "TEXT_INFO_SPEED", i18n.getString("JSMap.info.speed", "Speed"));
    JavaScriptTools.writeJSVar(out, "TEXT_INFO_HEADING", GeoPoint.GetHeadingTitle(locale));
    JavaScriptTools.writeJSVar(
        out, "TEXT_INFO_ALTITUDE", i18n.getString("JSMap.info.altitude", "Altitude"));
    JavaScriptTools.writeJSVar(
        out, "TEXT_INFO_STOP_TIME", i18n.getString("JSMap.info.stopTime", "Stop Time"));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_INFO_ADDR",
        !StringTools.isBlank(adrTitle)
            ? adrTitle
            : i18n.getString("JSMap.info.address", "Address"));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_DEVICE",
        !StringTools.isBlank(devTitle) ? devTitle : i18n.getString("JSMap.device", "Device"));
    JavaScriptTools.writeJSVar(out, "TEXT_DATE", i18n.getString("JSMap.dateTime", "Date/Time"));
    JavaScriptTools.writeJSVar(out, "TEXT_CODE", i18n.getString("JSMap.code", "Status"));
    JavaScriptTools.writeJSVar(out, "TEXT_LATLON", i18n.getString("JSMap.latLon", "Lat/Lon"));
    JavaScriptTools.writeJSVar(out, "TEXT_SATCOUNT", i18n.getString("JSMap.satCount", "#Sats"));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_ADDR",
        !StringTools.isBlank(adrTitle) ? adrTitle : i18n.getString("JSMap.address", "Address"));
    JavaScriptTools.writeJSVar(out, "TEXT_SPEED", reqState.getSpeedUnits().toString(locale));
    JavaScriptTools.writeJSVar(out, "TEXT_HEADING", i18n.getString("JSMap.heading", "Heading"));
    JavaScriptTools.writeJSVar(out, "TEXT_DISTANCE", reqState.getDistanceUnits().toString(locale));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_TIMEOUT",
        i18n.getString("JSMap.sessionTimeout", "Your session has timed-out.\nPlease login ..."));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_PING_OK",
        i18n.getString(
            "JSMap.pingDevice.ok",
            "A command request has been sent.\nThe {0} should respond shortly ...",
            devTitles));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_PING_ERROR",
        i18n.getString(
            "JSMap.pingDevice.err",
            "The command request failed.\nThe {0} may not support this feature ...",
            devTitles));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_MAXPUSHPINS_ALERT",
        i18n.getString(
            "JSMap.maxPushpins.err",
            "The maximum number of allowed pushpins has been exceeded.\n"
                + " [max={0}] Not all pushpins may be displayed on this map.\n"
                + "Adjust the 'From' time to see remaining pushpins",
            String.valueOf(maxPushpins)));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_MAXPUSHPINS_MSG",
        i18n.getString(
            "JSMap.maxPushpins.msg",
            "Only partial data displayed.  The maximum allowed pushpins has been reached.<BR>"
                + "Adjust the Date/Time range accordingly to view the remaining pushpins."));
    JavaScriptTools.writeJSVar(
        out, "TEXT_UNAVAILABLE", i18n.getString("JSMap.unavailable", "unavailable"));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_showLocationDetails",
        i18n.getString("JSMap.showLocationDetails", "Show Location Details"));
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_hideLocationDetails",
        i18n.getString("JSMap.hideLocationDetails", "Hide Location Details"));

    /* map "Loading ..." */
    JavaScriptTools.writeJSVar(
        out,
        "TEXT_LOADING_MAP_POINTS",
        (rtp.getBoolean(PROP_MAP_LOADING, false)
            ? i18n.getString("JSMap.loadingMapPoints", "Loading Map Points ...")
            : null));
    JavaScriptTools.writeJSVar(
        out, "MAP_LOADING_IMAGE_URI", rtp.getString(PROP_MAP_LOADING_IMAGE, null));

    /* icons/shadows */
    JSMap.writePushpinArray(out, reqState);

    /* constants (these do not change during the user session) */
    out.write("// Geozone support constants\n");
    JavaScriptTools.writeJSVar(out, "jsvGeozoneMode", false);
    JavaScriptTools.writeJSVar(out, "MAX_ZONE_RADIUS_M", Geozone.MAX_RADIUS_METERS);
    JavaScriptTools.writeJSVar(out, "MIN_ZONE_RADIUS_M", Geozone.MIN_RADIUS_METERS);
    JavaScriptTools.writeJSVar(
        out, "DETAIL_REPORT", this.isFeatureSupported(FEATURE_DETAIL_REPORT));
    JavaScriptTools.writeJSVar(
        out, "DETAIL_INFO_BOX", this.isFeatureSupported(FEATURE_DETAIL_INFO_BOX));
    JavaScriptTools.writeJSVar(out, "TEXT_METERS", GeoPoint.DistanceUnits.METERS.toString(locale));

    /* variables */
    out.write("// TrackMap Vars\n");
    JavaScriptTools.writeJSVar(out, "jsvPoiPins", null);
    JavaScriptTools.writeJSVar(out, "jsvDataSets", null);
    JavaScriptTools.writeJSVar(out, "jsvDetailPoints", null);
    JavaScriptTools.writeJSVar(out, "jsvDetailVisible", false);
    JavaScriptTools.writeJSVar(
        out,
        "jsvDetailAscending",
        privLabel.getBooleanProperty(PrivateLabel.PROP_TrackMap_detailAscending, true));
    JavaScriptTools.writeJSVar(
        out,
        "jsvDetailCenterPushpin",
        privLabel.getBooleanProperty(PrivateLabel.PROP_TrackMap_detailCenterPushpin, false));

    /* last update time */
    TimeZone tmz = reqState.getTimeZone();
    String dateFmt =
        (account != null) ? account.getDateFormat() : BasicPrivateLabel.getDefaultDateFormat();
    String timeFmt =
        (account != null) ? account.getTimeFormat() : BasicPrivateLabel.getDefaultTimeFormat();
    DateTime today = new DateTime(tmz);
    JavaScriptTools.writeJSVar(out, "jsvTodayEpoch", today.getTimeSec());
    JavaScriptTools.writeJSVar(
        out,
        "jsvTodayYMD",
        "{ YYYY:"
            + today.getYear(tmz)
            + ", MM:"
            + today.getMonth1(tmz)
            + ", DD:"
            + today.getDayOfMonth(tmz)
            + " }",
        false);
    JavaScriptTools.writeJSVar(out, "jsvTodayDateFmt", today.format(dateFmt, tmz));
    JavaScriptTools.writeJSVar(out, "jsvTodayTimeFmt", today.format(timeFmt, tmz));
    JavaScriptTools.writeJSVar(out, "jsvTodayTmzFmt", today.format("z", tmz));

    /* last event time */
    out.write("// Last event time\n");
    DateTime lastEventTime = reqState.getLastEventTime();
    if (lastEventTime != null) {
      JavaScriptTools.writeJSVar(out, "jsvLastEventEpoch", lastEventTime.getTimeSec());
      JavaScriptTools.writeJSVar(
          out,
          "jsvLastEventYMD",
          "{ YYYY:"
              + lastEventTime.getYear(tmz)
              + ", MM:"
              + lastEventTime.getMonth1(tmz)
              + ", DD:"
              + lastEventTime.getDayOfMonth(tmz)
              + " }",
          false);
      JavaScriptTools.writeJSVar(out, "jsvLastEventDateFmt", lastEventTime.format(dateFmt, tmz));
      JavaScriptTools.writeJSVar(out, "jsvLastEventTimeFmt", lastEventTime.format(timeFmt, tmz));
      JavaScriptTools.writeJSVar(out, "jsvLastEventTmzFmt", lastEventTime.format("z", tmz));
      JavaScriptTools.writeJSVar(out, "jsvLastBatteryLevel", 0L);
      JavaScriptTools.writeJSVar(out, "jsvLastSignalStrength", 0L);
    } else {
      JavaScriptTools.writeJSVar(out, "jsvLastEventEpoch", 0L);
      JavaScriptTools.writeJSVar(out, "jsvLastEventYMD", null);
      JavaScriptTools.writeJSVar(out, "jsvLastEventDateFmt", null);
      JavaScriptTools.writeJSVar(out, "jsvLastEventTimeFmt", null);
      JavaScriptTools.writeJSVar(out, "jsvLastEventTmzFmt", null);
      JavaScriptTools.writeJSVar(out, "jsvLastBatteryLevel", 0.0);
      JavaScriptTools.writeJSVar(out, "jsvLastSignalStrength", 0.0);
    }

    /* map pointers */
    out.write("// Map vars\n");
    JavaScriptTools.writeJSVar(out, "jsmapElem", null);
    JavaScriptTools.writeJSVar(out, "jsmap", null);
  }
Exemplo n.º 21
0
 public String getDefault() {
   return I18N.decodeNewLine(this.dft); // never null
 }
Exemplo n.º 22
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(GroupList.class, loc);
   return i18n.getString(
       "GroupList.description",
       "This table defines " + "the authorized Groups that can be accessed by a given User.");
 }
 public String getNavigationTab(RequestProperties reqState) {
   PrivateLabel privLabel = reqState.getPrivateLabel();
   I18N i18n = privLabel.getI18N(ReportMenuDriverPerformance.class);
   return super._getNavigationTab(
       reqState, i18n.getString("ReportMenuDriverPerformance.navTab", "Performance"));
 }
Exemplo n.º 24
0
 /* table description */
 public static String getTableDescription(Locale loc) {
   I18N i18n = I18N.getI18N(AccountString.class, loc);
   return i18n.getString(
       "AccountString.description",
       "This table defines " + "Account specific customized String key/values.");
 }
Exemplo n.º 25
0
 /**
  * ** Gets the Java Locale instance based on the specified locale name ** @param loc The name of
  * the Locale ** @return The Java Locale instance
  */
 public static Locale getLocale(String loc) {
   Locale locale = I18N.getLocale(loc, null);
   return (locale != null) ? locale : I18N.getDefaultLocale();
 }