Changeset 1025 for trunk/src/anaToMia


Ignore:
Timestamp:
10/26/11 12:02:37 (13 years ago)
Author:
lgiessmann
Message:

gdl-frontend: Widgets: implemented the gdlt:Variant-Name-Scope semantics for generating content entered in GdlVisibleObject?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java

    r1024 r1025  
    27382738        }
    27392739       
     2740       
     2741        // handles the getContent call for scope topics of variant-names
     2742        private void getVariantNameScopeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
     2743                if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
     2744                ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());             
     2745                if(possibleVariants.size() != 0){
     2746                        Variant variant = possibleVariants.get(0);
     2747                        JsArray<Topic> scopes = variant.getScope();
     2748                       
     2749                        if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex));
     2750
     2751                        if(scopes.length() > selectedValueIndex){
     2752                                Topic oldScope = scopes.get(selectedValueIndex);
     2753                                Topic newScope = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
     2754                               
     2755                                if(!oldScope.equals(newScope)){
     2756                                        variant.removeTheme(oldScope);
     2757                                        variant.addTheme(newScope);
     2758                                }
     2759                        }
     2760
     2761                        contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
     2762                }
     2763        }
     2764       
    27402765               
    27412766        // returns the actual data that is hold by this instance
     
    27662791                                // TODO: implement
    27672792                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
    2768                                 // TODO: implement
     2793                                this.getVariantNameScopeContent(result, validate, (Topic)localCarrier, idx);
    27692794                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
    27702795                                this.getVariantReifierContent(result, validate, (Topic)localCarrier, idx);
Note: See TracChangeset for help on using the changeset viewer.