src/tokenclustering/model/AvailableTokens.java
/**
     * Refreshs the list of available tokens.
     */
Refreshs the list of available tokens.
Refreshs the list of available tokens .
public void refreshList() {
        File tokensFolder = new File(System.getProperty("user.dir") + File.separator + "tokens");
        this.tokens.clear();
        int width;
        int height;
        if (tokensFolder.exists()) {
            for (String widthPath : tokensFolder.list()) {
                try {
                    width = Integer.parseInt(widthPath);
                    File widthFolder = new File(System.getProperty("user.dir") + File.separator + "tokens" + File.separator + widthPath);
                    if (widthFolder.isDirectory()) {
                        for (String heightPath : widthFolder.list()) {
                            try {
                                height = Integer.parseInt(heightPath);
                                File heightFolder = new File(System.getProperty("user.dir") + File.separator + "tokens" + File.separator + widthPath + File.separator + heightPath);
                                if (heightFolder.isDirectory()) {
                                    for (String tokenFile : heightFolder.list()) {
                                        for (String supportedExt : Controller.SUPPORTED_EXTENSIONS) {
                                            String ext = tokenFile.substring(tokenFile.length() - supportedExt.length(), tokenFile.length()).toLowerCase();
                                            String tokenName = tokenFile.substring(0, tokenFile.length() - supportedExt.length() - 1);
                                            if (ext.equals(supportedExt)) {
                                                tokens.add(new Token(tokenName, ext, width, height));
                                            }
                                        }
                                    }
                                }
                            } catch (NumberFormatException e) {
                            }
                        }
                    }
                } catch (NumberFormatException e) {
                }
            }
        }
    }
public void refreshList ( ) { File tokensFolder = new File ( System . getProperty ( "user.dir" ) + File . separator + "tokens" ) ; this . tokens . clear ( ) ; int width ; int height ; if ( tokensFolder . exists ( ) ) { for ( String widthPath : tokensFolder . list ( ) ) { try { width = Integer . parseInt ( widthPath ) ; File widthFolder = new File ( System . getProperty ( "user.dir" ) + File . separator + "tokens" + File . separator + widthPath ) ; if ( widthFolder . isDirectory ( ) ) { for ( String heightPath : widthFolder . list ( ) ) { try { height = Integer . parseInt ( heightPath ) ; File heightFolder = new File ( System . getProperty ( "user.dir" ) + File . separator + "tokens" + File . separator + widthPath + File . separator + heightPath ) ; if ( heightFolder . isDirectory ( ) ) { for ( String tokenFile : heightFolder . list ( ) ) { for ( String supportedExt : Controller . SUPPORTED_EXTENSIONS ) { String ext = tokenFile . substring ( tokenFile . length ( ) - supportedExt . length ( ) , tokenFile . length ( ) ) . toLowerCase ( ) ; String tokenName = tokenFile . substring ( 0 , tokenFile . length ( ) - supportedExt . length ( ) - 1 ) ; if ( ext . equals ( supportedExt ) ) { tokens . add ( new Token ( tokenName , ext , width , height ) ) ; } } } } } catch ( NumberFormatException e ) { } } } } catch ( NumberFormatException e ) { } } } }
Refreshs the list of available tokens.
Refreshs the list of available tokens .