Fixing timeline status
This commit is contained in:
parent
7c646b3ead
commit
fec3f26c0a
|
@ -148,8 +148,9 @@ public class ProjectViewer extends Composite {
|
||||||
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
|
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
|
||||||
if (relationships != null && relationships.size() > 0) {
|
if (relationships != null && relationships.size() > 0) {
|
||||||
relationshipsButton.setVisible(true);
|
relationshipsButton.setVisible(true);
|
||||||
} else
|
} else {
|
||||||
relationshipsButton.setVisible(false);
|
relationshipsButton.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
relationshipsButton.addClickHandler(new ClickHandler() {
|
relationshipsButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
|
|
@ -9,32 +9,35 @@ import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
public class TimelineManagerStatus {
|
public class TimelineManagerStatus {
|
||||||
|
|
||||||
private ProjectDV showingProject;
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
private TimelineStatus status;
|
||||||
|
|
||||||
public TimelineManagerStatus(HandlerManager applicationBus) {
|
public TimelineManagerStatus(HandlerManager applicationBus) {
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TimelineRelationPanel getTimelineOf(ProjectDV theProject) {
|
protected TimelineStatus getTimelineOf(ProjectDV theProject) {
|
||||||
|
|
||||||
|
if (status == null) {
|
||||||
|
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
|
||||||
|
GWT.log("Displaying new Timeline of " + status);
|
||||||
|
return status;
|
||||||
|
|
||||||
if (showingProject == null) {
|
|
||||||
GWT.log("Displaying new Timeline of " + theProject);
|
|
||||||
this.showingProject = theProject;
|
|
||||||
return new TimelineRelationPanel(applicationBus, theProject);
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
boolean c1 = showingProject.getId().compareTo(theProject.getId()) == 0;
|
boolean c1 = status.getTheProjectDV().getId().compareTo(theProject.getId()) == 0;
|
||||||
boolean c2 = showingProject.getProfileID().compareTo(theProject.getProfileID()) == 0;
|
boolean c2 = status.getTheProjectDV().getProfileID().compareTo(theProject.getProfileID()) == 0;
|
||||||
|
|
||||||
if (!c1 || !c2) {
|
if (!c1 || !c2) {
|
||||||
GWT.log("Displaying Timeline of " + theProject);
|
GWT.log("Displaying Timeline of " + status);
|
||||||
this.showingProject = theProject;
|
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
|
||||||
return new TimelineRelationPanel(applicationBus, theProject);
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("Skipping already displayed Timeline of " + theProject);
|
status.statusChanged(false);
|
||||||
return null;
|
GWT.log("Skipping already displayed Timeline of " + status);
|
||||||
|
return status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,18 +46,50 @@ public class TimelineManagerStatus {
|
||||||
public void showTimelineProjectRelations(ProjectDV theProject) {
|
public void showTimelineProjectRelations(ProjectDV theProject) {
|
||||||
GWT.log("Showing project relations for: " + theProject);
|
GWT.log("Showing project relations for: " + theProject);
|
||||||
|
|
||||||
TimelineRelationPanel timeline = getTimelineOf(theProject);
|
TimelineStatus timelineStatus = getTimelineOf(theProject);
|
||||||
if (timeline != null) {
|
if (timelineStatus.isStatusChanged()) {
|
||||||
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
|
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
|
||||||
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
|
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timelineStatus.getTimelineRP());
|
||||||
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timeline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
|
||||||
|
timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideTimelineProjectRelations() {
|
public void hideTimelineProjectRelations() {
|
||||||
GWT.log("hideTimelineProjectRelations");
|
GWT.log("hideTimelineProjectRelations");
|
||||||
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);
|
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);
|
||||||
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
|
//RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TimelineStatus {
|
||||||
|
|
||||||
|
public boolean statusChanged = false;
|
||||||
|
private TimelineRelationPanel timelineRP;
|
||||||
|
private ProjectDV theProjectDV;
|
||||||
|
|
||||||
|
public TimelineStatus(boolean statusChanged, TimelineRelationPanel timelineRP, ProjectDV theProjectDV) {
|
||||||
|
this.statusChanged = statusChanged;
|
||||||
|
this.timelineRP = timelineRP;
|
||||||
|
this.theProjectDV = theProjectDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void statusChanged(boolean bool) {
|
||||||
|
this.statusChanged = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStatusChanged() {
|
||||||
|
return statusChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimelineRelationPanel getTimelineRP() {
|
||||||
|
return timelineRP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectDV getTheProjectDV() {
|
||||||
|
return theProjectDV;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,9 @@ public class TimelineRelationPanel extends Composite {
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
if(timelineContainer.isVisible())
|
if(timelineContainer.isVisible())
|
||||||
timelineContainer.setVisible(false);
|
setTimelineContainerVisible(false);
|
||||||
else
|
else
|
||||||
timelineContainer.setVisible(true);
|
setTimelineContainerVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -124,6 +124,10 @@ public class TimelineRelationPanel extends Composite {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTimelineContainerVisible(boolean bool) {
|
||||||
|
timelineContainer.setVisible(bool);
|
||||||
|
}
|
||||||
|
|
||||||
private void setSelectedProject(String projectID) {
|
private void setSelectedProject(String projectID) {
|
||||||
this.selectedProjectID = projectID;
|
this.selectedProjectID = projectID;
|
||||||
|
|
Loading…
Reference in New Issue