Changeset 1015 for trunk/src


Ignore:
Timestamp:
10/25/11 09:03:42 (13 years ago)
Author:
lgiessmann
Message:

gdl-frontend: Widgets: implemented the tmcl:subject-identifier-constraint and tmcl:subject-locator-constraint semantics for generating content entered in GdlVisibleObject?

Location:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets
Files:
10 edited

Legend:

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

    r940 r1015  
    33import java.util.ArrayList;
    44import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
    5 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
    65import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
    76import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
     
    211210                                throw new ExecutionException("No CommitCallback was set yet");
    212211                        }
    213                         ArrayList<Pair<Construct, TopicMapsTypes>> data = new ArrayList<Pair<Construct,TopicMapsTypes>>();
    214                         data.add(new Pair<Construct, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
     212                        ArrayList<Pair<Object, TopicMapsTypes>> data = new ArrayList<Pair<Object,TopicMapsTypes>>();
     213                        data.add(new Pair<Object, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
    215214                        this.commitCallback.commitTmConstruct(data, null, this.tmEngine);
    216215                }catch(Exception e){
     
    254253                                throw new ExecutionException("No DeleteCallback was set yet");
    255254       
    256                         ArrayList<Pair<Construct, TopicMapsTypes>> data = new ArrayList<Pair<Construct,TopicMapsTypes>>();
    257                         data.add(new Pair<Construct, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
     255                        ArrayList<Pair<Object, TopicMapsTypes>> data = new ArrayList<Pair<Object,TopicMapsTypes>>();
     256                        data.add(new Pair<Object, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
    258257                        this.deleteCallback.deleteTmConstruct(data, this.getTmEngine(), null);
    259258                }catch(Exception e){
     
    266265        // this method is responsible for generating a Topic Map fo the user's
    267266        // data by using the view's getContent method.
    268         public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(boolean validate) throws Exception {
     267        public ArrayList<Pair<Object, TopicMapsTypes>> getContent(boolean validate) throws Exception {
    269268                try{
    270269                        return this.view.getContent(null, validate);
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java

    r1014 r1015  
    55import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
    66import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
     7import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
    78import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
    89import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
     
    23342335
    23352336
    2336         // validates names, occurrences and identifiers for tha passed value
     2337        // validates names, occurrences and identifiers for the passed value
    23372338        private void validateLiteralValue(String selectedValue) throws InvalidContentException, InvalidGdlSchemaException{
    2338                 ArrayList<Pattern> validLiteralValues = new ArrayList<Pattern>();
    2339                 for (String literal : this.getLiterals()) validLiteralValues.add(new Pattern(literal));
    2340                 if(validLiteralValues.size() == 0) validLiteralValues.add(new Pattern(this.getLiteralValueForConstraint()));   
    2341                 int i = 0;
    2342                 for( ; i != validLiteralValues.size(); ++i) if(validLiteralValues.get(i).matches(selectedValue)) break;
    2343 
    2344                 if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
    2345                         if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-name " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues));
    2346                 } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
    2347                         if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-occurrence " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues));
    2348                 } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
    2349 
    2350                 } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
    2351 
    2352                 } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
    2353 
     2339                if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint) || TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint) || TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
     2340                        Pattern pattern = new Pattern(TmHelper.getRegExp(this.getConstraint()));
     2341                        if(!pattern.matches(selectedValue)) throw new InvalidContentException("The value \"" + selectedValue + "\" does not satisfy the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " with the regular expression: " + TmHelper.getRegExp(this.getConstraint()));
     2342                } else {
     2343                        ArrayList<Pattern> validLiteralValues = new ArrayList<Pattern>();
     2344                        for (String literal : this.getLiterals()) validLiteralValues.add(new Pattern(literal));
     2345                        if(validLiteralValues.size() == 0) validLiteralValues.add(new Pattern(this.getLiteralValueForConstraint()));   
     2346                        int i = 0;
     2347                        for( ; i != validLiteralValues.size(); ++i) if(validLiteralValues.get(i).matches(selectedValue)) break;
     2348
     2349                        if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
     2350                                if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-name " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues));
     2351                        } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
     2352                                if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-occurrence " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues));
     2353                        }
    23542354                }
    23552355        }
     
    23812381        }
    23822382
     2383       
     2384        // returns all locators contained in the passed locators array, which match the
     2385        // passed regular expression value
     2386        private ArrayList<Locator> filterLocators(String pattern, JsArray<Locator> locators){
     2387                ArrayList<Locator> result = new ArrayList<Locator>();
     2388                if(locators == null || locators.length() == 0) return result;
     2389                Pattern patternObject = new Pattern(pattern == null ? ".*" : pattern);
     2390               
     2391                for(int i = 0; i != locators.length(); ++i){
     2392                        if(patternObject.matches(locators.get(i).getReference())) result.add(locators.get(i));
     2393                }
     2394               
     2395                return result;
     2396        }
     2397       
     2398       
     2399        // handles the getContetn call for subject identifiers and subject locators
     2400        private void getTopicIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
     2401                JsArray<Locator> identifiers = null;
     2402                       
     2403                ArrayList<Locator> filteredIdentifiers = null;
     2404                boolean isPsiConstraint = false;
     2405                if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
     2406                        isPsiConstraint = true;
     2407                        identifiers = carier.getSubjectIdentifiers();
     2408                        filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
     2409                } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
     2410                        identifiers = carier.getSubjectLocators();
     2411                        filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
     2412                } else {
     2413                        throw new ExecutionException("Only the constraints " + PSIs.TMCL.tmclSubjectIdentifierConstraint + " and " + PSIs.TMCL.tmclSubjectLocatorConstraint + " are supported by the function getTopicIdentifierContent");
     2414                }
     2415               
     2416                Locator changedIdentifier = null;
     2417                if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex));
     2418               
     2419                if(filteredIdentifiers.size() > selectedValueIndex){
     2420                        changedIdentifier = filteredIdentifiers.get(selectedValueIndex);
     2421                        if(isPsiConstraint) carier.removeSubjectIdentifier(changedIdentifier);
     2422                        else carier.removeSubjectLocator(changedIdentifier);
     2423                }
     2424               
     2425                changedIdentifier = carier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex));
     2426                if(isPsiConstraint) carier.addSubjectIdentifier(changedIdentifier);
     2427                else carier.addSubjectLocator(changedIdentifier);
     2428                contents.add(new Pair<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
     2429        }
     2430       
    23832431
    23842432        // returns the actual data that is hold by this instance
    2385         public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
    2386                 ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
     2433        public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
     2434                ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
    23872435                if(this.getRootConstraint() == null) return result;
    23882436                Construct localCarrier = carrier;
     
    23932441                                // TODO: implement
    23942442                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
    2395                                 // TODO: implement
     2443                                if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
     2444                                this.getTopicIdentifierContent(result, validate, (Topic)localCarrier, idx);
    23962445                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
    2397                                 // TODO: implement
    2398                         } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){                             
     2446                                if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
     2447                                this.getTopicIdentifierContent(result, validate, (Topic)localCarrier, idx);
     2448                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
    23992449                                if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
    24002450                                Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint());
     
    24102460                                        changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null);
    24112461                                }
    2412 
    2413                                 result.add(new Pair<Construct, TopicMapsTypes>(changedName, TopicMapsTypes.Name));
     2462                                result.add(new Pair<Object, TopicMapsTypes>(changedName, TopicMapsTypes.Name));
    24142463                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
    24152464                                // TODO: implement                     
     
    24432492                                }
    24442493
    2445                                 result.add(new Pair<Construct, TopicMapsTypes>(changedOccurrence, TopicMapsTypes.Occurrence));
     2494                                result.add(new Pair<Object, TopicMapsTypes>(changedOccurrence, TopicMapsTypes.Occurrence));
    24462495                        } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
    24472496                                if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass());
     
    24662515                                        changedRole = ((Association)localCarrier).createRole(roleType, player);
    24672516                                }
    2468                                 result.add(new Pair<Construct, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
     2517                                result.add(new Pair<Object, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
    24692518                        } else {
    24702519                                throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported");
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java

    r1003 r1015  
    33import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
    44import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
    5 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
    65import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
     6import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
    77import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback;
    88import us.isidor.gdl.anaToMia.Widgets.environment.IDeleteCallback;
     
    5757                        gdlPanel.setCommitCallback(new ICommitCallback() {
    5858                                @Override
    59                                 public void commitTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
    60                                         Window.alert("not implemented yet :-(");
     59                                public void commitTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
     60                                        for (Pair<Object, TopicMapsTypes> construct : constructs) {
     61                                                if(construct.getSecond().equals(TopicMapsTypes.Topic)){
     62                                                        Window.alert("Topic!!!");
     63                                                } else if(construct.getSecond().equals(TopicMapsTypes.Locator)){
     64                                                        Window.alert(((Locator)construct.getFirst()).getReference() + " >> " + construct.getSecond());
     65                                                } else {
     66                                                        Window.alert(construct.getFirst() + " >> " + construct.getSecond());
     67                                                }
     68                                        }
    6169                                }
    6270                        });
    6371                        gdlPanel.setDeleteCallback(new IDeleteCallback() {
    6472                                @Override
    65                                 public void deleteTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
     73                                public void deleteTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
    6674                                        Window.alert("not implemented yet :-(");
    6775                                }
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java

    r1014 r1015  
    12111211                ArrayList<Topic> nameOrOccurrenceTypes = Utils.union(nameTypes, occurrenceTypes);
    12121212               
    1213                 if(nameOrOccurrenceTypes.size() == 0){
     1213                 if(nameOrOccurrenceTypes.size() == 0){
    12141214                        return result;
    12151215                } else if(nameOrOccurrenceTypes.size() > 1){
     
    13691369
    13701370       
    1371         // returns an integer representing the tmcl:card-min value
     1371        // returns an integer representing the tmcl:card-min value of the passed constraint
    13721372        public static int getCardMin(Topic constraint) throws InvalidGdlSchemaException {
    13731373                if(constraint == null) return 0;
     
    13851385       
    13861386       
    1387         // returns an integer representing the tmcl:card-max value or -1
    1388         // if infinite
     1387        // returns a string representing the tmcl:regexp value of the passed constraint
     1388        public static String getRegExp(Topic constraint) throws InvalidGdlSchemaException {
     1389                if(constraint == null) return ".*";
     1390                Occurrence occ = getSingleOccurrence(constraint, getTopicByPsi(PSIs.TMCL.tmclRegexp, constraint.getTopicMap()));
     1391                if(occ == null){
     1392                        return ".*";
     1393                } else {
     1394                        return occ.getValue();
     1395                }
     1396        }
     1397       
     1398       
     1399        // returns an integer representing the tmcl:card-max value of the
     1400        // passed constraint or -1 if infinite
    13891401        public static int getCardMax(Topic constraint) throws InvalidGdlSchemaException {
    13901402                if(constraint == null) return 0;
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java

    r875 r1015  
    44
    55import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
    6 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
    76import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
    87
     
    109
    1110public interface ICommitCallback {
    12         public void commitTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine);
     11        public void commitTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine);
    1312}
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java

    r844 r1015  
    33import java.util.ArrayList;
    44import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
    5 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
    65import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
    76
    87
    98public interface IDeleteCallback {
    10         public void deleteTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId);
     9        public void deleteTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId);
    1110}
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java

    r966 r1015  
    2323import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
    2424import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
    25 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
    2625import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
    2726import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
     
    5049       
    5150        @Override
    52         public void commitTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
     51        public void commitTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
    5352                try{
    5453                        if("creator_hash_object_commit_button_id".equals(buttonId)){
     
    7978       
    8079       
    81         private void commitCreatedEnvironment(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException {
     80        private void commitCreatedEnvironment(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException {
    8281                final String carrierPsi = PSIs.GDL.gdl + "environment_default_creator_topic_view_id";
    8382                ArrayList<Topic> topics = new ArrayList<Topic>();
    8483                ArrayList<TopicMap> topicMaps = new ArrayList<TopicMap>();
    8584               
    86                 for (Pair<Construct, TopicMapsTypes> construct : constructs) {
     85                for (Pair<Object, TopicMapsTypes> construct : constructs) {
    8786                        if(construct.getSecond().equals(TopicMapsTypes.Topic)) topics.add((Topic)construct.getFirst());
    8887                        else if(construct.getSecond().equals(TopicMapsTypes.TopicMap)) topicMaps.add((TopicMap)construct.getFirst());
     
    135134       
    136135       
    137         private void commitCreatedHashObject(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, boolean edited) throws ExporterException{
     136        private void commitCreatedHashObject(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine, boolean edited) throws ExporterException{
    138137                final String carrierPsi = PSIs.GDL.gdl + "hash_object_default_creator_topic_view_id";
    139138                ArrayList<Topic> topics = new ArrayList<Topic>();
     
    141140                ArrayList<TopicMap> topicMaps = new ArrayList<TopicMap>();
    142141               
    143                 for (Pair<Construct, TopicMapsTypes> construct : constructs) {
     142                for (Pair<Object, TopicMapsTypes> construct : constructs) {
    144143                        if(construct.getSecond().equals(TopicMapsTypes.Association)) associations.add((Association)construct.getFirst());
    145144                        else if(construct.getSecond().equals(TopicMapsTypes.Topic)) topics.add((Topic)construct.getFirst());
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java

    r958 r1015  
    1919import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException;
    2020import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
    21 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
    2221import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
    2322import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
     
    5352
    5453        @Override
    55         public void deleteTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
     54        public void deleteTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
    5655                if(buttonId != null){
    5756                        Element elem = DOM.getElementById(buttonId);
     
    6362
    6463       
    65         private void deleteTopic(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine){
    66                 for (Pair<Construct, TopicMapsTypes> pair : constructs) {
     64        private void deleteTopic(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine){
     65                for (Pair<Object, TopicMapsTypes> pair : constructs) {
    6766                        if(pair.getSecond().equals(TopicMapsTypes.Topic)){
    6867                                Topic top = (Topic)pair.getFirst();
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java

    r875 r1015  
    186186       
    187187        @Override
    188         public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException{
    189                 ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
     188        public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException{
     189                ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
    190190               
    191191                for (Widget ctrl : this.subElements) {
    192192                        if(ctrl instanceof ButtonableObject){
    193193                                if(((ButtonableObject)ctrl).getMainObject() instanceof AssociationItem){
    194                                         for (Pair<Construct, TopicMapsTypes> pair : ((AssociationItem)((ButtonableObject)ctrl).getMainObject()).getContent(null, validate)) {
     194                                        for (Pair<Object, TopicMapsTypes> pair : ((AssociationItem)((ButtonableObject)ctrl).getMainObject()).getContent(null, validate)) {
    195195                                                result.add(pair);
    196196                                        }
     
    208208                        if(TmHelper.isInstanceOf(hdv.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
    209209                                if(!TmHelper.isInstanceOf(hdv.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(hdv.getConstraint()) + " must be bound to an instance of " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(hdv.getRootConstraint()));
    210                                 for (Pair<Construct, TopicMapsTypes> pair : result) {
     210                                for (Pair<Object, TopicMapsTypes> pair : result) {
    211211                                        if(pair.getSecond().equals(TopicMapsTypes.Association)){
    212212                                                Association assoc = (Association)pair.getFirst();
     
    277277               
    278278                @Override
    279                 public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
    280                         ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
     279                public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
     280                        ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
    281281                       
    282282                        Association localCarrier = this.getRepresentedAssociation();
     
    287287                                }
    288288                        }
    289                         result.add(new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Association));
     289                        result.add(new Pair<Object, TopicMapsTypes>(localCarrier, TopicMapsTypes.Association));
    290290                        return result;
    291291                }
  • TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java

    r875 r1015  
    8989        // returns true if the construct that is contained in the first member of pair
    9090        // is also indirectly contained in the container
    91         private boolean indirectlyContained(Pair<Construct, TopicMapsTypes> pair, ArrayList<Pair<Construct, TopicMapsTypes>> container){
     91        private boolean indirectlyContained(Pair<Object, TopicMapsTypes> pair, ArrayList<Pair<Object, TopicMapsTypes>> container){
    9292                if(pair == null) return true;
    9393                if(container == null) return false;
     
    9696                if(newType.equals(TopicMapsTypes.Name)){
    9797                        Name name = (Name)pair.getFirst();
    98                         for (Pair<Construct, TopicMapsTypes> item : container) {
     98                        for (Pair<Object, TopicMapsTypes> item : container) {
    9999                                if(item.getSecond().equals(TopicMapsTypes.Topic)){
    100100                                        JsArray<Name> names = ((Topic)item.getFirst()).getNames();
     
    104104                } else if (newType.equals(TopicMapsTypes.Variant)){
    105105                        Variant variant = (Variant)pair.getFirst();
    106                         for (Pair<Construct, TopicMapsTypes> item : container) {
     106                        for (Pair<Object, TopicMapsTypes> item : container) {
    107107                                if(item.getSecond().equals(TopicMapsTypes.Name)){
    108108                                        JsArray<Variant> variants = ((Name)item.getFirst()).getVariants();
     
    111111                        }
    112112                       
    113                         for (Pair<Construct, TopicMapsTypes> item : container) {
     113                        for (Pair<Object, TopicMapsTypes> item : container) {
    114114                                if(item.getSecond().equals(TopicMapsTypes.Topic)){
    115115                                        JsArray<Name> names = ((Topic)item.getFirst()).getNames();
     
    122122                } else if (newType.equals(TopicMapsTypes.Occurrence)){
    123123                        Occurrence occurrence = (Occurrence)pair.getFirst();
    124                         for (Pair<Construct, TopicMapsTypes> item : container) {
     124                        for (Pair<Object, TopicMapsTypes> item : container) {
    125125                                if(item.getSecond().equals(TopicMapsTypes.Topic)){
    126126                                        JsArray<Occurrence> occurrences = ((Topic)item.getFirst()).getOccurrences();
     
    130130                } else if (newType.equals(TopicMapsTypes.Role)){
    131131                        Role role = (Role)pair.getFirst();
    132                         for (Pair<Construct, TopicMapsTypes> item : container) {
     132                        for (Pair<Object, TopicMapsTypes> item : container) {
    133133                                if(item.getSecond().equals(TopicMapsTypes.Association)){
    134134                                        JsArray<Role> roles = ((Association)item.getFirst()).getRoles();
     
    144144        @SuppressWarnings("unchecked")
    145145        @Override
    146         public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
    147                 ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
     146        public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
     147                ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
    148148               
    149149                Topic localCarrier = this.getRepresentedTopic();
     
    152152                        int i = 0;
    153153                        for( ; i != result.size(); ++i) if(result.get(i).getFirst().equals(localCarrier)) break;
    154                         if(i == result.size()) result.add(new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic));
     154                        if(i == result.size()) result.add(new Pair<Object, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic));
    155155                       
    156156                        if(ctrl instanceof GdlVisibleObject){
    157                                 for (Pair<Construct, TopicMapsTypes> pair : ((GdlVisibleObject)ctrl).getContent(localCarrier, validate)) {
     157                                for (Pair<Object, TopicMapsTypes> pair : ((GdlVisibleObject)ctrl).getContent(localCarrier, validate)) {
    158158                                        if((this.receivedData != null || (ctrl instanceof GdlView)) && !this.indirectlyContained(pair, result))result.add(pair);
    159159                                }
     
    178178                                if(i == occurrences.length()){
    179179                                        Occurrence occ = top.createOccurrence(occurrenceType, value, (JsArray<Topic>)JsArray.createArray());
    180                                         Pair<Construct, TopicMapsTypes> newItem = new Pair<Construct, TopicMapsTypes>(occ, TopicMapsTypes.Occurrence);
     180                                        Pair<Object, TopicMapsTypes> newItem = new Pair<Object, TopicMapsTypes>(occ, TopicMapsTypes.Occurrence);
    181181                                        if(!this.indirectlyContained(newItem, result)) result.add(newItem);
    182182                                }
Note: See TracChangeset for help on using the changeset viewer.