Beispiel #1
0
  /**
   * @param myContext
   * @param cb
   * @return true if loaded. False if executor should pause.
   */
  public boolean create(WF_Context myContext, final AsyncResumeExecutorI cb) {

    Context ctx = myContext.getContext();
    gs = GlobalState.getInstance();
    o = gs.getLogger();
    this.cb = cb;
    this.myContext = myContext;
    PersistenceHelper ph = gs.getPreferences();
    PersistenceHelper globalPh = gs.getGlobalPreferences();

    final String serverFileRootDir =
        server(globalPh.get(PersistenceHelper.SERVER_URL))
            + globalPh.get(PersistenceHelper.BUNDLE_NAME).toLowerCase()
            + "/extras/";
    final String cacheFolder =
        Constants.VORTEX_ROOT_DIR + globalPh.get(PersistenceHelper.BUNDLE_NAME) + "/cache/";

    if (source == null || source.length() == 0) {
      Log.e("vortex", "Pic url null! GisImageView will not load");
      o.addRow("");
      o.addRedText("GisImageView failed to load. No picture defined");
      // continue execution immediately.
      return true;
    }

    final String picName = Tools.parseString(source);
    Log.d("vortex", "ParseString result: " + picName);
    // Load asynchronously. Put up a loadbar.

    Tools.onLoadCacheImage(
        serverFileRootDir,
        picName,
        cacheFolder,
        new WebLoaderCb() {

          @Override
          public void progress(int bytesRead) {
            Log.d("vortex", "progress: " + bytesRead);
          }

          @Override
          public void loaded(Boolean result) {
            if (result) loadImageMetaData(picName, serverFileRootDir, cacheFolder);
            else {
              Log.e("vortex", "Pic url null! GisImageView will not load");
              o.addRow("");
              o.addRedText(
                  "GisImageView failed to load. File not found: " + serverFileRootDir + picName);
              cb.abortExecution(
                  "GisImageView failed to load. File not found: " + serverFileRootDir + picName);
            }
          }
        });

    return false;
  }
Beispiel #2
0
  public void addColumn(String header, String colKey, String type, String width) {
    // Copy the key and add the variator.
    Map<String, String> colHash = Tools.copyKeyHash(myContext.getKeyHash());
    colHash.put(myVariator, colKey);

    // Add header to the header row? Duh!!
    headerRow.addHeaderCell(header);

    // Create all row entries.
    for (Listable l : list) {
      WF_Table_Row wft = (WF_Table_Row) l;
      wft.addCell(header, colKey, colHash, type, width);
    }
    columnKeys.add(colKey);
  }