forked from devgateway/dg-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TOBACCO-800: Add industry responses variables
- Loading branch information
Showing
7 changed files
with
200 additions
and
67 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
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
4 changes: 3 additions & 1 deletion
4
...va/org/devgateway/toolkit/forms/wicket/page/edit/dataset/EditTetsimDatasetPage.properties
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
page.title.add=Add TETSIM Dataset | ||
page.title.edit=Edit TETSIM Dataset | ||
year.label=Year | ||
year.label=Year | ||
|
||
error.form.validation.marketShare.percentage=The total of all the market share values should add up to 100 |
23 changes: 23 additions & 0 deletions
23
...a/org/devgateway/toolkit/forms/wicket/page/edit/dataset/TetsimIndustryResponsesPanel.html
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> | ||
<body> | ||
<wicket:panel> | ||
<div class="col-md-12"> | ||
<h3>Industry responses to the change in taxation:</h3> | ||
</div> | ||
|
||
<div class="col-md-12"> | ||
<table class="table table-hover table-bordered" border="1"> | ||
<thead> | ||
<tr class="headers"> | ||
<th wicket:id="industryResponsesHeaders"/> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr wicket:id="industryResponsesVariables"/> | ||
</tbody> | ||
</table> | ||
</div> | ||
</wicket:panel> | ||
</body> | ||
</html> |
96 changes: 96 additions & 0 deletions
96
...a/org/devgateway/toolkit/forms/wicket/page/edit/dataset/TetsimIndustryResponsesPanel.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,96 @@ | ||
package org.devgateway.toolkit.forms.wicket.page.edit.dataset; | ||
|
||
import org.apache.wicket.Component; | ||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.markup.html.panel.Panel; | ||
import org.apache.wicket.markup.repeater.RepeatingView; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
import org.apache.wicket.model.PropertyModel; | ||
import org.apache.wicket.model.StringResourceModel; | ||
import org.apache.wicket.spring.injection.annot.SpringBean; | ||
import org.devgateway.toolkit.persistence.dao.categories.TobaccoProduct; | ||
import org.devgateway.toolkit.persistence.dao.data.TetsimDataset; | ||
import org.devgateway.toolkit.persistence.service.category.TobaccoProductService; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Viorel Chihai | ||
*/ | ||
public class TetsimIndustryResponsesPanel extends Panel { | ||
|
||
protected final IModel<TetsimDataset> tetsimDatasetIModel; | ||
|
||
@SpringBean | ||
protected TobaccoProductService tobaccoProductService; | ||
|
||
public TetsimIndustryResponsesPanel(final String id, final IModel<TetsimDataset> tetsimDatasetIModel) { | ||
super(id); | ||
this.tetsimDatasetIModel = tetsimDatasetIModel; | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
add(getIndustryResponsesHeaders()); | ||
add(getIndustryResponsesVariables()); | ||
} | ||
|
||
private Component getIndustryResponsesHeaders() { | ||
RepeatingView analysisHeaders = new RepeatingView("industryResponsesHeaders"); | ||
analysisHeaders.add(new Label(analysisHeaders.newChildId(), | ||
Model.of("Industry responses to the change in taxation"))); | ||
analysisHeaders.add(new Label(analysisHeaders.newChildId(), Model.of("Unit"))); | ||
|
||
List<TobaccoProduct> tobaccoProducts = tobaccoProductService.findAllSorted(); | ||
for (TobaccoProduct tobaccoProduct : tobaccoProducts) { | ||
analysisHeaders.add(new Label(analysisHeaders.newChildId(), | ||
new PropertyModel<>(tobaccoProduct, "label"))); | ||
} | ||
|
||
return analysisHeaders; | ||
} | ||
|
||
private Component getIndustryResponsesVariables() { | ||
RepeatingView variables = new RepeatingView("industryResponsesVariables"); | ||
|
||
variables.add(getOverShifting(variables.newChildId())); | ||
variables.add(getUnderShifting(variables.newChildId())); | ||
|
||
return variables; | ||
} | ||
|
||
/** | ||
* Get overshifting variable panel with tobacco product inputs. | ||
* Mandatory. Numerical fields with decimals. | ||
* | ||
* @param id | ||
* @return TetsimTobaccoProductsVariable | ||
*/ | ||
private TetsimTobaccoProductsVariable getOverShifting(final String id) { | ||
return new TetsimTobaccoProductsVariable(id, | ||
new StringResourceModel("overShifting.label"), | ||
new StringResourceModel("overShifting.unit"), | ||
new PropertyModel<>(tetsimDatasetIModel, "overShifting"), true) { | ||
}; | ||
} | ||
|
||
/** | ||
* Get undershifting variable panel with tobacco product inputs. | ||
* Mandatory. Numerical fields with decimals. | ||
* | ||
* @param id | ||
* @return TetsimTobaccoProductsVariable | ||
*/ | ||
private TetsimTobaccoProductsVariable getUnderShifting(final String id) { | ||
return new TetsimTobaccoProductsVariable(id, | ||
new StringResourceModel("underShifting.label"), | ||
new StringResourceModel("underShifting.unit"), | ||
new PropertyModel<>(tetsimDatasetIModel, "underShifting"), true) { | ||
}; | ||
} | ||
|
||
} | ||
|
||
|
6 changes: 6 additions & 0 deletions
6
...devgateway/toolkit/forms/wicket/page/edit/dataset/TetsimIndustryResponsesPanel.properties
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,6 @@ | ||
overShifting.label=Overshifting (% change above excise tax increase) | ||
overShifting.unit=Percentage change above excise tax increase | ||
|
||
underShifting.label=Change in illicit NOT (proportion of change in discount price): sensitivity factor | ||
underShifting.unit=Undershifting (% change below excise tax increase) | ||
|
Oops, something went wrong.