-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into BMS-5074-EditDeleteFolder
- Loading branch information
Showing
54 changed files
with
3,896 additions
and
2,391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/org/generationcp/ibpworkbench/actions/AskForSupportAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.generationcp.ibpworkbench.actions; | ||
|
||
import com.vaadin.terminal.ExternalResource; | ||
import com.vaadin.ui.Button.ClickEvent; | ||
import com.vaadin.ui.Button.ClickListener; | ||
import com.vaadin.ui.Window; | ||
|
||
|
||
public class AskForSupportAction implements ClickListener { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private Window sourceWindow; | ||
private String url; | ||
|
||
public AskForSupportAction(Window sourceWindow, String url) { | ||
super(); | ||
this.sourceWindow = sourceWindow; | ||
this.url = url; | ||
} | ||
|
||
@Override | ||
public void buttonClick(ClickEvent event) { | ||
this.sourceWindow.open(new ExternalResource(url), "_blank"); | ||
} | ||
|
||
public Window getSourceWindow() { | ||
return sourceWindow; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/org/generationcp/ibpworkbench/actions/HelpButtonClickAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.generationcp.ibpworkbench.actions; | ||
|
||
import com.vaadin.terminal.ExternalResource; | ||
import com.vaadin.ui.Window; | ||
import com.vaadin.ui.Button.ClickEvent; | ||
import com.vaadin.ui.Button.ClickListener; | ||
|
||
|
||
public class HelpButtonClickAction implements ClickListener { | ||
|
||
private static final long serialVersionUID = 1L; | ||
private Window sourceWindow; | ||
private String url; | ||
|
||
public HelpButtonClickAction(Window sourceWindow, String url) { | ||
super(); | ||
this.sourceWindow = sourceWindow; | ||
this.url = url; | ||
} | ||
|
||
@Override | ||
public void buttonClick(ClickEvent event) { | ||
this.sourceWindow.open(new ExternalResource(url), "_blank"); | ||
} | ||
|
||
public Window getSourceWindow() { | ||
return sourceWindow; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...ingViewDesignTypeValueChangeListener.java → ...ingViewDesignTypeValueChangeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...pworkbench/actions/breedingview/singlesiteanalysis/GenotypeFactorValueChangeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
package org.generationcp.ibpworkbench.actions.breedingview.singlesiteanalysis; | ||
|
||
import java.util.List; | ||
|
||
import org.generationcp.commons.util.StringUtil; | ||
import org.generationcp.commons.vaadin.util.MessageNotifier; | ||
import org.generationcp.ibpworkbench.ui.breedingview.singlesiteanalysis.SingleSiteAnalysisDetailsPanel; | ||
import org.generationcp.ibpworkbench.ui.breedingview.singlesiteanalysis.SingleSiteAnalysisEnvironmentsComponent; | ||
|
||
import com.vaadin.data.Property.ValueChangeEvent; | ||
import com.vaadin.data.Property.ValueChangeListener; | ||
|
||
public class GenotypeFactorValueChangeListener implements ValueChangeListener { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private final SingleSiteAnalysisEnvironmentsComponent environmentsComponent; | ||
|
||
public GenotypeFactorValueChangeListener(final SingleSiteAnalysisEnvironmentsComponent environmentsComponent) { | ||
super(); | ||
this.environmentsComponent = environmentsComponent; | ||
} | ||
|
||
@Override | ||
public void valueChange(final ValueChangeEvent event) { | ||
final List<String> invalidEnvironments = this.environmentsComponent.getInvalidEnvironments(); | ||
if (!invalidEnvironments.isEmpty()) { | ||
|
||
MessageNotifier.showError(this.environmentsComponent.getWindow(), SingleSiteAnalysisDetailsPanel.INVALID_SELECTION_STRING, | ||
this.environmentsComponent.getSelEnvFactorValue() + " " + StringUtil.joinIgnoreEmpty(",", invalidEnvironments) + " " | ||
+ SingleSiteAnalysisDetailsPanel.INCOMPLETE_PLOT_DATA_ERROR); | ||
} | ||
|
||
} | ||
|
||
} |
101 changes: 101 additions & 0 deletions
101
...workbench/actions/breedingview/singlesiteanalysis/RunBreedingViewButtonClickListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
|
||
package org.generationcp.ibpworkbench.actions.breedingview.singlesiteanalysis; | ||
|
||
import java.util.List; | ||
|
||
import org.generationcp.commons.vaadin.ui.ConfirmDialog; | ||
import org.generationcp.ibpworkbench.model.SeaEnvironmentModel; | ||
import org.generationcp.ibpworkbench.ui.breedingview.singlesiteanalysis.SingleSiteAnalysisDetailsPanel; | ||
import org.generationcp.middleware.domain.dms.DataSet; | ||
import org.generationcp.middleware.domain.dms.DataSetType; | ||
import org.generationcp.middleware.domain.dms.TrialEnvironment; | ||
import org.generationcp.middleware.domain.dms.TrialEnvironments; | ||
import org.generationcp.middleware.manager.api.StudyDataManager; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Configurable; | ||
|
||
import com.vaadin.ui.Button.ClickEvent; | ||
import com.vaadin.ui.Button.ClickListener; | ||
|
||
@Configurable | ||
public class RunBreedingViewButtonClickListener implements ClickListener { | ||
|
||
private static final long serialVersionUID = -6682011023617457906L; | ||
private static final Logger LOG = LoggerFactory.getLogger(RunBreedingViewButtonClickListener.class); | ||
|
||
@Autowired | ||
private StudyDataManager studyDataManager; | ||
|
||
private final SingleSiteAnalysisDetailsPanel ssaDetailsPanel; | ||
private RunSingleSiteAction runSingleSiteAction; | ||
|
||
public RunBreedingViewButtonClickListener(final SingleSiteAnalysisDetailsPanel ssaDetailsPanel) { | ||
super(); | ||
this.ssaDetailsPanel = ssaDetailsPanel; | ||
this.runSingleSiteAction = new RunSingleSiteAction(ssaDetailsPanel); | ||
} | ||
|
||
@Override | ||
public void buttonClick(final ClickEvent event) { | ||
|
||
if (Boolean.parseBoolean(this.ssaDetailsPanel.getIsServerApp())) { | ||
this.runSingleSiteAction.buttonClick(event); | ||
return; | ||
} | ||
|
||
final List<DataSet> dataSets; | ||
try { | ||
|
||
dataSets = this.studyDataManager.getDataSetsByType(this.ssaDetailsPanel.getBreedingViewInput().getStudyId(), | ||
DataSetType.MEANS_DATA); | ||
if (!dataSets.isEmpty()) { | ||
|
||
final DataSet meansDataSet = dataSets.get(0); | ||
final TrialEnvironments envs = this.studyDataManager.getTrialEnvironmentsInDataset(meansDataSet.getId()); | ||
|
||
Boolean environmentExists = false; | ||
for (final SeaEnvironmentModel model : this.ssaDetailsPanel.getSelectedEnvironments()) { | ||
|
||
final TrialEnvironment env = envs | ||
.findOnlyOneByLocalName(this.ssaDetailsPanel.getBreedingViewInput().getTrialInstanceName(), model.getTrialno()); | ||
if (env != null) { | ||
environmentExists = true; | ||
break; | ||
} | ||
|
||
} | ||
|
||
if (environmentExists) { | ||
ConfirmDialog.show(event.getComponent().getWindow(), "", | ||
"One or more of the selected traits has existing means data. If you save the results of this analysis, the existing values will be overwritten.", | ||
"OK", "Cancel", new Runnable() { | ||
|
||
@Override | ||
public void run() { | ||
|
||
new RunSingleSiteAction(RunBreedingViewButtonClickListener.this.ssaDetailsPanel).buttonClick(event); | ||
} | ||
|
||
}); | ||
} else { | ||
this.runSingleSiteAction.buttonClick(event); | ||
} | ||
|
||
} else { | ||
this.runSingleSiteAction.buttonClick(event); | ||
} | ||
|
||
} catch (final Exception e) { | ||
this.runSingleSiteAction.buttonClick(event); | ||
RunBreedingViewButtonClickListener.LOG.error(e.getMessage(), e); | ||
} | ||
|
||
} | ||
|
||
protected void setRunSingleSiteAction(final RunSingleSiteAction runSingleSiteAction) { | ||
this.runSingleSiteAction = runSingleSiteAction; | ||
} | ||
|
||
} |
Oops, something went wrong.