dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15905
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5874: Change options property of OptionSet from Set to List.
------------------------------------------------------------
revno: 5874
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-02-07 16:05:40 +0700
message:
Change options property of OptionSet from Set to List.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java 2012-02-03 08:17:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java 2012-02-07 09:05:40 +0000
@@ -27,8 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -42,7 +42,7 @@
{
private static final Pattern OPTION_PATTERN = Pattern.compile( "\\[(.*)\\]" );
- private Set<String> options = new HashSet<String>();
+ private List<String> options = new ArrayList<String>();
public OptionSet()
{
@@ -53,15 +53,6 @@
this.name = name;
}
- public Set<String> getOptions()
- {
- return options;
- }
-
- public void setOptions( Set<String> options )
- {
- this.options = options;
- }
@Override
public int hashCode()
@@ -92,6 +83,16 @@
return name.equals( other.getName() );
}
+ public List<String> getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions( List<String> options )
+ {
+ this.options = options;
+ }
+
public static String optionEncode( String option )
{
return option != null ? ( "[" + option.replaceAll( " ", "_" ) + "]" ) : null;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml 2012-02-03 08:17:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml 2012-02-07 09:05:40 +0000
@@ -15,11 +15,12 @@
</id>
&identifiableProperties;
- <set name="options" table="optionsetmembers">
+ <list name="options" table="optionsetmembers">
<cache usage="read-write" />
<key column="optionsetid" foreign-key="fk_optionsetmembers_optionsetid" />
+ <list-index column="sort_order" base="0" />
<element type="string" column="option" />
- </set>
+ </list>
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java 2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java 2012-02-07 09:05:40 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.dataadmin.action.option;
+import java.util.List;
import java.util.Set;
import org.hisp.dhis.option.OptionService;
@@ -54,7 +55,7 @@
private String name;
- private Set<String> options;
+ private List<String> options;
// -------------------------------------------------------------------------------------------------
// Setters
@@ -70,7 +71,7 @@
this.name = name;
}
- public void setOptions( Set<String> options )
+ public void setOptions( List<String> options )
{
this.options = options;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java 2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java 2012-02-07 09:05:40 +0000
@@ -27,6 +27,7 @@
package org.hisp.dhis.dataadmin.action.option;
+import java.util.List;
import java.util.Set;
import org.hisp.dhis.option.OptionService;
@@ -56,7 +57,7 @@
private String name;
- private Set<String> options;
+ private List<String> options;
// -------------------------------------------------------------------------------------------------
// Setters
@@ -77,7 +78,7 @@
this.name = name;
}
- public void setOptions( Set<String> options )
+ public void setOptions( List<String> options )
{
this.options = options;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm 2012-02-07 03:20:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm 2012-02-07 09:05:40 +0000
@@ -17,7 +17,7 @@
<input id='id' name='id' value='$optionSet.id' type='hidden'>
<table>
<tr>
- <th colspan='2'>$i18n.getString( "details" )</th>
+ <th colspan='3'>$i18n.getString( "details" )</th>
</tr>
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
@@ -27,7 +27,7 @@
<td style="height:15px"></td>
</tr>
<tr>
- <th colspan='2'>$i18n.getString( "options" )
+ <th colspan='3'>$i18n.getString( "options" )
<select id="memberValidator" style="display:none"/></th>
</tr>
<tr>
@@ -36,7 +36,7 @@
</tr>
<tr>
<td></td>
- <td colspan="2">
+ <td colspan="3">
<input type="button" value="$i18n.getString( 'add_option' )" onclick="addOption();" style="width:200px"/>
</td>
</tr>
@@ -49,7 +49,13 @@
#end
</select>
</td>
- </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'options' )"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'options' )"><img src="../images/move_down.png"/></a><br/><br/>
+ <a href="javascript:removeSelectedOption( 'options' )"><img src="../images/delete.png"/></a>
+ </td>
+ </tr>
+ <tr>
<td style="width:30px; text-align:center"> </td>
</tr>
<tr>