Skip to content
This repository was archived by the owner on Jul 26, 2018. It is now read-only.

Commit c51c994

Browse files
author
peterst
committed
new weberknecht library, added field for origin
1 parent c390601 commit c51c994

File tree

5 files changed

+49
-4
lines changed

5 files changed

+49
-4
lines changed

bin/WebSocketClientTerminal-x.x.jar

266 Bytes
Binary file not shown.

lib/weberknecht-fork.jar

245 Bytes
Binary file not shown.

src/com/alphabot/websocket/client/terminal/WebSocketClientTerminalView.form

+21-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@
3030
<EmptySpace max="-2" attributes="0"/>
3131
<Component id="connectButton" min="-2" max="-2" attributes="0"/>
3232
</Group>
33-
<Component id="protocolField" min="-2" pref="204" max="-2" attributes="0"/>
33+
<Group type="102" attributes="0">
34+
<Component id="protocolField" min="-2" pref="204" max="-2" attributes="0"/>
35+
<EmptySpace max="-2" attributes="0"/>
36+
<Component id="originLabel" min="-2" max="-2" attributes="0"/>
37+
<EmptySpace type="separate" max="-2" attributes="0"/>
38+
<Component id="originField" min="-2" pref="204" max="-2" attributes="0"/>
39+
</Group>
3440
</Group>
3541
<EmptySpace max="-2" attributes="0"/>
3642
</Group>
@@ -50,6 +56,8 @@
5056
<Group type="103" groupAlignment="3" attributes="0">
5157
<Component id="protocolLabel" alignment="3" min="-2" max="-2" attributes="0"/>
5258
<Component id="protocolField" alignment="3" min="-2" max="-2" attributes="0"/>
59+
<Component id="originLabel" alignment="3" min="-2" max="-2" attributes="0"/>
60+
<Component id="originField" alignment="3" min="-2" max="-2" attributes="0"/>
5361
</Group>
5462
<EmptySpace max="-2" attributes="0"/>
5563
<Component id="jScrollPane1" pref="206" max="32767" attributes="0"/>
@@ -131,6 +139,18 @@
131139
<Property name="name" type="java.lang.String" value="protocolField" noResource="true"/>
132140
</Properties>
133141
</Component>
142+
<Component class="javax.swing.JLabel" name="originLabel">
143+
<Properties>
144+
<Property name="text" type="java.lang.String" resourceKey="originLabel.text"/>
145+
<Property name="name" type="java.lang.String" value="originLabel" noResource="true"/>
146+
</Properties>
147+
</Component>
148+
<Component class="javax.swing.JTextField" name="originField">
149+
<Properties>
150+
<Property name="text" type="java.lang.String" resourceKey="originField.text"/>
151+
<Property name="name" type="java.lang.String" value="originField" noResource="true"/>
152+
</Properties>
153+
</Component>
134154
</SubComponents>
135155
</Container>
136156
<Container class="javax.swing.JMenuBar" name="menuBar">

src/com/alphabot/websocket/client/terminal/WebSocketClientTerminalView.java

+26-3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ private void initComponents() {
138138
messageButton = new javax.swing.JButton();
139139
protocolLabel = new javax.swing.JLabel();
140140
protocolField = new javax.swing.JTextField();
141+
originLabel = new javax.swing.JLabel();
142+
originField = new javax.swing.JTextField();
141143
menuBar = new javax.swing.JMenuBar();
142144
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
143145
clearLogMenuItem = new javax.swing.JMenuItem();
@@ -185,6 +187,12 @@ private void initComponents() {
185187
protocolField.setText(resourceMap.getString("protocolField.text")); // NOI18N
186188
protocolField.setName("protocolField"); // NOI18N
187189

190+
originLabel.setText(resourceMap.getString("originLabel.text")); // NOI18N
191+
originLabel.setName("originLabel"); // NOI18N
192+
193+
originField.setText(resourceMap.getString("originField.text")); // NOI18N
194+
originField.setName("originField"); // NOI18N
195+
188196
org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel);
189197
mainPanel.setLayout(mainPanelLayout);
190198
mainPanelLayout.setHorizontalGroup(
@@ -206,7 +214,12 @@ private void initComponents() {
206214
.add(addressField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 443, Short.MAX_VALUE)
207215
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
208216
.add(connectButton))
209-
.add(protocolField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 204, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
217+
.add(mainPanelLayout.createSequentialGroup()
218+
.add(protocolField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 204, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
219+
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
220+
.add(originLabel)
221+
.add(18, 18, 18)
222+
.add(originField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 204, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
210223
.addContainerGap())
211224
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 698, Short.MAX_VALUE)
212225
);
@@ -221,7 +234,9 @@ private void initComponents() {
221234
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
222235
.add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
223236
.add(protocolLabel)
224-
.add(protocolField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
237+
.add(protocolField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
238+
.add(originLabel)
239+
.add(originField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
225240
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
226241
.add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)
227242
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
@@ -306,7 +321,11 @@ public void connectClick() {
306321
if (protocolName.isEmpty()) {
307322
protocolName = null;
308323
}
309-
websocket = new WebSocket(url, protocolName);
324+
String origin = originField.getText();
325+
if (origin.isEmpty()) {
326+
origin = null;
327+
}
328+
websocket = new WebSocket(url, protocolName, origin);
310329

311330

312331
// Register Event Handlers
@@ -373,6 +392,7 @@ private void changeUIState() {
373392
statusMessageLabel.setText("Connected");
374393
protocolField.setEnabled(false);
375394
addressField.setEnabled(false);
395+
originField.setEnabled(false);
376396
messageField.setEnabled(true);
377397
messageButton.setEnabled(true);
378398

@@ -387,6 +407,7 @@ private void changeUIState() {
387407
statusMessageLabel.setText("Not Connected");
388408
protocolField.setEnabled(true);
389409
addressField.setEnabled(true);
410+
originField.setEnabled(true);
390411
messageField.setEnabled(false);
391412
messageButton.setEnabled(false);
392413

@@ -431,6 +452,8 @@ public void clearLog() {
431452
private javax.swing.JMenuBar menuBar;
432453
private javax.swing.JButton messageButton;
433454
private javax.swing.JTextField messageField;
455+
private javax.swing.JTextField originField;
456+
private javax.swing.JLabel originLabel;
434457
private javax.swing.JProgressBar progressBar;
435458
private javax.swing.JTextField protocolField;
436459
private javax.swing.JLabel protocolLabel;

src/com/alphabot/websocket/client/terminal/resources/WebSocketClientTerminalView.properties

+2
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,5 @@ clearLog.Action.text=
4646
clearLog.Action.shortDescription=
4747
protocolLabel.text=Protocol Name:
4848
protocolField.text=
49+
originLabel.text=Origin:
50+
originField.text=

0 commit comments

Comments
 (0)