]> granicus.if.org Git - php/commitdiff
update java ui
authorkrakjoe <joe.watkins@live.co.uk>
Fri, 29 Nov 2013 14:50:44 +0000 (14:50 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Fri, 29 Nov 2013 14:50:44 +0000 (14:50 +0000)
tutorials/java-example.png
tutorials/java/dist/phpdbg-ui.jar
tutorials/java/nbproject/project.properties
tutorials/java/src/phpdbg/ui/JConsole.form
tutorials/java/src/phpdbg/ui/JConsole.java
tutorials/java/src/phpdbg/ui/JTerminalPane.java

index 87e956762d1ad5742b424c330efdbbbdf704637c..974755649b8e3eb90677d3efdb55f42927b024da 100644 (file)
Binary files a/tutorials/java-example.png and b/tutorials/java-example.png differ
index f317aa47699dabe535ea8d7b7268edebbf494c75..8bd1f95ebcd92fb6d5b72ccb3c312842a825d50f 100644 (file)
Binary files a/tutorials/java/dist/phpdbg-ui.jar and b/tutorials/java/dist/phpdbg-ui.jar differ
index b97bc0f2d03d533d1fe3893ab91f5548afbf959e..df42d35d16f6590019dad5345bc5d233a38559c1 100644 (file)
@@ -31,7 +31,8 @@ endorsed.classpath=
 excludes=
 includes=**
 jar.compress=false
-javac.classpath=
+javac.classpath=\
+    ${libs.eclipselink.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.deprecation=false
index 224a13aeef160b038ba3192481aee035cde7d825..7b3d9164fd57ed63cb256fd6ff3991fb40671925 100644 (file)
@@ -22,6 +22,9 @@
   <Properties>
     <Property name="defaultCloseOperation" type="int" value="2"/>
     <Property name="title" type="java.lang.String" value="phpdbg jui"/>
+    <Property name="modalityType" type="java.awt.Dialog$ModalityType" editor="org.netbeans.modules.form.editors.EnumEditor">
+      <Value id="TOOLKIT_MODAL"/>
+    </Property>
   </Properties>
   <SyntheticProperties>
     <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
               <EmptySpace max="-2" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
                   <Component id="outputScrollPane" max="32767" attributes="0"/>
-                  <Group type="102" alignment="1" attributes="0">
-                      <Component id="hostLabel" min="-2" max="-2" attributes="0"/>
+                  <Group type="102" alignment="0" attributes="0">
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="hostnameLabel" min="-2" max="-2" attributes="0"/>
+                          <Component id="commandLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+                      </Group>
                       <EmptySpace max="-2" attributes="0"/>
-                      <Component id="host" pref="345" max="32767" attributes="0"/>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="stdinCheckBox" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="stdinPort" min="-2" pref="60" max="-2" attributes="0"/>
-                      <EmptySpace type="separate" max="-2" attributes="0"/>
-                      <Component id="stdoutCheckBox" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="stdoutPort" min="-2" pref="60" max="-2" attributes="0"/>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="openButton" min="-2" pref="100" max="-2" attributes="0"/>
-                  </Group>
-                  <Group type="102" alignment="1" attributes="0">
-                      <Component id="input" max="32767" attributes="0"/>
-                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
-                      <Component id="echoCheckBox" min="-2" max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Group type="102" alignment="1" attributes="0">
+                              <Component id="input" max="32767" attributes="0"/>
+                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                              <Component id="echoCheckBox" min="-2" max="-2" attributes="0"/>
+                          </Group>
+                          <Group type="102" alignment="1" attributes="0">
+                              <Component id="host" pref="345" max="32767" attributes="0"/>
+                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                              <Component id="stdinCheckBox" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                              <Component id="stdinPort" min="-2" pref="60" max="-2" attributes="0"/>
+                              <EmptySpace type="separate" max="-2" attributes="0"/>
+                              <Component id="stdoutCheckBox" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                              <Component id="stdoutPort" min="-2" pref="60" max="-2" attributes="0"/>
+                              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+                              <Component id="openButton" min="-2" pref="100" max="-2" attributes="0"/>
+                          </Group>
+                      </Group>
                   </Group>
               </Group>
               <EmptySpace max="-2" attributes="0"/>
@@ -80,6 +90,7 @@
               <Group type="103" groupAlignment="3" attributes="0">
                   <Component id="input" alignment="3" min="-2" max="-2" attributes="0"/>
                   <Component id="echoCheckBox" alignment="3" max="-2" attributes="0"/>
+                  <Component id="commandLabel" alignment="3" min="-2" max="-2" attributes="0"/>
               </Group>
               <EmptySpace max="-2" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
@@ -88,7 +99,7 @@
                       <Component id="stdinCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
                       <Component id="stdoutCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
                       <Component id="stdinPort" alignment="3" min="-2" max="-2" attributes="0"/>
-                      <Component id="hostLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+                      <Component id="hostnameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
                       <Component id="host" alignment="3" min="-2" max="-2" attributes="0"/>
                   </Group>
                   <Component id="openButton" min="-2" max="-2" attributes="0"/>
         <Property name="toolTipText" type="java.lang.String" value="The listen port passed to phpdbg (-l option)"/>
       </Properties>
     </Component>
-    <Component class="javax.swing.JLabel" name="hostLabel">
+    <Component class="javax.swing.JLabel" name="hostnameLabel">
       <Properties>
         <Property name="text" type="java.lang.String" value="Hostname:"/>
       </Properties>
       <Properties>
         <Property name="selected" type="boolean" value="true"/>
         <Property name="toolTipText" type="java.lang.String" value="Check to echo sent commands in output"/>
+        <Property name="enabled" type="boolean" value="false"/>
         <Property name="horizontalAlignment" type="int" value="2"/>
         <Property name="label" type="java.lang.String" value="echo"/>
       </Properties>
     </Component>
+    <Component class="javax.swing.JLabel" name="commandLabel">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Command:"/>
+        <Property name="enabled" type="boolean" value="false"/>
+      </Properties>
+    </Component>
   </SubComponents>
 </Form>
index bf850120134d1c67874da091d5818ad6a59cad52..74f4040ce1a32c46d0a0656357214c0161511595 100644 (file)
@@ -5,8 +5,13 @@ import static java.awt.event.KeyEvent.VK_DOWN;
 import static java.awt.event.KeyEvent.VK_ENTER;
 import static java.awt.event.KeyEvent.VK_UP;
 import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
 import javax.swing.JTextField;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
 
 /*
  * To change this license header, choose License Headers in Project Properties.
@@ -46,11 +51,12 @@ public class JConsole extends javax.swing.JDialog {
         stdoutCheckBox = new javax.swing.JCheckBox();
         openButton = new javax.swing.JButton();
         stdinPort = new javax.swing.JTextField();
-        hostLabel = new javax.swing.JLabel();
+        hostnameLabel = new javax.swing.JLabel();
         input = new javax.swing.JTextField();
         outputScrollPane = new javax.swing.JScrollPane();
         output = new phpdbg.ui.JTerminalPane();
         echoCheckBox = new javax.swing.JCheckBox();
+        commandLabel = new javax.swing.JLabel();
 
         resetStdout.setText("Clear");
         resetStdout.addActionListener(new java.awt.event.ActionListener() {
@@ -62,6 +68,7 @@ public class JConsole extends javax.swing.JDialog {
 
         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
         setTitle("phpdbg jui");
+        setModalityType(java.awt.Dialog.ModalityType.TOOLKIT_MODAL);
 
         host.setText("127.0.0.1");
         host.setToolTipText("Set the hostname, or IPv4 address of the machine running the phpdbg remote console server");
@@ -88,7 +95,7 @@ public class JConsole extends javax.swing.JDialog {
         stdinPort.setText("4000");
         stdinPort.setToolTipText("The listen port passed to phpdbg (-l option)");
 
-        hostLabel.setText("Hostname:");
+        hostnameLabel.setText("Hostname:");
 
         input.setToolTipText("Enter phpdbg commands here !");
         input.setEnabled(false);
@@ -104,9 +111,13 @@ public class JConsole extends javax.swing.JDialog {
 
         echoCheckBox.setSelected(true);
         echoCheckBox.setToolTipText("Check to echo sent commands in output");
+        echoCheckBox.setEnabled(false);
         echoCheckBox.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
         echoCheckBox.setLabel("echo");
 
+        commandLabel.setText("Command:");
+        commandLabel.setEnabled(false);
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
         getContentPane().setLayout(layout);
         layout.setHorizontalGroup(
@@ -115,24 +126,28 @@ public class JConsole extends javax.swing.JDialog {
                 .addContainerGap()
                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addComponent(outputScrollPane)
-                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
-                        .addComponent(hostLabel)
+                    .addGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addComponent(hostnameLabel)
+                            .addComponent(commandLabel))
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(host, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                        .addComponent(stdinCheckBox)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                        .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addGap(18, 18, 18)
-                        .addComponent(stdoutCheckBox)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                        .addComponent(stdoutPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                        .addComponent(openButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
-                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
-                        .addComponent(input)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
-                        .addComponent(echoCheckBox)))
+                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                                .addComponent(input)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                                .addComponent(echoCheckBox))
+                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+                                .addComponent(host, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                                .addComponent(stdinCheckBox)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                                .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addGap(18, 18, 18)
+                                .addComponent(stdoutCheckBox)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                                .addComponent(stdoutPort, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                                .addComponent(openButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                 .addContainerGap())
         );
         layout.setVerticalGroup(
@@ -143,7 +158,8 @@ public class JConsole extends javax.swing.JDialog {
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                     .addComponent(input, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(echoCheckBox))
+                    .addComponent(echoCheckBox)
+                    .addComponent(commandLabel))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@@ -151,7 +167,7 @@ public class JConsole extends javax.swing.JDialog {
                         .addComponent(stdinCheckBox)
                         .addComponent(stdoutCheckBox)
                         .addComponent(stdinPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addComponent(hostLabel)
+                        .addComponent(hostnameLabel)
                         .addComponent(host, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                     .addComponent(openButton))
                 .addContainerGap())
@@ -259,18 +275,29 @@ public class JConsole extends javax.swing.JDialog {
                 stdinCheckBox.setEnabled(false);
                 if (stdinCheckBox.isSelected()) {
                     input.setEnabled(true);
-                } else input.setEnabled(false);
+                    commandLabel.setEnabled(true);
+                    echoCheckBox.setEnabled(true);
+                } else {
+                    input.setEnabled(false);
+                    commandLabel.setEnabled(false);
+                    echoCheckBox.setEnabled(false);
+                }
                 stdoutPort.setEnabled(false);
                 stdoutCheckBox.setEnabled(false);
+                hostnameLabel.setEnabled(false);
+                commandLabel.setEnabled(true);
             } else {
                 connected = false;
                 openButton.setText("Connect");
                 host.setEnabled(true);
                 stdinPort.setEnabled(true);
                 input.setEnabled(false);
+                commandLabel.setEnabled(false);
+                echoCheckBox.setEnabled(false);
                 stdinCheckBox.setEnabled(true);
                 stdoutPort.setEnabled(true);
                 stdoutCheckBox.setEnabled(true);
+                hostnameLabel.setEnabled(true);
             }
         }
     }
@@ -307,6 +334,10 @@ public class JConsole extends javax.swing.JDialog {
         return 0;
     }
     
+    public JScrollPane getOutputScrollPane() {
+        return outputScrollPane;
+    }
+    
     public synchronized void messageBox(String message) {
         messageBox(message, MessageType.INFO);
     }
@@ -318,28 +349,21 @@ public class JConsole extends javax.swing.JDialog {
      * @param args the command line arguments
      */
     public static void main(final String args[]) {
-        /* Set the Nimbus look and feel */
-        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
-        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
-         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
-         */
-        try {
-            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
-                if ("Nimbus".equals(info.getName())) {
-                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
+        for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
+            if (info.getName().equals("Nimbus")) {
+                try {
+                    UIManager.setLookAndFeel(
+                            info.getClassName());
                     break;
+                } catch (ClassNotFoundException | 
+                        InstantiationException | 
+                        IllegalAccessException | 
+                        UnsupportedLookAndFeelException ex) {
+                    Logger.getLogger(JConsole.class.getName()).log(Level.SEVERE, null, ex);
                 }
             }
-        } catch (ClassNotFoundException ex) {
-            java.util.logging.Logger.getLogger(JConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
-        } catch (InstantiationException ex) {
-            java.util.logging.Logger.getLogger(JConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
-        } catch (IllegalAccessException ex) {
-            java.util.logging.Logger.getLogger(JConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
-        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
-            java.util.logging.Logger.getLogger(JConsole.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
         }
-        //</editor-fold>
         
         /* Create and display the dialog */
         java.awt.EventQueue.invokeLater(new Runnable() {
@@ -364,9 +388,10 @@ public class JConsole extends javax.swing.JDialog {
     private static CommandHistory history = new CommandHistory();
     
     // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JLabel commandLabel;
     private javax.swing.JCheckBox echoCheckBox;
     private javax.swing.JTextField host;
-    private javax.swing.JLabel hostLabel;
+    private javax.swing.JLabel hostnameLabel;
     private javax.swing.JTextField input;
     private javax.swing.JButton openButton;
     private phpdbg.ui.JTerminalPane output;
index eb93891688e8816c363922a178bc06f9c4d35d63..8462a6e4bf1d81042867c261c49cd3a0dcf70be5 100644 (file)
@@ -33,7 +33,7 @@ public class JTerminalPane extends JTextPane {
   private static final Color B_Cyan    = Color.getHSBColor( 0.500f, 1.000f, 1.000f );
   private static final Color B_White   = Color.getHSBColor( 0.000f, 0.000f, 1.000f );
   private static final Color cReset    = Color.getHSBColor( 0.000f, 0.000f, 0.000f );
-  
+
   private Color colorCurrent    = cReset;
   private String remaining = "";