SourceForge: j2cirip/j2cirip: changeset 2:cf9d0c3b02b4
6 iulie 2009
authorCostel Slincu <costel@xirincs.ro>
Mon Jul 06 16:48:52 2009 +0300 (4 months ago)
changeset 2cf9d0c3b02b4
parent 1109dc27ccd49
child 3872256e9ae08
6 iulie 2009
src/ro/xirincs/j2cirip/App.java
src/ro/xirincs/j2cirip/View.form
src/ro/xirincs/j2cirip/View.java
src/ro/xirincs/j2cirip/resources/Bundle_ro_ro.properties
     1.1 --- a/src/ro/xirincs/j2cirip/App.java	Mon Jul 06 16:25:29 2009 +0300
     1.2 +++ b/src/ro/xirincs/j2cirip/App.java	Mon Jul 06 16:48:52 2009 +0300
     1.3 @@ -100,21 +100,22 @@
     1.4                          UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
     1.5                          MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
     1.6  
     1.7 -                        //  an alternative way to set the Metal L&F
     1.8 -                        // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel";
     1.9 +                    //  an alternative way to set the Metal L&F
    1.10 +                    // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel";
    1.11                      }
    1.12                  } catch (Exception ex) {
    1.13                      Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex);
    1.14                  }
    1.15  
    1.16 -                //initializare si afisare MainPanel
    1.17 -                vw = new View(App.getApplication());
    1.18 -                show(vw);
    1.19 +            //initializare si afisare MainPanel
    1.20 +
    1.21  
    1.22              }
    1.23          };
    1.24          EventQueue.invokeLater(runner);
    1.25  
    1.26 +        vw = new View(App.getApplication());
    1.27 +        show(vw);
    1.28  
    1.29      }
    1.30  
     2.1 --- a/src/ro/xirincs/j2cirip/View.form	Mon Jul 06 16:25:29 2009 +0300
     2.2 +++ b/src/ro/xirincs/j2cirip/View.form	Mon Jul 06 16:48:52 2009 +0300
     2.3 @@ -13,7 +13,7 @@
     2.4            <Group type="103" groupAlignment="0" attributes="0">
     2.5                <Group type="102" alignment="0" attributes="0">
     2.6                    <EmptySpace max="-2" attributes="0"/>
     2.7 -                  <Component id="jSplitPaneMain" pref="604" max="32767" attributes="0"/>
     2.8 +                  <Component id="jSplitPaneMain" pref="600" max="32767" attributes="0"/>
     2.9                    <EmptySpace max="-2" attributes="0"/>
    2.10                </Group>
    2.11            </Group>
    2.12 @@ -376,7 +376,7 @@
    2.13                <Group type="102" alignment="0" attributes="0">
    2.14                    <EmptySpace max="-2" attributes="0"/>
    2.15                    <Component id="statusMessageLabel" min="-2" max="-2" attributes="0"/>
    2.16 -                  <EmptySpace pref="450" max="32767" attributes="0"/>
    2.17 +                  <EmptySpace pref="440" max="32767" attributes="0"/>
    2.18                    <Component id="progressBar" min="-2" max="-2" attributes="0"/>
    2.19                    <EmptySpace max="-2" attributes="0"/>
    2.20                    <Component id="statusAnimationLabel" min="-2" max="-2" attributes="0"/>
     3.1 --- a/src/ro/xirincs/j2cirip/View.java	Mon Jul 06 16:25:29 2009 +0300
     3.2 +++ b/src/ro/xirincs/j2cirip/View.java	Mon Jul 06 16:48:52 2009 +0300
     3.3 @@ -524,6 +524,7 @@
     3.4                      Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ex);
     3.5                  }
     3.6              } else if (linkUrl.toLowerCase().endsWith(".avi") ||
     3.7 +                    linkUrl.toLowerCase().endsWith(".flv") ||
     3.8                      linkUrl.toLowerCase().endsWith(".mpg") ||
     3.9                      linkUrl.toLowerCase().endsWith(".mpeg") ||
    3.10                      linkUrl.toLowerCase().endsWith(".mp4") ||
    3.11 @@ -658,6 +659,7 @@
    3.12          protected Void doInBackground() {
    3.13  
    3.14              try {
    3.15 +                jButtonSetStatus.setEnabled(false);
    3.16                  setMessage(bundle.getString("initializare"));
    3.17                  setProgress(0, 0, 3);
    3.18                  Thread.sleep(1000);
    3.19 @@ -689,102 +691,84 @@
    3.20                  //get public timeline
    3.21                  ds = new dataSort();
    3.22  
    3.23 -                try {
    3.24 -                    setMessage(bundle.getString("initializare"));
    3.25 -                    setProgress(0, 0, 3);
    3.26 -                    Thread.sleep(1000);
    3.27 +                setMessage(bundle.getString("initializare"));
    3.28 +                setProgress(0, 0, 3);
    3.29 +                Thread.sleep(1000);
    3.30  
    3.31 -                    setMessage(bundle.getString("stepGetPublicTimeline"));
    3.32 -                    dom = cip.getPublicTimeline();
    3.33 -                    setProgress(1, 0, 3);
    3.34 -                    Thread.sleep(1000);
    3.35 +                setMessage(bundle.getString("stepGetPublicTimeline"));
    3.36 +                dom = cip.getPublicTimeline();
    3.37 +                setProgress(1, 0, 3);
    3.38 +                Thread.sleep(1000);
    3.39  
    3.40 -                    setMessage(bundle.getString("stepParsing"));
    3.41 -                    docEle = dom.getDocumentElement();
    3.42 -                    nl = docEle.getElementsByTagName("status");
    3.43 -                    setProgress(2, 0, 3);
    3.44 -                    Thread.sleep(1000);
    3.45 +                setMessage(bundle.getString("stepParsing"));
    3.46 +                docEle = dom.getDocumentElement();
    3.47 +                nl = docEle.getElementsByTagName("status");
    3.48 +                setProgress(2, 0, 3);
    3.49 +                Thread.sleep(1000);
    3.50  
    3.51 -                    setMessage(bundle.getString("stepShow"));
    3.52 +                setMessage(bundle.getString("stepShow"));
    3.53  
    3.54 -                    if (nl != null && nl.getLength() > 0) {
    3.55 -                        for (int i = 0; i < nl.getLength(); i++) {
    3.56 +                if (nl != null && nl.getLength() > 0) {
    3.57 +                    for (int i = 0; i < nl.getLength(); i++) {
    3.58  
    3.59 -                            el = (Element) nl.item(i);
    3.60 +                        el = (Element) nl.item(i);
    3.61  
    3.62 -                            sdf = new SimpleDateFormat("EEE MMM d HH:mm:ss Z yyyy",
    3.63 -                                    Locale.ENGLISH);
    3.64 -                            data = sdf.parse(getTextValue(el, "created_at"));
    3.65 +                        sdf = new SimpleDateFormat("EEE MMM d HH:mm:ss Z yyyy",
    3.66 +                                Locale.ENGLISH);
    3.67 +                        data = sdf.parse(getTextValue(el, "created_at"));
    3.68  
    3.69 -                            if (props.getProperty("lang").contentEquals("ro_RO")) {
    3.70 -                                sdfLocal = new SimpleDateFormat("EEEE, d MMMM yyyy 'ora' HH:mm:ss",
    3.71 -                                        new Locale(System.getProperty("user.language")));
    3.72 -                            } else {
    3.73 -                                sdfLocal = new SimpleDateFormat("EEE, MMM d HH:mm:ss yyyy",
    3.74 -                                        new Locale(System.getProperty("user.language")));
    3.75 -                            }
    3.76 +                        if (props.getProperty("lang").contentEquals("ro_RO")) {
    3.77 +                            sdfLocal = new SimpleDateFormat("EEEE, d MMMM yyyy 'ora' HH:mm:ss",
    3.78 +                                    new Locale(System.getProperty("user.language")));
    3.79 +                        } else {
    3.80 +                            sdfLocal = new SimpleDateFormat("EEE, MMM d HH:mm:ss yyyy",
    3.81 +                                    new Locale(System.getProperty("user.language")));
    3.82 +                        }
    3.83  
    3.84 -                            diff = new Date().getTime() - data.getTime();
    3.85 +                        diff = new Date().getTime() - data.getTime();
    3.86  
    3.87 -                            if (props.getProperty("ciripUser") != null &&
    3.88 -                                    props.getProperty("ciripUser").trim().length() > 1 &&
    3.89 -                                    getTextValue(el, "text").toLowerCase().contains("@" +
    3.90 -                                    props.getProperty("ciripUser").toLowerCase())) {
    3.91 -                                bgColorMe = "#CCCCCC";
    3.92 -                            } else {
    3.93 -                                bgColorMe = "##FFFFFF";
    3.94 -                            }
    3.95 -                            textUrl = Pattern.compile("\\b(http://+)(\\S*)\\b").matcher(getTextValue(el, "text")).
    3.96 -                                    replaceAll("<a href=\"$1$2\">$2</a>");
    3.97 +                        if (props.getProperty("ciripUser") != null &&
    3.98 +                                props.getProperty("ciripUser").trim().length() > 1 &&
    3.99 +                                getTextValue(el, "text").toLowerCase().contains("@" +
   3.100 +                                props.getProperty("ciripUser").toLowerCase())) {
   3.101 +                            bgColorMe = "#CCCCCC";
   3.102 +                        } else {
   3.103 +                            bgColorMe = "##FFFFFF";
   3.104 +                        }
   3.105 +                        textUrl = Pattern.compile("\\b(http://+)(\\S*)\\b").matcher(getTextValue(el, "text")).
   3.106 +                                replaceAll("<a href=\"$1$2\">$2</a>");
   3.107  
   3.108 -                            strg = "<tr><td bgcolor=\"" + bgColorMe + "\"><a href=\"http://www.cirip.ro/u/" + getTextValue(el, "username") +
   3.109 -                                    "\"><img src=\"" + getTextValue(el, "profile_image_url") +
   3.110 -                                    "\" border=\"0\" alt=\"test\"></a></td>";
   3.111 +                        strg = "<tr><td bgcolor=\"" + bgColorMe + "\"><a href=\"http://www.cirip.ro/u/" + getTextValue(el, "username") +
   3.112 +                                "\"><img src=\"" + getTextValue(el, "profile_image_url") +
   3.113 +                                "\" border=\"0\" alt=\"test\"></a></td>";
   3.114  
   3.115 -                            strg += "<td bgcolor=\"" + bgColorMe + "\"><a href=\"http://replyto:@" + getTextValue(el, "username") +
   3.116 -                                    "\">" + getTextValue(el, "username") + "</a>:<br/>" + textUrl + "<br/>" +
   3.117 -                                    sdfLocal.format(data) + " (" + diff / (1000 * 60) +
   3.118 -                                    " " + bundle.getString("minAgo") + ")" +
   3.119 -                                    "<br/><br/></td></tr>";
   3.120 +                        strg += "<td bgcolor=\"" + bgColorMe + "\"><a href=\"http://replyto:@" + getTextValue(el, "username") +
   3.121 +                                "\">" + getTextValue(el, "username") + "</a>:<br/>" + textUrl + "<br/>" +
   3.122 +                                sdfLocal.format(data) + " (" + diff / (1000 * 60) +
   3.123 +                                " " + bundle.getString("minAgo") + ")" +
   3.124 +                                "<br/><br/></td></tr>";
   3.125  
   3.126 -                            ds.setInfo(data, new String(strg));
   3.127 +                        ds.setInfo(data, new String(strg));
   3.128  
   3.129 -                        }
   3.130 +                    }
   3.131 +                }
   3.132 +
   3.133 +                ///
   3.134 +                entries = ds.getInfo();
   3.135 +
   3.136 +                for (int i = 0; i < entries.size(); i++) {
   3.137 +
   3.138 +                    if (ultimaData == null || entries.get(i).getKey().after(ultimaData)) {
   3.139 +                        ultimaData = entries.get(i).getKey();
   3.140 +                        addElement(entries.get(i).getValue());
   3.141 +                        jEditorPanePublicTimeline.setCaretPosition(jEditorPanePublicTimeline.getDocument().getLength());
   3.142 +                        Thread.sleep(1000);
   3.143                      }
   3.144  
   3.145 -                    ///
   3.146 -                    entries = ds.getInfo();
   3.147 -
   3.148 -                    for (int i = 0; i < entries.size(); i++) {
   3.149 -
   3.150 -                        if (ultimaData == null || entries.get(i).getKey().after(ultimaData)) {
   3.151 -                            ultimaData = entries.get(i).getKey();
   3.152 -                            addElement(entries.get(i).getValue());
   3.153 -                            jEditorPanePublicTimeline.setCaretPosition(jEditorPanePublicTimeline.getDocument().getLength());
   3.154 -                            Thread.sleep(1000);
   3.155 -                        }
   3.156 -
   3.157 -                    }
   3.158 -
   3.159 -                    setProgress(3, 0, 3);
   3.160 -                    Thread.sleep(1000);
   3.161 -
   3.162 -                } catch (Exception ignore) {
   3.163 -                    addElement("<tr><td colspan=\"2\"><font color=\"red\">" +
   3.164 -                            bundle.getString("error") + "</font><br/></br></td></tr>");
   3.165 -                    jEditorPanePublicTimeline.setCaretPosition(jEditorPanePublicTimeline.getDocument().getLength());
   3.166 -
   3.167 -                    if (Boolean.parseBoolean(props.getProperty("showDebug"))) {
   3.168 -                        sw = new StringWriter();
   3.169 -                        ignore.printStackTrace(new PrintWriter(sw));
   3.170 -                        addElement("<tr><td colspan=\"2\"><font color=\"red\">" +
   3.171 -                                sw.toString() + "</font><br/></br></td></tr>");
   3.172 -
   3.173 -                        jEditorPanePublicTimeline.setCaretPosition(jEditorPanePublicTimeline.getDocument().getLength());
   3.174 -                    }
   3.175 -                    Logger.getLogger(View.class.getName()).log(Level.SEVERE, null, ignore);
   3.176                  }
   3.177  
   3.178 +                setProgress(3, 0, 3);
   3.179 +                Thread.sleep(1000);
   3.180  
   3.181                  ///
   3.182  
   3.183 @@ -809,6 +793,8 @@
   3.184          @Override
   3.185          protected void finished() {
   3.186              setMessage(bundle.getString("finished"));
   3.187 +            jTextAreaStatus.requestFocus();
   3.188 +            jButtonSetStatus.setEnabled(true);
   3.189          }
   3.190  
   3.191          @Override
     4.1 --- a/src/ro/xirincs/j2cirip/resources/Bundle_ro_ro.properties	Mon Jul 06 16:25:29 2009 +0300
     4.2 +++ b/src/ro/xirincs/j2cirip/resources/Bundle_ro_ro.properties	Mon Jul 06 16:48:52 2009 +0300
     4.3 @@ -40,7 +40,7 @@
     4.4  minAgo=min \u00EEn urm\u0103
     4.5  urlmessClickLink=Click pentru a deschide link-ul \u00EEn browsers
     4.6  urlmessClickReply=Click pentru a-i r\u0103spunde
     4.7 -urlmessClickMedia=Click pentru a asculta cu MPlayer
     4.8 +urlmessClickMedia=Click pentru a deschide cu MPlayer
     4.9  
    4.10  #AboutBox
    4.11  aboutTitle=Despre: j2Cirip 1.0 beta 1
    4.12 @@ -71,4 +71,4 @@
    4.13  jLabelRegisterUrl=http://www.cirip.ro/cirip/inregistrare?lg=ro
    4.14  
    4.15  openLinkMedia=Deschide cu MPlayer
    4.16 -openLinkBrowser=Deschide cu browser-ul default
    4.17 +openLinkBrowser=Deschide cu browser-ul default
    4.18 \ No newline at end of file