|
From: Gerry D. <gd...@us...> - 2002-06-11 18:27:01
|
Update of /cvsroot/swapdv/swapdv
In directory usw-pr-cvs1:/tmp/cvs-serv3068
Modified Files:
SwapDV.form SwapDV.java Util.java
Log Message:
Replaced deprecated calls, added Util.ReadLine and modified position and sizing for first time Frame displays
Index: SwapDV.form
===================================================================
RCS file: /cvsroot/swapdv/swapdv/SwapDV.form,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- SwapDV.form 11 Jun 2002 15:50:04 -0000 1.24
+++ SwapDV.form 11 Jun 2002 18:26:57 -0000 1.25
@@ -321,7 +321,7 @@
</MenuItem>
<MenuItem class="javax.swing.JCheckBoxMenuItem" name="jCheckBoxAutoStart">
<Properties>
- <Property name="label" type="java.lang.String" value="Restart server on startup"/>
+ <Property name="text" type="java.lang.String" value="Restart server on startup "/>
</Properties>
<Events>
Index: SwapDV.java
===================================================================
RCS file: /cvsroot/swapdv/swapdv/SwapDV.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- SwapDV.java 11 Jun 2002 15:50:04 -0000 1.59
+++ SwapDV.java 11 Jun 2002 18:26:57 -0000 1.60
@@ -33,6 +33,7 @@
import java.util.*;
import java.io.*;
import java.net.*;
+import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.tree.*;
@@ -181,12 +182,6 @@
jMenuItemSearch.setIcon(iconSearch16);
jMenuItemSearch.setEnabled(jtellaConfig.enabled);
- setLocation(posX, posY);
-
- if (width > 100 && height > 100) {
- setSize(width, height);
- jSplitPaneContentGuide.setDividerLocation(dividerPos);
- }
jCheckBoxAutoSave.setSelected(autoSave);
jCheckBoxAutoStart.setSelected(autoRestart);
@@ -214,6 +209,31 @@
jtella = new JtellaServer(guide, details, jtellaConfig);
**/
+ // Pack this frame
+ this.pack();
+
+ // Restore size, if any
+ if ((width != -1) && (height != -1)) {
+ setSize(width, height);
+ jSplitPaneContentGuide.setDividerLocation(dividerPos);
+ } else {
+ Dimension theFrame = this.getSize();
+ if (theFrame.width < 600) theFrame.width = 600;
+ this.setSize(theFrame);
+ }
+
+ // Restore coords for it
+ if ((posX != -1) && (posY != -1)) {
+ setLocation(posX, posY);
+ } else {
+ Dimension theScreen = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension theFrame = this.getSize();
+
+ theFrame.width = (theScreen.width - theFrame.width) / 2;
+ theFrame.height = (theScreen.height - theFrame.height) / 2;
+ this.setLocation(theFrame.width, theFrame.height);
+ }
+
// Kick over the scheduler and execute any startup events
swapdv.Scheduler.actions.actionUtils.setLocalGuide(guide);
swapdv.Scheduler.actions.actionUtils.setDeviceMenu(jMenuLocal);
@@ -442,10 +462,10 @@
// Restore UI information
pStoreNodeI uiPrefs = pStore.getDomain("swapdv_ui");
dividerPos = uiPrefs.getIntAttribute("dividerPos", dividerPos);
- posX = uiPrefs.getIntAttribute("posX", posX);
- posY = uiPrefs.getIntAttribute("posY", posY);
- height = uiPrefs.getIntAttribute("height", height);
- width = uiPrefs.getIntAttribute("width", width);
+ posX = uiPrefs.getIntAttribute("posX", -1);
+ posY = uiPrefs.getIntAttribute("posY", -1);
+ height = uiPrefs.getIntAttribute("height", -1);
+ width = uiPrefs.getIntAttribute("width", -1);
int width = 0;
pStoreNodeI columnPrefs = uiPrefs.getChild("columnLayout");
@@ -1230,7 +1250,7 @@
});
jMenuLibraryServer.add(jMenuItemStart);
- jCheckBoxAutoStart.setLabel("Restart server on startup");
+ jCheckBoxAutoStart.setText("Restart server on startup ");
jCheckBoxAutoStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBoxAutoStartActionPerformed(evt);
Index: Util.java
===================================================================
RCS file: /cvsroot/swapdv/swapdv/Util.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Util.java 7 Jun 2002 15:39:29 -0000 1.7
+++ Util.java 11 Jun 2002 18:26:58 -0000 1.8
@@ -35,9 +35,12 @@
import java.io.*;
import java.beans.*;
import java.awt.event.*;
+import swapdv.Logger.*;
public class Util {
- public static boolean CopyFile(String src, String dst, String title) {
+
+
+ public static boolean CopyFile(String src, String dst, String title) {
final File fsrc = new File(src);
final File fdst = new File(dst);
if (fdst.exists() && !fdst.isDirectory()) {
@@ -196,6 +199,31 @@
}
}
return fname;
+ }
+
+
+ public static String readLine(DataInputStream theStream) throws IOException {
+ StringBuffer lineBuffer = new StringBuffer();
+ int theChar = 0;
+
+ // Fetch byte
+ if ((theChar = theStream.read()) == -1) return "";
+
+ // Keep looping until we have a line
+ while (((theChar != (int) '\r') && (theChar != (int) '\n'))) {
+ lineBuffer.append((char) theChar);
+
+ // Get next character, breaking the read if we hit EOF
+ if ((theChar = theStream.read()) == -1) break;
+ }
+
+ // Fetch EOL char pair - we assume CR is followed by LF
+ if (theChar == (int) '\r')
+ theChar = theStream.read();
+ else
+ Logger.log(0, LoggerI.LEVEL_NOTICE, "Read a LF before a CR in http data stream");
+
+ return lineBuffer.toString();
}
}
|