Ignore:
Timestamp:
02/15/14 15:26:06 (10 years ago)
Author:
pharms
Message:
  • improved GUI element group naming
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/commands/CMDcondenseHTMLGUIModel.java

    r1354 r1387  
    1515package de.ugoe.cs.autoquest.plugin.html.commands; 
    1616 
     17import java.util.ArrayList; 
    1718import java.util.Arrays; 
    1819import java.util.Comparator; 
     
    512513         
    513514        if (cluster.clusteredGUIElements.size() > 0) { 
     515            List<List<String>> pathParts = new ArrayList<List<String>>(); 
     516             
    514517            for (SimilarGUIElement guiElement : cluster.clusteredGUIElements) { 
    515518                if (guiElement.mainClusterParent instanceof HTMLDocument) { 
    516                     name.append(((HTMLDocument) guiElement.mainClusterParent).getPath()); 
     519                    String path = ((HTMLDocument) guiElement.mainClusterParent).getPath(); 
     520                     
     521                    if (path.startsWith("/")) { 
     522                        path = path.substring(1); 
     523                    } 
     524                     
     525                    if (path.endsWith("/")) { 
     526                        path = path.substring(0, path.length() - 1); 
     527                    } 
     528                     
     529                    String[] pathElements = path.split("/"); 
     530                     
     531                    for (int i = 0; i < pathElements.length; i++) { 
     532                        if (pathParts.size() <= i) { 
     533                            pathParts.add(new LinkedList<String>()); 
     534                        } 
     535                        if (!pathParts.get(i).contains(pathElements[i])) { 
     536                            pathParts.get(i).add(pathElements[i]); 
     537                        } 
     538                    } 
    517539                } 
    518540                else { 
    519                     name.append(guiElement.mainClusterParent.getStringIdentifier()); 
     541                    if (pathParts.size() < 1) { 
     542                        pathParts.add(new LinkedList<String>()); 
     543                    } 
     544                    if (!pathParts.get(0).contains(guiElement.mainClusterParent.getStringIdentifier())) 
     545                    { 
     546                        pathParts.get(0).add(guiElement.mainClusterParent.getStringIdentifier()); 
     547                    } 
     548                } 
     549            } 
     550             
     551            for (List<String> pathPart : pathParts) { 
     552                name.append('/'); 
     553                if (pathPart.size() > 1) { 
     554                    name.append('['); 
     555                } 
     556                 
     557                int index = 0; 
     558                for (String elem : pathPart) { 
     559                    if (index++ > 0) { 
     560                        name.append('|'); 
     561                    } 
     562                    name.append(elem); 
     563                } 
     564                 
     565                if (pathPart.size() > 1) { 
     566                    name.append(']'); 
    520567                } 
    521568            } 
Note: See TracChangeset for help on using the changeset viewer.