@Override
 public void onDestroy() {
   if (!NetworkView.Instance().isInitialized() && NetworkInitializer.Instance != null) {
     NetworkInitializer.Instance.setActivity(null);
   }
   super.onDestroy();
 }
예제 #2
0
 public void setup() {
   size(1400, 800);
   previous_w = width;
   previous_h = height;
   frame.setResizable(true);
   bounds = new Rect(0, 0, width, height / 3);
   nv = new NetworkView(new DerLeser("data_aggregate.csv").readIn(), bounds);
   nv.setBounds(bounds);
 }
 // Override
 public int getDefaultActionCode(NetworkTree tree) {
   final boolean isLoading =
       NetworkView.Instance()
           .containsItemsLoadingRunnable(NetworkSearchActivity.SEARCH_RUNNABLE_KEY);
   if (!isLoading) {
     return RUN_SEARCH_ITEM_ID;
   }
   return TREE_NO_ACTION;
 }
  // Override
  public void buildContextMenu(NetworkBaseActivity activity, ContextMenu menu, NetworkTree tree) {
    menu.setHeaderTitle(tree.getName());

    final boolean isLoading =
        NetworkView.Instance()
            .containsItemsLoadingRunnable(NetworkSearchActivity.SEARCH_RUNNABLE_KEY);

    if (!isLoading) {
      addMenuItem(menu, RUN_SEARCH_ITEM_ID, "search");
    } else {
      addMenuItem(menu, TREE_NO_ACTION, "stoppingNetworkSearch");
    }
  }
 @Override
 public void onResume() {
   super.onResume();
   if (!NetworkView.Instance().isInitialized()) {
     if (NetworkInitializer.Instance == null) {
       new NetworkInitializer(this);
       NetworkInitializer.Instance.start();
     } else {
       NetworkInitializer.Instance.setActivity(this);
     }
   } else {
     prepareView();
     if (myIntent != null) {
       processIntent(myIntent);
       myIntent = null;
     }
   }
 }
  private void refreshCatalogsList() {
    final NetworkView view = NetworkView.Instance();

    final Handler handler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            if (msg.obj == null) {
              view.finishBackgroundUpdate();
            } else {
              final ZLResource dialogResource = ZLResource.resource("dialog");
              final ZLResource boxResource = dialogResource.getResource("networkError");
              final ZLResource buttonResource = dialogResource.getResource("button");
              new AlertDialog.Builder(NetworkLibraryActivity.this)
                  .setTitle(boxResource.getResource("title").getValue())
                  .setMessage((String) msg.obj)
                  .setIcon(0)
                  .setPositiveButton(buttonResource.getResource("ok").getValue(), null)
                  .create()
                  .show();
            }
          }
        };

    UIUtil.wait(
        "updatingCatalogsList",
        new Runnable() {
          public void run() {
            String error = null;
            try {
              view.runBackgroundUpdate(true);
            } catch (ZLNetworkException e) {
              error = e.getMessage();
            }
            handler.sendMessage(handler.obtainMessage(0, error));
          }
        },
        this);
  }
 public final int getCount() {
   if (!NetworkView.Instance().isInitialized()) {
     return 0;
   }
   return myTree.subTrees().size();
 }
예제 #8
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (NetworkView.Instance().isInitialized()) {
     NetworkView.Instance().fireModelChangedAsync();
   }
 }
예제 #9
0
 public void draw() {
   nv.render();
   nv.getHoveredDatums();
 }