Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ public interface StateLoadedHandler {

private String flag;
private boolean flagIncludeInteractors = false;
private Map<String, String> extraParams; //to enable extensions of Reactome project to add extra url parameters

public State(Token token, final StateLoadedHandler handler) {
List<String> toLoad = token.getToLoad();
final Map<StateKey, String> parameters = token.getParameters();
this.extraParams = token.getExtraParams();
ContentClient.query(toLoad, new ContentClientHandler.ObjectMapLoaded() {
private String token;
private String filter;
Expand Down Expand Up @@ -131,6 +133,7 @@ public State(State state) {
this.analysisStatus = state.analysisStatus;
this.flag = state.flag;
this.flagIncludeInteractors = state.flagIncludeInteractors;
this.extraParams = state.extraParams;
}

void doConsistencyCheck(final StateLoadedHandler handler) {
Expand Down Expand Up @@ -336,12 +339,19 @@ public String toString() {
}
// addDelimiter=true;
}
if(extraParams != null) {
extraParams.forEach((k,v) -> {
token.append("&");
token.append(k);
token.append("=");
token.append(v);
});
}
return token.toString();
}

/**
* Returns the path until the loaded diagram (without including it)
*
* @return the path until the loaded diagram (without including it)
*/
private Path getPrunedPath() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public void onDetailsTabChanged(DetailsTabChangedEvent event) {
public void onDiagramObjectsFlagReset(DiagramObjectsFlagResetEvent event) {
State desiredState = new State(this.currentState);
desiredState.setFlag(null);
desiredState.setFlagIncludeInteractors(false); //want to set this to false regardless to remove it from url on Flag close.
this.eventBus.fireEventFromSource(new StateChangedEvent(desiredState), this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ public class Token {
public static String DELIMITER; // Default in Reactome is "&" -> to be set in Browser.java

private Map<StateKey, String> parameters;
private Map<String, String> extraParamMap;
private boolean wellFormed = true;

public Token(String token) throws TokenMalformedException {
if(DEFAULT_SPECIES_ID==null || DELIMITER==null) throw new RuntimeException("Please initialise DEFAULT_SPECIES_ID and DELIMITER");
if (token.startsWith("/")) token = token.substring(1);
// if(token.isEmpty()) token = StateKey.SPECIES.getDefaultKey() + "=" + DEFAULT_SPECIES_ID;

this.parameters = new HashMap<>();
this.extraParamMap = new HashMap<>();
try {
@SuppressWarnings("NonJREEmulationClassesInClientCode")
String[] tokens = token.split(DELIMITER);
Expand All @@ -38,7 +40,7 @@ public Token(String token) throws TokenMalformedException {
if (key != null) {
parameters.put(key, ts[1]);
} else {
wellFormed = false;
extraParamMap.put(ts[0], ts[1]);
}
}
}
Expand All @@ -61,6 +63,10 @@ public Token(String token) throws TokenMalformedException {
public Map<StateKey, String> getParameters() {
return this.parameters;
}

public Map<String, String> getExtraParams() {
return extraParamMap;
}

public List<String> getToLoad(){
List<String> rtn = new LinkedList<>();
Expand Down