Author: jerome
Date: 2008-09-22 10:22:08 +0200 (Mon, 22 Sep 2008)
New Revision: 1944
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/WebBrowser/webBrowser.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/TuxLanguagesMenu.java
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/JBrowser.java
Log:
* First junk of web browser working under linux ( removed embeded JDIC ).
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2008-09-22 07:33:41 UTC (rev 1943)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/CcInterface.java
2008-09-22 08:22:08 UTC (rev 1944)
@@ -112,6 +112,7 @@
import com.tuxdroid.cc.Utils.languages.Languages;
import com.tuxdroid.cc.swing.About;
import com.tuxdroid.cc.swing.EventDispatcher;
+import com.tuxdroid.cc.swing.JBrowser;
import com.tuxdroid.cc.swing.TuxDegradeePanel;
import com.tuxdroid.cc.swing.TuxDegradeePanelWithInset;
import com.tuxdroid.cc.swing.TuxDegradeeScrollPane;
@@ -143,7 +144,8 @@
private JPanel menuPanel = null;
private JPanel jLeftPanel = null;
private JPanel jContentPane = null;
- protected JPanel pBrowser = new JPanel();
+
+ public webBrowser pBrowser = null;
/** CcInterface buttons **/
private JButton fileMenu = null;
@@ -223,7 +225,6 @@
private JLabel jLabelLibrary = null;
/** CcInterface subclasses components **/
- public webBrowser pWebBrowser = null;
public FileBrowser file_browser = null;
public JScrollPane scroll_fileBrowser_gadgets = null;
public JScrollPane scroll_fileBrowser_attitunes = null;
@@ -1577,9 +1578,8 @@
this.getTrash().setVisible(true);
this.getLeftPanel().setSize(this.getLeftPanel().getWidth(),
this.leftSize);
- if(pWebBrowser != null){
- pWebBrowser.setVisible(false);
- //jContentPane.remove(pWebBrowser);
+ if(pBrowser != null){
+ pBrowser.setVisible(false);
}
if (index == 0){
@@ -1662,39 +1662,40 @@
scroll_fileBrowser_thumbnailGadgets.setVisible(false);
scroll_fileBrowser_thumbnailAttitunes.setVisible(false);
jTabbedPane.setEnabled(false);
-
-
- Dimension dim = scroll_fileBrowser_gadgets.getSize();
- webBrowser browser = new webBrowser(new Dimension(
- dim.width, dim.height +
jTabbedPane.getHeight()));
- browser.setSize(dim.width, dim.height +
jTabbedPane.getHeight());
- browser.setPreferredSize(browser.getSize());
-
browser.setLocation(scroll_fileBrowser_gadgets.getLocation());
-
- //Register browser.
- pBrowser = browser;
- pWebBrowser = browser;
- jContentPane.add(browser);
- jFrame.pack();
- jFrame.repaint();
+
+ if(pBrowser == null){ // then create web browser.
+ Dimension dim =
scroll_fileBrowser_gadgets.getSize();
+ pBrowser = new webBrowser(new Dimension(
+ dim.width , dim.height +
jTabbedPane.getHeight()));
+
+
pBrowser.setLocation(scroll_fileBrowser_gadgets.getLocation());
+
+ jContentPane.add(pBrowser);
+ jFrame.pack();
+ }
+
this.setControlsConsistanceEnabled(false);
if(index == 0){
- pWebBrowser.setGadgetsUrl();
+ pBrowser.setGadgetsUrl();
}
else if(index == 1){
- pWebBrowser.setAttitunesUrl();
- }
+ pBrowser.setAttitunesUrl();
+ }
+
+ pBrowser.setVisible(true);
}
if(index == 2){
//resize.
- if (pWebBrowser instanceof webBrowser){
+ if (pBrowser instanceof webBrowser){
Dimension dim =
scroll_fileBrowser_gadgets.getSize();
- pWebBrowser.setSize(dim.width, dim.height +
jTabbedPane.getHeight());
+ pBrowser.setSize(dim.width, dim.height +
jTabbedPane.getHeight());
this.setControlsConsistanceEnabled(true);
}
- }
+ }
+
+ System.out.println(pBrowser.getSize());
}
@@ -1735,7 +1736,8 @@
this.scroll_fileBrowser_attitunes.setVisible(false);
this.scroll_fileBrowser_gadgets.setVisible(false);
this.scroll_fileBrowser_thumbnailAttitunes.setVisible(false);
- this.scroll_fileBrowser_thumbnailGadgets.setVisible(false);
+ this.scroll_fileBrowser_thumbnailGadgets.setVisible(false);
+ this.pBrowser.setVisible(false);
this.jListLibrary.clearSelection();
if(index == 1){
@@ -1999,7 +2001,8 @@
jStatusBar.setLocation(new Point(-1, 473));
jStatusBar.setBackground(new Color(217, 217, 217));
jStatusBar.add(getHideButton(), null);
- tuxstatusLabel = new JLabel("Tux Status: ");
+ tuxstatusLabel = new JLabel("Tux Status: ");
+ tuxstatusLabel.setFont(new Font(CcInterface.fontName,
Font.PLAIN, 11));
// Create label how contain tux status icons.
status = new JLabel("");
@@ -2643,12 +2646,14 @@
}
else
if(arg0.getPropertyName().equalsIgnoreCase("attitune-double-click")){
- playButton.setIcon(new ImageIcon(
-
getClass().getResource("images/buttons/stop_down.png")));
- this.setFrameworkBusy(true);
+
+ //playButton.setIcon(new ImageIcon(
+
//getClass().getResource("images/buttons/stop_down.png")));
+ //this.setFrameworkBusy(true);
playflag = !playflag;
+ System.out.println("attitune double click");
setPlayerControlsConsistants(false);
- file_browser.playAttitune(view);
+ //file_browser.playAttitune(view);
}
else
if(arg0.getPropertyName().equalsIgnoreCase("instances-editions-request")){
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
2008-09-22 07:33:41 UTC (rev 1943)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/PseudoFileBrowser/FileBrowser.java
2008-09-22 08:22:08 UTC (rev 1944)
@@ -274,6 +274,7 @@
}
else
if(arg0.getPropertyName().equalsIgnoreCase("attitune-double-click")){
+ System.out.println("attitune double click from
file browser");
changes.firePropertyChange("attitune-double-click", null, null);
}
}
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
2008-09-22 07:33:41 UTC (rev 1943)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/View/TuxAttitunesListView.java
2008-09-22 08:22:08 UTC (rev 1944)
@@ -41,6 +41,7 @@
import java.io.IOException;
import java.net.URL;
import java.util.Iterator;
+import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.DefaultListSelectionModel;
@@ -179,6 +180,7 @@
public void
mouseClicked(java.awt.event.MouseEvent event){
if (
SwingUtilities.isLeftMouseButton(event) ) {
if(event.getClickCount() == 2){
+ System.out.println("double
click");
changes.firePropertyChange("attitune-double-click", null, null);
}
}
@@ -264,9 +266,8 @@
if (tux.radio.getConnected())
{
//Verifying if language
is installed.
-
if(!TuxLanguagesMenu.isInstalledLocutorLanguage(lang
- ,
tux.tts.getVoices())){
+ ,
(List<String>)tux.tts.getVoices())){
String message
= language.attituneinvalidTTS();
if(this.showErrorMessages)
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/WebBrowser/webBrowser.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/WebBrowser/webBrowser.java
2008-09-22 07:33:41 UTC (rev 1943)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Object/WebBrowser/webBrowser.java
2008-09-22 08:22:08 UTC (rev 1944)
@@ -25,22 +25,16 @@
import java.awt.Dimension;
import java.net.MalformedURLException;
import java.net.URL;
-
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
import com.tuxdroid.cc.swing.JBrowser;
public class webBrowser extends JBrowser{
private static final long serialVersionUID = -5653711323285928544L;
- public JPanel toolBar = null;
- public JScrollPane scrollpane = null;
public webBrowser(Dimension dim){
- super("http://livewithapenguin.com/attitunes/Attitunes.htm");
- setSize(new Dimension(500, 500));
+ super("http://www.google.be", dim);
}
public void setUrl(URL url){
@@ -50,7 +44,7 @@
public void setGadgetsUrl(){
try {
- this.goTo(new
URL("http://www.livewithapenguin.com/Gadgets.htm"));
+ this.goTo(new URL("http://www.google.be"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
@@ -61,7 +55,7 @@
//"http://www.tuxisalive.com/downloads/attitunes"
//"http://www.livewithapenguin.com/Attitunes.htm"
try {
- this.goTo(new
URL("http://livewithapenguin.com/attitunes/Attitunes.htm"));
+ this.goTo(new URL("http://www.google.fr"));
} catch (MalformedURLException e) {
e.printStackTrace();
}
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/TuxLanguagesMenu.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/TuxLanguagesMenu.java
2008-09-22 07:33:41 UTC (rev 1943)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/Utils/TuxLanguagesMenu.java
2008-09-22 08:22:08 UTC (rev 1944)
@@ -278,25 +278,28 @@
public static boolean isInstalledLocutorLanguage(String language,
List<String> voices){
- //System.out.println(language);
- //System.out.println(voices);
+ TuxLanguagesMenu.prepareLocutors();
String us = "US English";
String fr = "French";
String bdutch = "Be Dutch";
if(language.equalsIgnoreCase(us)){
for(String str : voices){
+ str = str.replace("8k", "");
if(str.equalsIgnoreCase(locutors.get("en").get("male"))) return true;
+
else
if(str.equalsIgnoreCase(locutors.get("en").get("female"))) return true;
}
}
else if(language.equalsIgnoreCase(fr)){
for(String str : voices){
+ str = str.replace("8k", "");
if(str.equalsIgnoreCase(locutors.get("fr").get("male"))) return true;
else
if(str.equalsIgnoreCase(locutors.get("fr").get("female"))) return true;
}
}
else if(language.equalsIgnoreCase(bdutch)){
for(String str : voices){
+ str = str.replace("8k", "");
if(str.equalsIgnoreCase(locutors.get("nl").get("male"))) return true;
else
if(str.equalsIgnoreCase(locutors.get("nl").get("female"))) return true;
}
Modified:
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/JBrowser.java
===================================================================
---
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/JBrowser.java
2008-09-22 07:33:41 UTC (rev 1943)
+++
software_suite_v2/software/control_center/trunk/control_center/sources/com/tuxdroid/cc/swing/JBrowser.java
2008-09-22 08:22:08 UTC (rev 1944)
@@ -33,20 +33,18 @@
import java.net.*;
import java.io.*;
-/** Very simplistic "Web browser" using Swing. Supply a URL on the
- * command line to see it initially, and to set the destination
- * of the "home" button.
- * 1998 Marty Hall, http://www.apl.jhu.edu/~hall/java/
- */
-public class JBrowser extends JPanel implements HyperlinkListener{
+public class JBrowser extends JScrollPane implements HyperlinkListener{
+
+ //private static final long serialVersionUID = 1L;
private JEditorPane htmlPane;
private String initialURL;
private JScrollPane scrollPane;
- public JBrowser(String initialURL) {
- this.initialURL = initialURL;
+ public JBrowser(String initialURL, Dimension dim) {
+ super();
+ this.initialURL = initialURL;
try {
htmlPane = new JEditorPane(initialURL);
@@ -54,25 +52,19 @@
htmlPane.setDragEnabled(true);
htmlPane.addHyperlinkListener(this);
- scrollPane = new JScrollPane(htmlPane);
- scrollPane.getVerticalScrollBar().setUI(new
MyScrollBarUI(MyScrollBarUI.VERTICAL));
- scrollPane.getHorizontalScrollBar().setUI(new
MyScrollBarUI(MyScrollBarUI.HORIZONTAL));
- add(scrollPane, BorderLayout.CENTER);
+ this.setViewportView(htmlPane);
+ getVerticalScrollBar().setUI(new
MyScrollBarUI(MyScrollBarUI.VERTICAL));
+ getHorizontalScrollBar().setUI(new
MyScrollBarUI(MyScrollBarUI.HORIZONTAL));
+ setSize(dim);
+ setPreferredSize(getSize());
+
} catch(IOException e) {
e.printStackTrace();
}
- Dimension screenSize = getToolkit().getScreenSize();
- int width = screenSize.width * 8 / 10;
- int height = screenSize.height * 8 / 10;
- setBounds(width/8, height/8, width, height);
}
-
- public void setSize(Dimension dim){
- this.scrollPane.setSize(dim);
- }
public void hyperlinkUpdate(HyperlinkEvent event) {
@@ -84,7 +76,6 @@
else{
//Then downloading.
download(event.getURL());
- System.out.println("is downloadable");
}
} catch(IOException e) {
@@ -100,9 +91,10 @@
private void download(URL url){
-
+ System.out.println("downloading application");
}
+
public void goTo(URL url) {
try {
htmlPane.setPage(url);
@@ -110,15 +102,4 @@
e.printStackTrace();
}
}
-
-
- public static void main(String[] args) {
- JFrame frame = new JFrame("test");
- frame.setSize(new Dimension(500, 500));
- frame.setPreferredSize(frame.getSize());
- frame.add(new
JBrowser("http://livewithapenguin.com/attitunes/Attitunes.htm"));
- frame.setVisible(true);
- frame.pack();
- }
-
}
\ No newline at end of file
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn