Ignore:
Timestamp:
02/04/15 16:14:11 (10 years ago)
Author:
dmay
Message:

Redo some XML parts that were hardcoded before. Also escape XML strings when necessary. This should be enough to make borg calendar replays work without manual intervention.

File:
1 edited

Legend:

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

    r1857 r1872  
    1515package de.ugoe.cs.autoquest.plugin.jfc.commands; 
    1616 
     17import org.apache.commons.lang.StringEscapeUtils; 
     18 
     19import java.awt.GraphicsDevice; 
     20import java.awt.GraphicsEnvironment; 
    1721import java.io.BufferedWriter; 
    1822import java.io.File; 
     
    343347 
    344348        int index = 1; 
    345         for( List<Event> sequence : sequences ) { 
    346             writeJacaretoXML(sequence, filename+"_"+index, classpath, basepath, classpathext); 
     349        for (List<Event> sequence : sequences) { 
     350            writeJacaretoXML(sequence, filename + "_" + index, classpath, basepath, classpathext); 
    347351            index++; 
    348352        } 
     
    420424            + "uuid=\"" + UUID.randomUUID() + "\" />" 
    421425        ); 
    422         writeLine(writer, 
    423                   "<SystemInfo procTime=\"0\" duration=\"0\" screenWidth=\"2646\" screenHeight=\"1024\" javaVersion=\"1.7.0_65\" " 
    424                   + "lookAndFeel=\"" + UIManager.getLookAndFeel().getClass().getName() + "\" " 
    425                   + "uuid=\"720f430f-52cf-4d8b-9fbe-58434f766efe\" />"); 
     426        GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); 
     427        writeLine(writer, "<SystemInfo " 
     428            + "procTime=\"0\" " 
     429            + "duration=\"0\" "  
     430            + "screenWidth=\"" + gd.getDisplayMode().getWidth() + "\" " 
     431            + "screenHeight=\"" + gd.getDisplayMode().getHeight() + "\" " 
     432            + "javaVersion=\"" + System.getProperty("java.version") + "\" " 
     433            + "lookAndFeel=\"" + UIManager.getLookAndFeel().getClass().getName() + "\" " 
     434            + "uuid=\"" + UUID.randomUUID() + "\" />" 
     435        ); 
    426436        writeLine(writer, 
    427437                  "<KeyboardState procTime=\"0\" duration=\"0\" isNumLockOn=\"false\" isScrollLockOn=\"false\" isCapsLockOn=\"false\" applyIsNumLockOn=\"true\" applyIsScrollLockOn=\"true\" applyIsCapsLockOn=\"true\" uuid=\"28146f79-9fc7-49f9-b4a8-5866a7625683\" />"); 
     
    516526            } 
    517527            else { 
    518                 Console.traceln(Level.WARNING, "No handler for event \"" + event + 
    519                     "\". Skipped."); 
     528                Console.traceln(Level.WARNING, "No handler for event \"" + event + "\". Skipped."); 
    520529            } 
    521530        } 
     
    823832            + "uuid=\"" + UUID.randomUUID() + "\" " 
    824833            + "ID=\"1001\" " 
    825             + "command=" + target.getName() + " " 
     834            + "command=" + StringEscapeUtils.escapeXml(target.getName()) + " " 
    826835            + "modifiers=\"" + getButtonModifier(info) + "\" />" 
    827836        ); 
Note: See TracChangeset for help on using the changeset viewer.