Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ExpandingNextNode.java
1 
16 package net.squiz.matrix.matrixtree;
17 
18 import net.squiz.matrix.core.*;
19 
20 public class ExpandingNextNode extends ExpandingNode {
21 
22  public ExpandingNextNode(int parentTotalAssets, int currentAssetsCount, int viewedAssetsCount) {
23  setParentTotalAssets(parentTotalAssets);
24  setCurrentAssetsCount(currentAssetsCount);
25  setViewedAssetsCount(viewedAssetsCount);
26  Asset expandingAsset = new ExpandingAsset(getName());
27  setUserObject(expandingAsset);
28  setCueModeName(Matrix.translate("asset_map_expanding_node_move_to_next_set"));
29  }
30 
31  public int getStartLoc(int evtX, double boundsX) {
32  int res = evtX - (int)boundsX;
33  if (res >=0 && res <=12) {
34  // first img clicked, we will get next set of nodes
35  return getViewedAssetsCount() + AssetManager.getLimit();
36  } else if (res >=13 && res <=35) {
37  // second img clicked, get the last set of nodes
38  if (getParentTotalAssets() < 0) {
39  return -1;
40  }
41  int loc = getParentTotalAssets() - (getParentTotalAssets()%AssetManager.getLimit());
42  if (loc == getParentTotalAssets())
43  loc -= AssetManager.getLimit();
44  return loc;
45  } else {
46  return -1;
47  }
48  }
49 
50 }