Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 153992 | Differences between
and this patch

Collapse All | Expand All

(-)com/panayotis/jubler/time/TimeFormatter.java (-13 lines)
Lines 58-73 Link Here
58
        return value.toString();
58
        return value.toString();
59
    }
59
    }
60
}
60
}
61
62
63
class TimeFormatterFactory extends JFormattedTextField.AbstractFormatterFactory {
64
    
65
    public JFormattedTextField.AbstractFormatter getFormatter(JFormattedTextField tf)  {
66
        try { 
67
            return new TimeFormatter();
68
        }
69
        catch ( ParseException e) {}
70
        return null;
71
    }
72
    
73
}
(-)com/panayotis/jubler/time/TimeFormatterFactory.java (-26 lines)
Lines 34-65 Link Here
34
 *
34
 *
35
 * @author teras
35
 * @author teras
36
 */
36
 */
37
public class TimeFormatter extends MaskFormatter {
38
    private static Pattern pat;
39
    
40
    static {
41
        pat = Pattern.compile("(\\d+):(\\d+):(\\d+),(\\d\\d\\d)\\d*");
42
    }
43
    
44
    public TimeFormatter () throws ParseException { 
45
        super("##:##:##,###");
46
    }
47
    
48
    public Object stringToValue(String text) throws ParseException {
49
        Matcher m = pat.matcher(text);
50
        if ( !m.matches()) {
51
            throw new ParseException("",0);
52
        }
53
        Time res = new Time(m.group(1), m.group(2), m.group(3), m.group(4));
54
        return res;
55
    }
56
        
57
    public String valueToString(Object value) {
58
        return value.toString();
59
    }
60
}
61
62
63
class TimeFormatterFactory extends JFormattedTextField.AbstractFormatterFactory {
37
class TimeFormatterFactory extends JFormattedTextField.AbstractFormatterFactory {
64
    
38
    
65
    public JFormattedTextField.AbstractFormatter getFormatter(JFormattedTextField tf)  {
39
    public JFormattedTextField.AbstractFormatter getFormatter(JFormattedTextField tf)  {

Return to bug 153992