[isidorus-cvs] r791 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Fri Aug 26 07:15:10 UTC 2011
Author: lgiessmann
Date: Fri Aug 26 00:15:10 2011
New Revision: 791
Log:
gdl-frontend: Widgets: finalised addSubItem of the class GdlListBox
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java Fri Aug 26 00:06:26 2011 (r790)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlListBox.java Fri Aug 26 00:15:10 2011 (r791)
@@ -47,9 +47,16 @@
} else if(exLiteralValues.size() != 0){
options = exLiteralValues;
} else if(exTmValues.size() != 0){
- // TODO: get all Topics that are represented by a TM-Value
- // TODO: get its string-representation
- // TODO: add it to the options ArrayList
+ ArrayList<Topic> validValues = new ArrayList<Topic>();
+
+ for (Topic tmValue : exTmValues){
+ for (Topic topicInstance : TmHelper.getValuesForTmValue(tmValue)){
+ if(!validValues.contains(topicInstance)){
+ validValues.add(topicInstance);
+ options.add(this.getTopicRepresentation(topicInstance, this.getDisplayByOfTmValue(tmValue), this.getPreferredScopeOfTmValue(tmValue)));
+ }
+ }
+ }
} else {
ArrayList<Topic> tmValues = this.getTmValuesForConstraint();
if(tmValues.size() != 0){
@@ -62,23 +69,12 @@
ListBox lb = this.createNewListBox();
for(String item : options) lb.addItem(item);
- int i = 0;
- for( ; i != lb.getItemCount(); ++i){
+ for(int i = 0; i != lb.getItemCount(); ++i){
if(lb.getItemText(i).equals(value)){
lb.setSelectedIndex(i);
break;
}
}
-
- if(i == lb.getItemCount()){
- lb.addItem(value);
- for(i = 0 ; i != lb.getItemCount(); ++i){
- if(lb.getItemText(i).equals(value)){
- lb.setSelectedIndex(i);
- break;
- }
- }
- }
}
More information about the Isidorus-cvs
mailing list