* desktopgui:
- Updating works in general config - Switched to Swingworker threads for improved responsiveness - version increase to 0.1.3
This commit is contained in:
@@ -179,6 +179,10 @@ distributions. See the source package for the additional license information.
|
|||||||
Atalk:
|
Atalk:
|
||||||
Public domain
|
Public domain
|
||||||
|
|
||||||
|
Desktopgui
|
||||||
|
Copyright (c) Mathias De Maré
|
||||||
|
See apps/desktopgui/LICENSE
|
||||||
|
|
||||||
SAM C Library:
|
SAM C Library:
|
||||||
Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>
|
Copyright (c) 2004, Matthew P. Cashdollar <mpc@innographx.com>
|
||||||
See apps/sam/c/doc/license.txt
|
See apps/sam/c/doc/license.txt
|
||||||
|
@@ -76,10 +76,12 @@
|
|||||||
<property name="build_dist" location="dist"/>
|
<property name="build_dist" location="dist"/>
|
||||||
<property name="build_lib" location="lib"/>
|
<property name="build_lib" location="lib"/>
|
||||||
<property name="build_i2pref" location="../../build"/>
|
<property name="build_i2pref" location="../../build"/>
|
||||||
|
<property name="build_routerconsole" location="../routerconsole/java/build/"/>
|
||||||
|
|
||||||
<path id="build_classpath">
|
<path id="build_classpath">
|
||||||
<fileset dir="${build_lib}" includes="**/*.jar"/>
|
<fileset dir="${build_lib}" includes="**/*.jar"/>
|
||||||
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
|
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
|
||||||
|
<fileset dir="${build_routerconsole}" includes="**/*.jar"/>
|
||||||
</path>
|
</path>
|
||||||
<target name="build_init">
|
<target name="build_init">
|
||||||
<!-- Create the time stamp -->
|
<!-- Create the time stamp -->
|
||||||
|
@@ -23,6 +23,7 @@ excludes=
|
|||||||
file.reference.appframework.jar=lib/appframework.jar
|
file.reference.appframework.jar=lib/appframework.jar
|
||||||
file.reference.i2p.jar=../../core/java/build/i2p.jar
|
file.reference.i2p.jar=../../core/java/build/i2p.jar
|
||||||
file.reference.router.jar=../../router/java/build/router.jar
|
file.reference.router.jar=../../router/java/build/router.jar
|
||||||
|
file.reference.routerconsole.jar=../routerconsole/java/build/routerconsole.jar
|
||||||
file.reference.swing-worker.jar=lib/swing-worker.jar
|
file.reference.swing-worker.jar=lib/swing-worker.jar
|
||||||
includes=**
|
includes=**
|
||||||
jar.compress=false
|
jar.compress=false
|
||||||
@@ -30,7 +31,8 @@ javac.classpath=\
|
|||||||
${file.reference.router.jar}:\
|
${file.reference.router.jar}:\
|
||||||
${file.reference.appframework.jar}:\
|
${file.reference.appframework.jar}:\
|
||||||
${file.reference.swing-worker.jar}:\
|
${file.reference.swing-worker.jar}:\
|
||||||
${file.reference.i2p.jar}
|
${file.reference.i2p.jar}:\
|
||||||
|
${file.reference.routerconsole.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
@@ -10,5 +10,5 @@ package net.i2p.desktopgui.desktopgui;
|
|||||||
* @author mathias
|
* @author mathias
|
||||||
*/
|
*/
|
||||||
public class GUIVersion {
|
public class GUIVersion {
|
||||||
public static final String VERSION = "0.0.1.2";
|
public static final String VERSION = "0.0.1.3";
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
<Form version="1.5" maxVersion="1.6" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||||
<NonVisualComponents>
|
<NonVisualComponents>
|
||||||
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
|
<Component class="javax.swing.ButtonGroup" name="updateButtonGroup">
|
||||||
</Component>
|
</Component>
|
||||||
</NonVisualComponents>
|
</NonVisualComponents>
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -371,7 +371,7 @@
|
|||||||
<Component class="javax.swing.JRadioButton" name="updateInform">
|
<Component class="javax.swing.JRadioButton" name="updateInform">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="buttonGroup1"/>
|
<ComponentRef name="updateButtonGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateInform.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateInform.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateInform" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateInform" noResource="true"/>
|
||||||
@@ -380,7 +380,7 @@
|
|||||||
<Component class="javax.swing.JRadioButton" name="updateDownload">
|
<Component class="javax.swing.JRadioButton" name="updateDownload">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="buttonGroup1"/>
|
<ComponentRef name="updateButtonGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateDownload.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateDownload.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateDownload" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateDownload" noResource="true"/>
|
||||||
@@ -389,7 +389,7 @@
|
|||||||
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
|
<Component class="javax.swing.JRadioButton" name="updateDownloadRestart">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
|
||||||
<ComponentRef name="buttonGroup1"/>
|
<ComponentRef name="updateButtonGroup"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateDownloadRestart.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateDownloadRestart.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateDownloadRestart" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateDownloadRestart" noResource="true"/>
|
||||||
@@ -400,18 +400,27 @@
|
|||||||
<Property name="text" type="java.lang.String" resourceKey="checkUpdates.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="checkUpdates.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="checkUpdates" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="checkUpdates" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="checkUpdatesActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="updateNow">
|
<Component class="javax.swing.JToggleButton" name="updateNow">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="updateNow.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="updateNow.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="updateNow" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="updateNow" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="updateNowActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JToggleButton" name="advancedUpdateConfig">
|
<Component class="javax.swing.JToggleButton" name="advancedUpdateConfig">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" resourceKey="advancedUpdateConfig.text"/>
|
<Property name="text" type="java.lang.String" resourceKey="advancedUpdateConfig.text"/>
|
||||||
<Property name="name" type="java.lang.String" value="advancedUpdateConfig" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="advancedUpdateConfig" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="advancedUpdateConfigActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
@@ -6,10 +6,23 @@
|
|||||||
|
|
||||||
package net.i2p.desktopgui.gui;
|
package net.i2p.desktopgui.gui;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import net.i2p.desktopgui.router.configuration.SpeedHelper;
|
import net.i2p.desktopgui.router.configuration.SpeedHelper;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.ButtonModel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
import net.i2p.desktopgui.router.RouterHelper;
|
||||||
import net.i2p.desktopgui.router.configuration.SpeedHandler;
|
import net.i2p.desktopgui.router.configuration.SpeedHandler;
|
||||||
|
import net.i2p.desktopgui.router.configuration.UpdateHelper;
|
||||||
|
import net.i2p.router.web.NewsFetcher;
|
||||||
|
import net.i2p.desktopgui.router.configuration.UpdateHandler;
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.swing.SwingWorker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -22,11 +35,14 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
initComponents();
|
initComponents();
|
||||||
extraInitComponents();
|
extraInitComponents();
|
||||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.requestFocus();
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void extraInitComponents() {
|
private void extraInitComponents() {
|
||||||
initSpeedTab();
|
initSpeedTab();
|
||||||
|
initUpdateTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initSpeedTab() {
|
private void initSpeedTab() {
|
||||||
@@ -34,8 +50,8 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
String inbound = SpeedHelper.getInboundBandwidth();
|
String inbound = SpeedHelper.getInboundBandwidth();
|
||||||
String outbound = SpeedHelper.getOutboundBandwidth();
|
String outbound = SpeedHelper.getOutboundBandwidth();
|
||||||
|
|
||||||
initSpeeds(inbound, outbound);
|
initSpeeds("" + Integer.parseInt(inbound)*8, "" + Integer.parseInt(outbound)*8);
|
||||||
initUsage("" + Integer.parseInt(inbound)/8, "" + Integer.parseInt(outbound)/8);
|
initUsage("" + Integer.parseInt(inbound), "" + Integer.parseInt(outbound));
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -45,6 +61,32 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initUpdateTab() {
|
||||||
|
//Set update policy
|
||||||
|
String updatePolicy = UpdateHelper.getUpdatePolicy();
|
||||||
|
if(updatePolicy.equals(UpdateHelper.NOTIFY_UPDATE_POLICY)) {
|
||||||
|
updateButtonGroup.setSelected(updateInform.getModel(), true);
|
||||||
|
}
|
||||||
|
else if(updatePolicy.equals(UpdateHelper.DOWNLOAD_UPDATE_POLICY)) {
|
||||||
|
updateButtonGroup.setSelected(updateDownload.getModel(), true);
|
||||||
|
}
|
||||||
|
else if(updatePolicy.equals(UpdateHelper.INSTALL_UPDATE_POLICY)) {
|
||||||
|
updateButtonGroup.setSelected(updateDownloadRestart.getModel(), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.out.println("desktopgui: no updates for you!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if an update is available
|
||||||
|
//TODO: move this method out of the routerconsole so desktopgui doesn't depend on routerconsole!!!
|
||||||
|
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
|
||||||
|
updateNow.setVisible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateNow.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
@@ -54,7 +96,7 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
buttonGroup1 = new javax.swing.ButtonGroup();
|
updateButtonGroup = new javax.swing.ButtonGroup();
|
||||||
applyPanel = new javax.swing.JPanel();
|
applyPanel = new javax.swing.JPanel();
|
||||||
cancel = new javax.swing.JToggleButton();
|
cancel = new javax.swing.JToggleButton();
|
||||||
ok = new javax.swing.JToggleButton();
|
ok = new javax.swing.JToggleButton();
|
||||||
@@ -240,26 +282,41 @@ public class GeneralConfiguration extends javax.swing.JFrame {
|
|||||||
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
|
updateMethod.setText(resourceMap.getString("updateMethod.text")); // NOI18N
|
||||||
updateMethod.setName("updateMethod"); // NOI18N
|
updateMethod.setName("updateMethod"); // NOI18N
|
||||||
|
|
||||||
buttonGroup1.add(updateInform);
|
updateButtonGroup.add(updateInform);
|
||||||
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
|
updateInform.setText(resourceMap.getString("updateInform.text")); // NOI18N
|
||||||
updateInform.setName("updateInform"); // NOI18N
|
updateInform.setName("updateInform"); // NOI18N
|
||||||
|
|
||||||
buttonGroup1.add(updateDownload);
|
updateButtonGroup.add(updateDownload);
|
||||||
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
|
updateDownload.setText(resourceMap.getString("updateDownload.text")); // NOI18N
|
||||||
updateDownload.setName("updateDownload"); // NOI18N
|
updateDownload.setName("updateDownload"); // NOI18N
|
||||||
|
|
||||||
buttonGroup1.add(updateDownloadRestart);
|
updateButtonGroup.add(updateDownloadRestart);
|
||||||
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
|
updateDownloadRestart.setText(resourceMap.getString("updateDownloadRestart.text")); // NOI18N
|
||||||
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
|
updateDownloadRestart.setName("updateDownloadRestart"); // NOI18N
|
||||||
|
|
||||||
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
|
checkUpdates.setText(resourceMap.getString("checkUpdates.text")); // NOI18N
|
||||||
checkUpdates.setName("checkUpdates"); // NOI18N
|
checkUpdates.setName("checkUpdates"); // NOI18N
|
||||||
|
checkUpdates.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
checkUpdatesActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
|
updateNow.setText(resourceMap.getString("updateNow.text")); // NOI18N
|
||||||
updateNow.setName("updateNow"); // NOI18N
|
updateNow.setName("updateNow"); // NOI18N
|
||||||
|
updateNow.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
updateNowActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
|
advancedUpdateConfig.setText(resourceMap.getString("advancedUpdateConfig.text")); // NOI18N
|
||||||
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
|
advancedUpdateConfig.setName("advancedUpdateConfig"); // NOI18N
|
||||||
|
advancedUpdateConfig.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
advancedUpdateConfigActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
|
javax.swing.GroupLayout updatesPanelLayout = new javax.swing.GroupLayout(updatesPanel);
|
||||||
updatesPanel.setLayout(updatesPanelLayout);
|
updatesPanel.setLayout(updatesPanelLayout);
|
||||||
@@ -468,9 +525,65 @@ private void cancelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:even
|
|||||||
|
|
||||||
private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okMouseClicked
|
private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_okMouseClicked
|
||||||
saveSpeeds();
|
saveSpeeds();
|
||||||
|
saveUpdatePolicy();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}//GEN-LAST:event_okMouseClicked
|
}//GEN-LAST:event_okMouseClicked
|
||||||
|
|
||||||
|
private void checkUpdatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkUpdatesActionPerformed
|
||||||
|
long current = new Date().getTime();
|
||||||
|
if(current < newsLastFetched + 5*60*1000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
checkUpdates.setText("Checking for updates");
|
||||||
|
checkUpdates.setEnabled(false);
|
||||||
|
newsLastFetched = current;
|
||||||
|
SwingWorker sw = new SwingWorker() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object doInBackground() throws Exception {
|
||||||
|
NewsFetcher.getInstance(RouterHelper.getContext()).fetchNews();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
checkUpdates.setText("Check for updates now");
|
||||||
|
checkUpdates.setEnabled(true);
|
||||||
|
if(NewsFetcher.getInstance(RouterHelper.getContext()).updateAvailable()) {
|
||||||
|
updateNow.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}//GEN-LAST:event_checkUpdatesActionPerformed
|
||||||
|
|
||||||
|
private void updateNowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateNowActionPerformed
|
||||||
|
SwingWorker sw = new SwingWorker() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object doInBackground() throws Exception {
|
||||||
|
new net.i2p.router.web.UpdateHandler().update();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
updateNow.setEnabled(false);
|
||||||
|
updateNow.setText("Updating...");
|
||||||
|
checkUpdates.setEnabled(false);
|
||||||
|
|
||||||
|
}//GEN-LAST:event_updateNowActionPerformed
|
||||||
|
|
||||||
|
private void advancedUpdateConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_advancedUpdateConfigActionPerformed
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI("http://127.0.0.1:7657/configupdate.jsp"));
|
||||||
|
} catch (URISyntaxException ex) {
|
||||||
|
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
catch (IOException ex) {
|
||||||
|
Logger.getLogger(GeneralConfiguration.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_advancedUpdateConfigActionPerformed
|
||||||
|
|
||||||
protected void initUsage(String upload, String download) {
|
protected void initUsage(String upload, String download) {
|
||||||
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
|
uploadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)));
|
||||||
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
|
downloadgb.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)));
|
||||||
@@ -513,11 +626,23 @@ private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ok
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void saveUpdatePolicy() {
|
||||||
|
ButtonModel policyButton = updateButtonGroup.getSelection();
|
||||||
|
if(policyButton.equals(updateInform.getModel())) {
|
||||||
|
UpdateHandler.setUpdatePolicy(UpdateHelper.NOTIFY_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
else if(policyButton.equals(updateDownload.getModel())) {
|
||||||
|
UpdateHandler.setUpdatePolicy(UpdateHelper.DOWNLOAD_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
else if(policyButton.equals(updateDownloadRestart.getModel())) {
|
||||||
|
UpdateHandler.setUpdatePolicy(UpdateHelper.INSTALL_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JPanel advancedPanel;
|
private javax.swing.JPanel advancedPanel;
|
||||||
private javax.swing.JToggleButton advancedUpdateConfig;
|
private javax.swing.JToggleButton advancedUpdateConfig;
|
||||||
private javax.swing.JPanel applyPanel;
|
private javax.swing.JPanel applyPanel;
|
||||||
private javax.swing.ButtonGroup buttonGroup1;
|
|
||||||
private javax.swing.JToggleButton cancel;
|
private javax.swing.JToggleButton cancel;
|
||||||
private javax.swing.JToggleButton checkUpdates;
|
private javax.swing.JToggleButton checkUpdates;
|
||||||
private javax.swing.JScrollPane clientFrame;
|
private javax.swing.JScrollPane clientFrame;
|
||||||
@@ -537,6 +662,7 @@ private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ok
|
|||||||
private javax.swing.JPanel speedPanel;
|
private javax.swing.JPanel speedPanel;
|
||||||
private javax.swing.JPanel tunnelPanel;
|
private javax.swing.JPanel tunnelPanel;
|
||||||
private javax.swing.JLabel tunnelsExplanation;
|
private javax.swing.JLabel tunnelsExplanation;
|
||||||
|
private javax.swing.ButtonGroup updateButtonGroup;
|
||||||
private javax.swing.JRadioButton updateDownload;
|
private javax.swing.JRadioButton updateDownload;
|
||||||
private javax.swing.JRadioButton updateDownloadRestart;
|
private javax.swing.JRadioButton updateDownloadRestart;
|
||||||
private javax.swing.JRadioButton updateInform;
|
private javax.swing.JRadioButton updateInform;
|
||||||
@@ -553,4 +679,6 @@ private void okMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ok
|
|||||||
|
|
||||||
public static final int KILOBIT = 0;
|
public static final int KILOBIT = 0;
|
||||||
public static final int KILOBYTE = 1;
|
public static final int KILOBYTE = 1;
|
||||||
|
|
||||||
|
private long newsLastFetched = 0;
|
||||||
}
|
}
|
||||||
|
@@ -151,7 +151,7 @@ public class Tray {
|
|||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
RouterHandler.setStatus(RouterHandler.SHUTDOWN_GRACEFULLY);
|
RouterHandler.setStatus(RouterHandler.SHUTDOWN_GRACEFULLY);
|
||||||
long shutdownTime = RouterHelper.getGracefulShutdownTimeRemaining();
|
long shutdownTime = RouterHelper.getGracefulShutdownTimeRemaining();
|
||||||
System.out.println(shutdownTime);
|
System.out.println("Shutdowntime remaining: " + shutdownTime);
|
||||||
if(shutdownTime>0) {
|
if(shutdownTime>0) {
|
||||||
trayIcon.displayMessage("Shutting down...", "Shutdown time remaining: " + shutdownTime/1000 + " seconds."
|
trayIcon.displayMessage("Shutting down...", "Shutdown time remaining: " + shutdownTime/1000 + " seconds."
|
||||||
+ System.getProperty("line.separator") + "Shutdown will not happen immediately, because we are still participating in the network.", TrayIcon.MessageType.INFO);
|
+ System.getProperty("line.separator") + "Shutdown will not happen immediately, because we are still participating in the network.", TrayIcon.MessageType.INFO);
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.i2p.desktopgui.router.configuration;
|
||||||
|
|
||||||
|
import net.i2p.desktopgui.router.RouterHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author mathias
|
||||||
|
*/
|
||||||
|
public class UpdateHandler {
|
||||||
|
public static void setUpdatePolicy(String policy) {
|
||||||
|
RouterHelper.getContext().router().setConfigSetting(UpdateHelper.PROP_UPDATE_POLICY, policy);
|
||||||
|
RouterHelper.getContext().router().saveConfig();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,66 @@
|
|||||||
|
package net.i2p.desktopgui.router.configuration;
|
||||||
|
|
||||||
|
import net.i2p.desktopgui.router.RouterHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author mathias
|
||||||
|
*/
|
||||||
|
public class UpdateHelper {
|
||||||
|
|
||||||
|
public static final String PROP_NEWS_URL = "router.newsURL";
|
||||||
|
public static final String DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
|
||||||
|
|
||||||
|
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
|
||||||
|
public static final String DEFAULT_REFRESH_FREQUENCY = 24*60*60*1000 + "";
|
||||||
|
|
||||||
|
public static final String PROP_UPDATE_POLICY = "router.updatePolicy";
|
||||||
|
public static final String NOTIFY_UPDATE_POLICY = "notify";
|
||||||
|
public static final String DOWNLOAD_UPDATE_POLICY = "download";
|
||||||
|
public static final String INSTALL_UPDATE_POLICY = "install";
|
||||||
|
public static final String DEFAULT_UPDATE_POLICY = DOWNLOAD_UPDATE_POLICY;
|
||||||
|
|
||||||
|
public static final String PROP_SHOULD_PROXY = "router.updateThroughProxy";
|
||||||
|
public static final String DEFAULT_SHOULD_PROXY = Boolean.TRUE.toString();
|
||||||
|
public static final String PROP_PROXY_HOST = "router.updateProxyHost";
|
||||||
|
public static final String DEFAULT_PROXY_HOST = "127.0.0.1";
|
||||||
|
public static final String PROP_PROXY_PORT = "router.updateProxyPort";
|
||||||
|
public static final String DEFAULT_PROXY_PORT = "4444";
|
||||||
|
|
||||||
|
public static final String PROP_UPDATE_URL = "router.updateURL";
|
||||||
|
public static final String DEFAULT_UPDATE_URL =
|
||||||
|
"http://echelon.i2p/i2p/i2pupdate.sud\r\n" +
|
||||||
|
"http://stats.i2p/i2p/i2pupdate.sud\r\n" +
|
||||||
|
"http://complication.i2p/i2p/i2pupdate.sud\r\n" +
|
||||||
|
"http://www.i2p2.i2p/_static/i2pupdate.sud\r\n" +
|
||||||
|
"http://update.postman.i2p/i2pupdate.sud" ;
|
||||||
|
|
||||||
|
public static final String PROP_TRUSTED_KEYS = "router.trustedUpdateKeys";
|
||||||
|
|
||||||
|
public static String getNewsURL() {
|
||||||
|
String url = RouterHelper.getContext().getProperty(PROP_NEWS_URL);
|
||||||
|
if(url == null) {
|
||||||
|
return DEFAULT_NEWS_URL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getUpdatePolicy() {
|
||||||
|
String policy = null;
|
||||||
|
try {
|
||||||
|
policy = RouterHelper.getContext().getProperty(PROP_UPDATE_POLICY);
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("Policy: " + policy);
|
||||||
|
if(policy == null) {
|
||||||
|
return DEFAULT_UPDATE_POLICY;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return policy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -524,7 +524,7 @@
|
|||||||
</exec>
|
</exec>
|
||||||
<echo message="Findbugs output stored in findbugs.xml" />
|
<echo message="Findbugs output stored in findbugs.xml" />
|
||||||
</target>
|
</target>
|
||||||
<target name="buildWithDesktopgui" depends="buildrouter">
|
<target name="buildWithDesktopgui" depends="buildrouter,builddepSmall">
|
||||||
<ant dir="apps/desktopgui" target="build_jar" />
|
<ant dir="apps/desktopgui" target="build_jar" />
|
||||||
</target>
|
</target>
|
||||||
<target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
|
<target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
2009-05-22 Mathiasdm
|
||||||
|
* desktopgui:
|
||||||
|
- Updating works in general config
|
||||||
|
- Switched to Swingworker threads for improved responsiveness
|
||||||
|
|
||||||
2009-05-21 zzz
|
2009-05-21 zzz
|
||||||
* Router Watchdog:
|
* Router Watchdog:
|
||||||
- Log memory stats
|
- Log memory stats
|
||||||
|
Reference in New Issue
Block a user