From 1e56b101f85c1e69eec46cd90a930545c1f5ffe8 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 8 Jan 2025 15:10:03 -0500 Subject: [PATCH] Remove Chat and Glacier/simpleChat Swing demos --- java/Chat/README.md | 14 - java/Chat/build.gradle | 54 -- java/Chat/chatdemo.pro | 28 - java/Chat/config.client | 44 -- .../zeroc/demos/Chat/ChatDemoGUIFactory.java | 41 -- .../zeroc/demos/Chat/ChatRoomCallbackI.java | 41 -- .../java/com/zeroc/demos/Chat/ChatUtils.java | 63 --- .../java/com/zeroc/demos/Chat/ChatView.java | 249 --------- .../com/zeroc/demos/Chat/Coordinator.java | 476 ----------------- .../java/com/zeroc/demos/Chat/LoginInfo.java | 35 -- .../java/com/zeroc/demos/Chat/LoginView.java | 124 ----- .../java/com/zeroc/demos/Chat/MainView.java | 281 ---------- .../java/com/zeroc/demos/Chat/StatusBarI.java | 37 -- .../src/main/resources/icons/128x128/chat.png | Bin 8281 -> 0 bytes .../src/main/resources/icons/16x16/chat.png | Bin 781 -> 0 bytes .../src/main/resources/icons/16x16/user.png | Bin 868 -> 0 bytes .../src/main/resources/icons/32x32/chat.png | Bin 1514 -> 0 bytes .../src/main/resources/icons/32x32/error.ico | Bin 3262 -> 0 bytes .../src/main/resources/icons/32x32/error.png | Bin 1770 -> 0 bytes java/Chat/src/main/slice/Chat.ice | 35 -- java/Chat/src/main/slice/ChatSession.ice | 118 ----- java/Glacier2/README.md | 5 - java/Glacier2/build.gradle | 8 +- java/Glacier2/simpleChat/Chat.ice | 22 - java/Glacier2/simpleChat/Client.java | 492 ------------------ java/Glacier2/simpleChat/README.md | 21 - java/Glacier2/simpleChat/config.client | 46 -- java/README.md | 3 - java/settings.gradle | 5 +- 29 files changed, 3 insertions(+), 2239 deletions(-) delete mode 100644 java/Chat/README.md delete mode 100644 java/Chat/build.gradle delete mode 100644 java/Chat/chatdemo.pro delete mode 100644 java/Chat/config.client delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/ChatDemoGUIFactory.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/ChatRoomCallbackI.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/ChatUtils.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/ChatView.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/Coordinator.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/LoginInfo.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/LoginView.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/MainView.java delete mode 100644 java/Chat/src/main/java/com/zeroc/demos/Chat/StatusBarI.java delete mode 100644 java/Chat/src/main/resources/icons/128x128/chat.png delete mode 100644 java/Chat/src/main/resources/icons/16x16/chat.png delete mode 100644 java/Chat/src/main/resources/icons/16x16/user.png delete mode 100644 java/Chat/src/main/resources/icons/32x32/chat.png delete mode 100644 java/Chat/src/main/resources/icons/32x32/error.ico delete mode 100644 java/Chat/src/main/resources/icons/32x32/error.png delete mode 100644 java/Chat/src/main/slice/Chat.ice delete mode 100644 java/Chat/src/main/slice/ChatSession.ice delete mode 100644 java/Glacier2/simpleChat/Chat.ice delete mode 100644 java/Glacier2/simpleChat/Client.java delete mode 100644 java/Glacier2/simpleChat/README.md delete mode 100644 java/Glacier2/simpleChat/config.client diff --git a/java/Chat/README.md b/java/Chat/README.md deleted file mode 100644 index 2c231af92c..0000000000 --- a/java/Chat/README.md +++ /dev/null @@ -1,14 +0,0 @@ -This demo is a Java client for the [ZeroC Chat Demo][1]. It connects to a -single chat room, allowing you to chat with other chat room participants. - -By default, the demo connects to the chat server hosted on demo.zeroc.com -through a WebSocket reverse proxy hosted on zeroc.com. - -If you wish to run your own server you can specify a custom configuration -file when launching the application: - -``` -java -jar Chat.jar --Ice.Config=config.client -``` - -[1]: https://doc.zeroc.com/technical-articles/general-topics/chat-demo diff --git a/java/Chat/build.gradle b/java/Chat/build.gradle deleted file mode 100644 index 152a43cbf9..0000000000 --- a/java/Chat/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ - -buildscript { - repositories { - mavenCentral() - } - - dependencies { - classpath "com.guardsquare:proguard-gradle:7.4.0-beta02" - } -} - -slice { - java { - include = ["${projectDir}/src/main/slice"] - } -} - -dependencies { - implementation 'com.jgoodies:jgoodies-common:1.8.0' - implementation 'com.jgoodies:jgoodies-looks:2.6.0' - implementation 'com.jgoodies:jgoodies-forms:1.8.0' - implementation localDependency("ice") - implementation localDependency("glacier2") -} - -jar { - archiveFileName = "ChatTEMP.jar" - manifest { - attributes 'Main-Class': "com.zeroc.demos.Chat.MainView" - } -} - -def javaHome = System.properties['java.home'] - -task proguard(type: proguard.gradle.ProGuardTask, dependsOn: jar) { - injars configurations.runtimeClasspath.resolve(), filter: '!META-INF/**,!module-info.class' - injars "${buildDir}/libs/ChatTEMP.jar" - if(JavaVersion.current() <= JavaVersion.VERSION_1_8) { - libraryjars "${javaHome}/lib/rt.jar" - libraryjars "${javaHome}/lib/jsse.jar" - } else { - libraryjars "${javaHome}/jmods/java.base.jmod" - libraryjars "${javaHome}/jmods/java.logging.jmod" - libraryjars "${javaHome}/jmods/java.desktop.jmod" - libraryjars "${javaHome}/jmods/java.prefs.jmod" - } - outjars "Chat.jar" - configuration "chatdemo.pro" -} -assemble.dependsOn(proguard) - -clean { - delete("Chat.jar") -} diff --git a/java/Chat/chatdemo.pro b/java/Chat/chatdemo.pro deleted file mode 100644 index 1fe8968aff..0000000000 --- a/java/Chat/chatdemo.pro +++ /dev/null @@ -1,28 +0,0 @@ --dontshrink --dontoptimize --dontobfuscate --dontusemixedcaseclassnames --dontpreverify - --dontnote jdk.internal.jimage.** --dontnote jdk.internal.jrtfs.** --dontnote module-info - --dontnote com.jgoodies.** - -# Keep - Applications. Keep all application classes, along with their 'main' -# methods. --keepclasseswithmembers public class * { - public static void main(java.lang.String[]); -} - -# Also keep - Swing UI L&F. Keep all extensions of javax.swing.plaf.ComponentUI, -# along with the special 'createUI' method. --keep class * extends javax.swing.plaf.ComponentUI { - public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent); -} - -# Keep names - Native method names. Keep all native class/method names. --keepclasseswithmembers,includedescriptorclasses,allowshrinking class * { - native ; -} diff --git a/java/Chat/config.client b/java/Chat/config.client deleted file mode 100644 index 6d77212927..0000000000 --- a/java/Chat/config.client +++ /dev/null @@ -1,44 +0,0 @@ -# -# The proxy to the Glacier2 router for all outgoing connections. This -# must match the value of Glacier2.Client.Endpoints in your Chat server's config. -# -Ice.Default.Router=DemoGlacier2/router:ssl -p 4064 -h 127.0.0.1 - -# -# Warn about connection exceptions -# -#Ice.Warn.Connections=1 - -# -# Network Tracing -# -# 0 = no network tracing -# 1 = trace connection establishment and closure -# 2 = like 1, but more detailed -# 3 = like 2, but also trace data transfer -# -#Ice.Trace.Network=1 - -# -# Protocol Tracing -# -# 0 = no protocol tracing -# 1 = trace protocol messages -# -#Ice.Trace.Protocol=1 - -# -# Security Tracing -# -# 0 = no security tracing -# 1 = trace messages -# -#IceSSL.Trace.Security=1 - -# -# SSL Configuration -# -Ice.Plugin.IceSSL=com.zeroc.IceSSL.PluginFactory -IceSSL.DefaultDir=../../certs -IceSSL.Keystore=client.jks -IceSSL.Password=password diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatDemoGUIFactory.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatDemoGUIFactory.java deleted file mode 100644 index 78d2f15e40..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatDemoGUIFactory.java +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Point; - -import javax.swing.JScrollPane; - -// -// Helper methods to create the UI. -// -final public class ChatDemoGUIFactory -{ - public static void locateOnScreen(Component component) - { - Dimension paneSize = component.getSize(); - Dimension screenSize = component.getToolkit().getScreenSize(); - component.setLocation((screenSize.width - paneSize.width) / 2, (screenSize.height - paneSize.height) / 2); - } - - public static void centerComponent(Component component, Component base) - { - Dimension baseSize = base.getSize(); - Point basePoint = base.getLocation(); - Dimension componentSize = component.getSize(); - component.setLocation(basePoint.x + (baseSize.width - componentSize.width) / 2, - basePoint.y + (baseSize.height - componentSize.height) / 2); - } - - public static JScrollPane createStrippedScrollPane(Component component) - { - JScrollPane scrollPane = new JScrollPane(component); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setBorder(null); - return scrollPane; - } -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatRoomCallbackI.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatRoomCallbackI.java deleted file mode 100644 index 03e1718456..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatRoomCallbackI.java +++ /dev/null @@ -1,41 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -// -// This class implements the ChatRoomCallback interface. -// -class ChatRoomCallbackI implements ChatRoomCallback -{ - public ChatRoomCallbackI(Coordinator coordinator) - { - _coordinator = coordinator; - } - - public void init(String[] users, com.zeroc.Ice.Current currrent) - { - _coordinator.initEvent(users); - } - - public void send(long timestamp, String name, String message, com.zeroc.Ice.Current currrent) - { - if(name.compareToIgnoreCase(_coordinator.getUsername()) != 0) - { - _coordinator.userSayEvent(timestamp, name, message); - } - } - - public void join(long timestamp, String name, com.zeroc.Ice.Current currrent) - { - _coordinator.userJoinEvent(timestamp, name); - } - - public void leave(long timestamp, String name, com.zeroc.Ice.Current currrent) - { - _coordinator.userLeaveEvent(timestamp, name); - } - - private final Coordinator _coordinator; -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatUtils.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatUtils.java deleted file mode 100644 index 58591fca97..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.util.Date; -import java.util.TimeZone; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.io.StringWriter; -import java.io.PrintWriter; - -public class ChatUtils -{ - // - // This function unescapes HTML entities in the data string - // and return the unescaped string. - // - public static String unstripHtml(String data) - { - data = data.replace(""", "\""); - data = data.replace("'", "'"); - data = data.replace("<", "<"); - data = data.replace(">", ">"); - data = data.replace("&", "&"); - return data; - } - - public static String formatTimestamp(long timestamp) - { - DateFormat dtf = new SimpleDateFormat("HH:mm:ss"); - dtf.setTimeZone(TimeZone.getDefault()); - return dtf.format(new Date(timestamp)); - } - - public static String formatUsername(String in) - { - try - { - in = in.substring(0, 1).toUpperCase() + in.substring(1, in.length()).toLowerCase(); - } - catch(IndexOutOfBoundsException ex) - { - } - return in; - } - - public static String stack2string(Throwable e) - { - try - { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - e.printStackTrace(pw); - return sw.toString(); - } - catch(Exception e2) - { - return e.toString(); - } - } -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatView.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatView.java deleted file mode 100644 index ada2c6c70e..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/ChatView.java +++ /dev/null @@ -1,249 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.awt.Component; -import java.awt.event.ComponentListener; -import java.awt.event.ComponentEvent; - -import java.awt.BorderLayout; -import java.awt.event.KeyListener; -import java.awt.event.KeyEvent; -import java.awt.Dimension; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.JPanel; -import javax.swing.JList; -import javax.swing.JPopupMenu; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JLabel; -import javax.swing.JSplitPane; -import javax.swing.JTextArea; -import javax.swing.JScrollPane; -import javax.swing.JScrollBar; -import javax.swing.DefaultListModel; -import javax.swing.text.Document; -import javax.swing.text.Element; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.DefaultEditorKit; - -import java.util.prefs.Preferences; -import java.util.prefs.BackingStoreException; - -public class ChatView extends JPanel -{ - @SuppressWarnings("unchecked") - ChatView(Preferences prefs, DefaultListModel users) - { - _prefs = prefs; - setLayout(new BorderLayout()); - - // Build the user list. - _userList = new JList(); - _userList.setCellRenderer(new UserListCellRender()); - _userList.setModel(users); - - // Build the JTextArea that shows the chat conversation. - _conversationText = new JTextArea(""); - _conversationText.setLineWrap(true); - _conversationText.setEditable(false); - - final JPopupMenu textMenu = new JPopupMenu(); - textMenu.add(new DefaultEditorKit.CopyAction()); - textMenu.pack(); - - _conversationText.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - if (e.isPopupTrigger()) // BUTTON3 is the right mouse button - { - textMenu.show(_conversationText, e.getX(), e.getY()); - } - } - }); - - // Build the JTextArea where the user writes input messages. - _conversationInput = new JTextArea(""); - _conversationInput.setLineWrap(true); - _conversationInput.setEditable(true); - _conversationInput.addKeyListener(new InputLineKeyListener()); - - // Build the split panes. - _horizontalSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - - JScrollPane usersScroll = ChatDemoGUIFactory.createStrippedScrollPane(_userList); - usersScroll.setMinimumSize(new Dimension(100, 100)); - _horizontalSplit.setLeftComponent(usersScroll); - - _conversationTextScroll = ChatDemoGUIFactory.createStrippedScrollPane(_conversationText); - _conversationTextScroll.setMinimumSize(new Dimension(100, 100)); - _conversationTextScroll.setPreferredSize(new Dimension(100, 100)); - _horizontalSplit.setRightComponent(_conversationTextScroll); - - _verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - _verticalSplit.setTopComponent(_horizontalSplit); - - JScrollPane conversationInputScroll = ChatDemoGUIFactory.createStrippedScrollPane(_conversationInput); - conversationInputScroll.setMinimumSize(new Dimension(100, 100)); - conversationInputScroll.setPreferredSize(new Dimension(100, 100)); - _verticalSplit.setBottomComponent(conversationInputScroll); - - _horizontalSplit.setResizeWeight(0.1); - _verticalSplit.setResizeWeight(0.9); - - _conversationText.addComponentListener(new ComponentListener() - { - public void componentResized(ComponentEvent e) - { - JScrollBar vertivalScrollbar = _conversationTextScroll.getVerticalScrollBar(); - vertivalScrollbar.setValue(vertivalScrollbar.getMaximum()); - } - - public void componentHidden(ComponentEvent e) - { - } - - public void componentMoved(ComponentEvent e) - { - } - - public void componentShown(ComponentEvent e) - { - } - }); - - add(_verticalSplit, BorderLayout.CENTER); - } - - public void setCoordinator(Coordinator coordinator) - { - _coordinator = coordinator; - } - - public void appendMessage(String message) - { - Document doc = (Document) _conversationText.getDocument(); - Element e = doc.getDefaultRootElement(); - AttributeSet attr = e.getAttributes().copyAttributes(); - try - { - doc.insertString(doc.getLength(), message + "\n", attr); - } - catch(BadLocationException ex) - { - } - _conversationText.setCaretPosition(doc.getLength()); - } - - public void appendError(String error) - { - appendMessage(error); - _conversationInput.setEditable(false); - } - - class UserListCellRender extends DefaultListCellRenderer - { - public Component - getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) - { - JLabel label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, hasFocus); - label.setIcon(MainView.getIcon("/icons/16x16/user.png")); - return label; - } - } - - // - // Event handler for input messages. - // - class InputLineKeyListener implements KeyListener - { - public void keyTyped(KeyEvent e) - { - if(e.getKeyChar() == KeyEvent.VK_ENTER) - { - try - { - Document doc = _conversationInput.getDocument(); - String msg = doc.getText(0, doc.getLength()).trim(); - if(msg.length() > 0) - { - _coordinator.sendMessage(msg); - } - } - catch(BadLocationException ex) - { - } - _conversationInput.setText(""); - } - } - - public void keyPressed(KeyEvent e) - { - } - - public void keyReleased(KeyEvent e) - { - } - } - - public void storeWindowPrefs() - { - Preferences windowPrefs = _prefs.node("ChatView"); - windowPrefs.putInt("hSplitLocation", _horizontalSplit.getDividerLocation()); - windowPrefs.putInt("vSplitLocation", _verticalSplit.getDividerLocation()); - } - - public boolean loadWindowPrefs() - { - try - { - if(!_prefs.nodeExists("ChatView")) - { - return false; - } - } - catch(BackingStoreException ex) - { - return false; - } - - Preferences windowPrefs = _prefs.node("ChatView"); - _horizontalSplit.setDividerLocation(windowPrefs.getInt("hSplitLocation", 120)); - _verticalSplit.setDividerLocation(windowPrefs.getInt("vSplitLocation", 50)); - return true; - } - - public void setConnected(boolean connected) - { - setVisible(connected); - if(connected) - { - loadWindowPrefs(); - _conversationInput.setEditable(true); - if(!_conversationInput.hasFocus()) - { - _conversationInput.requestFocus(); - } - } - else - { - storeWindowPrefs(); - _conversationText.setText(""); - _conversationInput.setText(""); - } - } - - private final JList _userList; - private final JScrollPane _conversationTextScroll; - private final JTextArea _conversationText; - private final JTextArea _conversationInput; - private final JSplitPane _verticalSplit; - private final JSplitPane _horizontalSplit; - private Coordinator _coordinator; - private final Preferences _prefs; -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/Coordinator.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/Coordinator.java deleted file mode 100644 index a29d3f027b..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/Coordinator.java +++ /dev/null @@ -1,476 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.Cursor; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Frame; - -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; - -import javax.swing.DefaultListModel; -import javax.swing.SwingUtilities; -import javax.swing.JOptionPane; - -import javax.swing.JDialog; -import javax.swing.JPopupMenu; -import javax.swing.JPanel; -import javax.swing.JLabel; -import javax.swing.JTextArea; -import javax.swing.JButton; -import javax.swing.BoxLayout; -import javax.swing.text.DefaultEditorKit; -import javax.swing.ImageIcon; - -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.builder.DefaultFormBuilder; -import com.jgoodies.forms.factories.Borders; - -import com.zeroc.demos.Chat.*; -import com.zeroc.Glacier2.SessionFactoryHelper; -import com.zeroc.Glacier2.SessionHelper; -import com.zeroc.Glacier2.SessionCallback; -import com.zeroc.Glacier2.SessionNotExistException; - -class Coordinator -{ - public enum ClientState { Disconnected, Connecting, Connected, Disconnecting } - - public Coordinator(MainView mainView, LoginView loginView, ChatView chatView, DefaultListModel users, - String[] args) - { - _args = args; - _mainView = mainView; - _loginView = loginView; - _chatView = chatView; - _users = users; - - com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData(); - - java.util.List rArgs = new java.util.ArrayList<>(); - initData.properties = new com.zeroc.Ice.Properties(_args, rArgs); - _args = rArgs.toArray(new String[rArgs.size()]); - - initData.properties.setProperty("Ice.Plugin.IceSSL", "com.zeroc.IceSSL.PluginFactory"); - - // Load the configuration file. - initData.properties.setProperty("Ice.Default.Package", "com.zeroc.demos"); - initData.properties = new com.zeroc.Ice.Properties(args, initData.properties); - - // - // Set Ice.Default.Router if not set. - // - if(initData.properties.getProperty("Ice.Default.Router").isEmpty()) - { - initData.properties.setProperty("IceSSL.UsePlatformCAs", "1"); - initData.properties.setProperty("IceSSL.CheckCertName", "2"); - initData.properties.setProperty("IceSSL.VerifyDepthMax", "5"); - initData.properties.setProperty("Ice.Default.Router", - "Glacier2/router:wss -p 443 -h zeroc.com -r /demo-proxy/chat/glacier2"); - } - - initData.dispatcher = (runnable, connection) -> - { - if(_exit) // The GUI is being destroyed, don't use the GUI thread any more - { - runnable.run(); - } - else - { - SwingUtilities.invokeLater(runnable); - } - }; - - final Coordinator coordinator = this; - _factory = new SessionFactoryHelper(initData, new SessionCallback() - { - public void connected(final SessionHelper session) - throws SessionNotExistException - { - // - // Ignore callbacks during shutdown. - // - if(_exit) - { - return; - } - - // - // If the session has been reassigned avoid the spurious callback. - // - - if(session != _session) - { - return; - } - - ChatRoomCallbackPrx callback = ChatRoomCallbackPrx.uncheckedCast( - _session.addWithUUID(new ChatRoomCallbackI(coordinator))); - - _chat = ChatSessionPrx.uncheckedCast(_session.session()); - try - { - _chat.setCallbackAsync(callback).whenCompleteAsync((result, ex) -> - { - if(ex == null) - { - _info.save(); - _username = ChatUtils.formatUsername(_info.username); - setState(ClientState.Connected); - } - else - { - destroySession(); - } - }, - _chat.ice_executor()); - } - catch(com.zeroc.Ice.CommunicatorDestroyedException ex) - { - // Ignore client session was destroyed. - } - } - - public void disconnected(SessionHelper session) - { - // - // Ignore callbacks during shutdown. - // - if(_exit) - { - return; - } - - _username = ""; - if(_state == ClientState.Disconnecting) // Connection closed by user logout/exit - { - setState(ClientState.Disconnected); - } - else if(_state == ClientState.Connected) // Connection lost while user was chatting - { - setError(" - The connection with the server was unexpectedly lost.\n" + - "You can try to login again from the File menu."); - } - else // Connection lost while user was connecting - { - setError(" - The connection with the server was unexpectedly lost.\n" + - "Try again."); - } - } - - public void connectFailed(SessionHelper session, Throwable exception) - { - // - // Ignore callbacks during shutdown. - // - if(_exit) - { - return; - } - - try - { - throw exception; - } - catch(final com.zeroc.Glacier2.CannotCreateSessionException ex) - { - setError("Login failed (Glacier2.CannotCreateSessionException):\n" + ex.reason); - } - catch(final com.zeroc.Glacier2.PermissionDeniedException ex) - { - setError("Login failed (Glacier2.PermissionDeniedException):\n" + ex.reason); - } - catch(com.zeroc.Ice.Exception ex) - { - setError("Login failed (" + ex.ice_id() + ").\n" + "Please check your configuration."); - } - catch(final Throwable ex) - { - setError("Login failed:\n" + ChatUtils.stack2string(ex)); - } - } - - public void createdCommunicator(SessionHelper session) - { - } - }); - } - - public void login(LoginInfo info) - { - setState(ClientState.Connecting); - _info = info; - _session = _factory.connect(info.username, info.password); - } - - public void logout() - { - setState(ClientState.Disconnecting); - destroySession(); - } - - public void exit() - { - _exit = true; - com.zeroc.Ice.Communicator communicator = _session == null ? null : _session.communicator(); - destroySession(); - _mainView.dispose(); - if(communicator != null) - { - try - { - communicator.waitForShutdown(); - } - catch(com.zeroc.Ice.CommunicatorDestroyedException ex) - { - // - // Can happen if the communicator is already destroyed - // - } - } - System.exit(0); - } - - @SuppressWarnings("unchecked") - public void initEvent(final String[] users) - { - for(int cont = 0; cont < users.length; ++cont) - { - _users.addElement(users[cont]); - } - } - - @SuppressWarnings("unchecked") - public void userJoinEvent(final long timestamp, final String name) - { - _users.addElement(name); - _chatView.appendMessage(ChatUtils.formatTimestamp(timestamp) + " - - " + name + " joined."); - } - - public void userLeaveEvent(final long timestamp, final String name) - { - int index = _users.indexOf(name); - if(index != -1) - { - _users.remove(index); - _chatView.appendMessage(ChatUtils.formatTimestamp(timestamp) + " - " + " - " + - name + " left."); - } - } - - public void userSayEvent(final long timestamp, final String name, final String message) - { - _chatView.appendMessage(ChatUtils.formatTimestamp(timestamp) + " - <" + name + "> " + - ChatUtils.unstripHtml(message)); - } - - public void sendMessage(final String message) - { - - if(_chat != null) - { - if(message.length() > _maxMessageSize) - { - _chatView.appendMessage(" - Message length exceeded, maximum length is " + - _maxMessageSize + " characters."); - } - else - { - try - { - _chat.sendAsync(message).whenCompleteAsync((timestamp, ex) -> - { - if(ex == null) - { - userSayEvent(timestamp, _username, message); - } - else if(ex instanceof InvalidMessageException) - { - InvalidMessageException e = (InvalidMessageException)ex; - _chatView.appendMessage(" - " + e.reason); - } - else - { - destroySession(); - } - }, - _chat.ice_executor()); - } - catch(com.zeroc.Ice.CommunicatorDestroyedException ex) - { - // Ignore client session was destroyed. - } - } - } - } - - public void setState(ClientState state) - { - _state = state; - if(state == ClientState.Disconnected) - { - _loginView.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - _chatView.setConnected(false); - _loginView.setEnabled(true); - _loginView.setConnected(false); - _mainView.setEnabled(false); - _mainView.setConnected(false); - _users.clear(); - } - else if(state == ClientState.Connecting) - { - _loginView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - _loginView.setEnabled(false); - _mainView.setEnabled(false); - } - else if(state == ClientState.Connected) - { - _chatView.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - _loginView.setConnected(true); - _chatView.setConnected(true); - _mainView.setEnabled(true); - _mainView.setConnected(true); - } - else if(state == ClientState.Disconnecting) - { - _chatView.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - _mainView.setEnabled(false); - } - } - - public void setError(final String message) - { - // - // Don't display errors at that point GUI is being destroyed. - // - if(_exit == true) - { - return; - } - if(_state != ClientState.Connected) - { - setState(ClientState.Disconnected); - ErrorView errorView = new ErrorView(_mainView, message); - errorView.setSize(430, 200); - errorView.setMinimumSize(new Dimension(430, 200)); - errorView.setMaximumSize(new Dimension(430, 200)); - errorView.setResizable(false); - ChatDemoGUIFactory.centerComponent(errorView, _mainView); - errorView.setVisible(true); - } - else - { - _mainView.setEnabled(false); - _mainView.setConnected(false); - _chatView.appendError(message); - } - } - - public String getUsername() - { - return _username; - } - - public class ErrorView extends JDialog - { - private JButton bttClose = new JButton("Close"); - ErrorView(Frame frame, String message) - { - super(frame, true); - setTitle("Error - Chat Demo"); - ActionListener closeListener = new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - setVisible(false); - } - }; - bttClose.addActionListener(closeListener); - - final JTextArea txtErrorMessage = new JTextArea(message, 5, 30); - txtErrorMessage.setLineWrap(true); - JPanel errorPanel = null; // Build the error panel. - { - FormLayout layout = new FormLayout("center:pref:grow", "center:pref:grow"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.border(Borders.DIALOG); - javax.swing.ImageIcon icon = MainView.getIcon("/icons/32x32/error.png"); - if(icon != null) - { - builder.append(new JLabel(icon)); - builder.nextLine(); - } - txtErrorMessage.setEditable(false); - builder.append(ChatDemoGUIFactory.createStrippedScrollPane(txtErrorMessage)); - errorPanel = builder.getPanel(); - } - - JPanel actionsPanel = null; // Build a panel for put actions. - { - FormLayout layout = new FormLayout("center:3dlu:grow", "pref"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.append(bttClose); - actionsPanel = builder.getPanel(); - getRootPane().setDefaultButton(bttClose); - } - - FormLayout layout = new FormLayout("fill:pref:grow", "pref"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.append(errorPanel); - builder.nextLine(); - builder.append(actionsPanel); - - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - setContentPane(builder.getPanel()); - - final JPopupMenu textMenu = new JPopupMenu(); - textMenu.add(new DefaultEditorKit.CopyAction()); - textMenu.pack(); - - txtErrorMessage.addMouseListener(new MouseAdapter() - { - public void mousePressed(MouseEvent e) - { - if (e.isPopupTrigger()) // BUTTON3 is the right mouse button - { - textMenu.show(txtErrorMessage, e.getX(), e.getY()); - } - } - }); - } - } - - protected void - destroySession() - { - final com.zeroc.Glacier2.SessionHelper s = _session; - _session = null; - _chat = null; - - if(s != null) - { - s.destroy(); - } - } - - private final SessionFactoryHelper _factory; - private ClientState _state; - private String[] _args; - private final MainView _mainView; - private final ChatView _chatView; - private final LoginView _loginView; - private final DefaultListModel _users; - private LoginInfo _info = new LoginInfo(); - private SessionHelper _session = null; - private Object _sessionMonitor = new java.lang.Object(); - private ChatSessionPrx _chat = null; - private String _username = ""; - private static final int _maxMessageSize = 1024; - private boolean _exit = false; -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/LoginInfo.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/LoginInfo.java deleted file mode 100644 index 1ec9439ae5..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/LoginInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.util.prefs.Preferences; -import java.util.prefs.BackingStoreException; - -class LoginInfo -{ - public LoginInfo() - { - } - - public LoginInfo(Preferences connectionPrefs) - { - _connectionPrefs = connectionPrefs; - load(); - } - - public void load() - { - username = _connectionPrefs.get("chatdemo.username", username); - } - - public void save() - { - _connectionPrefs.put("chatdemo.username", username); - } - - public String username = System.getProperty("user.name"); - public String password = ""; - private Preferences _connectionPrefs; -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/LoginView.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/LoginView.java deleted file mode 100644 index 21ad70a6d4..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/LoginView.java +++ /dev/null @@ -1,124 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.Cursor; -import java.awt.Toolkit; - -import javax.swing.JPanel; -import javax.swing.JLabel; -import javax.swing.JCheckBox; -import javax.swing.JTextField; -import javax.swing.JTextArea; -import javax.swing.JPasswordField; -import javax.swing.JButton; -import javax.swing.BoxLayout; - -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.builder.DefaultFormBuilder; -import com.jgoodies.forms.factories.Borders; - -import java.util.prefs.Preferences; - -public class LoginView extends JPanel -{ - LoginView(MainView mainview, Preferences connectionPrefs) - { - _mainView = mainview; - _info = new LoginInfo(connectionPrefs); - - ActionListener loginListener = new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - login(); - } - }; - _bttLogin.addActionListener(loginListener); - - { // Build the basic login panel. - FormLayout layout = new FormLayout("center:pref:grow", "pref:grow"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.border(Borders.DIALOG); - builder.append(new JLabel("Chat Demo")); - builder.nextLine(); - builder.append(new JLabel("Welcome! You can login with any username / password.")); - builder.append(new JLabel("Username")); - builder.nextLine(); - builder.append(_txtUsername); - builder.nextLine(); - builder.append(new JLabel("Password")); - builder.nextLine(); - builder.append(_txtPassword); - _directPanel = builder.getPanel(); - } - - JPanel actionsPanel = null; // Build a panel for put actions. - { - FormLayout layout = new FormLayout("center:3dlu:grow", "pref"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.append(_bttLogin); - actionsPanel = builder.getPanel(); - _mainView.getRootPane().setDefaultButton(_bttLogin); - } - - FormLayout layout = new FormLayout("fill:pref:grow", "pref"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.append(_directPanel); - builder.nextLine(); - builder.append(actionsPanel); - - _txtUsername.setText(_info.username); - - setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); - add(builder.getPanel()); - } - - public void setCoordinator(Coordinator coordinator) - { - _coordinator = coordinator; - } - - public void setEnabled(boolean enabled) - { - _txtUsername.setEnabled(enabled); - _txtPassword.setEnabled(enabled); - _bttLogin.setEnabled(enabled); - } - - private void login() - { - _coordinator.setState(Coordinator.ClientState.Connecting); - _info.username = _txtUsername.getText(); - if(_txtPassword.getPassword() != null) - { - _info.password = new String(_txtPassword.getPassword()); - } - _coordinator.login(_info); - } - - public void setConnected(boolean connected) - { - setVisible(!connected); - if(connected) - { - _mainView.getRootPane().setDefaultButton(null); - } - else - { - _mainView.getRootPane().setDefaultButton(_bttLogin); - } - } - - private final JPanel _directPanel; - private final JTextField _txtUsername = new JTextField(20); - private final JPasswordField _txtPassword = new JPasswordField(20); - private final JButton _bttLogin = new JButton("Login"); - private final LoginInfo _info; - private Coordinator _coordinator = null; - private final MainView _mainView; -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/MainView.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/MainView.java deleted file mode 100644 index 8ce01d0fae..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/MainView.java +++ /dev/null @@ -1,281 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; -import java.awt.BorderLayout; -import java.awt.Frame; -import java.awt.Rectangle; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import java.awt.Dimension; - -import javax.swing.JFrame; -import javax.swing.JToolBar; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.ImageIcon; -import javax.swing.BoxLayout; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JOptionPane; -import javax.swing.KeyStroke; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JMenuBar; - -import java.util.prefs.Preferences; -import java.util.prefs.BackingStoreException; - -import com.jgoodies.looks.Options; -import com.jgoodies.looks.HeaderStyle; -import com.jgoodies.looks.BorderStyle; -import com.jgoodies.looks.plastic.PlasticLookAndFeel; -import com.jgoodies.forms.layout.FormLayout; -import com.jgoodies.forms.builder.DefaultFormBuilder; -import com.jgoodies.forms.util.LayoutStyle; - -public class MainView extends JFrame -{ - public static void main(final String[] args) - { - try - { - if(System.getProperty("os.name").startsWith("Mac OS")) // OS X L&F - { - System.setProperty("apple.laf.useScreenMenuBar", "true"); - System.setProperty("com.apple.mrj.application.apple.menu.about.name", "IceGrid Admin"); - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } - else if(System.getProperty("os.name").startsWith("Windows")) - { - UIManager.setLookAndFeel("com.jgoodies.looks.windows.WindowsLookAndFeel"); - } - else // JGoodies L&F - { - UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticLookAndFeel"); - } - } - catch(Exception e) - { - } - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - new MainView(args); // Create and set up the window. - } - }); - } - - private class MenuBar extends JMenuBar - { - private MenuBar() - { - putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH); - putClientProperty(PlasticLookAndFeel.BORDER_STYLE_KEY, BorderStyle.SEPARATOR); - - // - // File menu - // - JMenu fileMenu = new JMenu("File"); - fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F); - add(fileMenu); - fileMenu.add(_login); - fileMenu.add(_logout); - if(!System.getProperty("os.name").startsWith("Mac OS")) - { - fileMenu.add(_exit); - } - - // - // Help menu - // - JMenu helpMenu = new JMenu("Help"); - helpMenu.setMnemonic(java.awt.event.KeyEvent.VK_H); - add(helpMenu); - helpMenu.add(_about); - } - } - - MainView(String[] args) - { - super("Chat Demo"); - setMinimumSize(new Dimension(minWidth, minHeight)); - _prefs = Preferences.userNodeForPackage(getClass()); - javax.swing.ImageIcon icon = getIcon("/icons/16x16/chat.png"); - if(icon != null) - { - setIconImage(icon.getImage()); - } - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - storeWindowPrefs(); - _coordinator.exit(); - } - }); - - _about = new AbstractAction("About") - { - public void - actionPerformed(ActionEvent e) - { - about(); - } - }; - - _login = new AbstractAction("Login") - { - public void actionPerformed(ActionEvent e) - { - _coordinator.setState(Coordinator.ClientState.Disconnected); - _login.setEnabled(false); - } - }; - _login.setEnabled(false); - - _logout = new AbstractAction("Logout") - { - public void actionPerformed(ActionEvent e) - { - _logout.setEnabled(false); - _chatView.storeWindowPrefs(); - _coordinator.logout(); - } - }; - _logout.setEnabled(false); - - _exit = new AbstractAction("Exit") - { - public void actionPerformed(ActionEvent e) - { - _logout.setEnabled(false); - _chatView.storeWindowPrefs(); - _coordinator.exit(); - } - }; - _exit.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("alt F4")); - - DefaultListModel users = new DefaultListModel(); - _loginView = new LoginView(this, _prefs.node("Connection")); - _chatView = new ChatView(_prefs, users); - _statusBar = new StatusBarI(); - _coordinator = new Coordinator(this, _loginView, _chatView, users, args); - _chatView.setCoordinator(_coordinator); - _loginView.setCoordinator(_coordinator); - - FormLayout layout = new FormLayout("fill:pref:grow", "fill:pref:grow"); - DefaultFormBuilder builder = new DefaultFormBuilder(layout); - builder.add(_loginView); - builder.add(_chatView); - - setJMenuBar(new MenuBar()); - - JPanel panel = new JPanel(new BorderLayout()); - panel.add(builder.getPanel(), BorderLayout.CENTER); - panel.add(_statusBar, BorderLayout.PAGE_END); - setContentPane(panel); - - _coordinator.setState(Coordinator.ClientState.Disconnected); - - setSize(minWidth, minHeight); - if(!loadWindowPrefs()) - { - ChatDemoGUIFactory.locateOnScreen(this); - } - setVisible(true); - } - - public void setEnabled(boolean enabled) - { - _logout.setEnabled(enabled); - _login.setEnabled(!enabled); - } - - public void setConnected(boolean connected) - { - _statusBar.setConnected(connected); - } - - private void about() - { - String text = "Chat Demo.\nCopyright \u00A9 ZeroC, Inc. All rights reserved.\n"; - JOptionPane.showMessageDialog(this, text, "About", JOptionPane.INFORMATION_MESSAGE); - } - - private boolean loadWindowPrefs() - { - try - { - if(!_prefs.nodeExists("Window")) - { - return false; - } - } - catch(BackingStoreException e) - { - return false; - } - - Preferences windowPrefs = _prefs.node("Window"); - int x = windowPrefs.getInt("x", 0); - int y = windowPrefs.getInt("y", 0); - int width = windowPrefs.getInt("width", minWidth); - int height = windowPrefs.getInt("height", minHeight); - setBounds(new Rectangle(x, y, width, height)); - if(windowPrefs.getBoolean("maximized", false)) - { - setExtendedState(Frame.MAXIMIZED_BOTH); - } - return true; - } - - private void storeWindowPrefs() - { - Preferences windowPrefs = _prefs.node("Window"); - Rectangle rect = getBounds(); - windowPrefs.putInt("x", rect.x); - windowPrefs.putInt("y", rect.y); - windowPrefs.putInt("width", rect.width); - windowPrefs.putInt("height", rect.height); - windowPrefs.putBoolean("maximized", getExtendedState() == Frame.MAXIMIZED_BOTH); - } - - static public ImageIcon getIcon(String path) - { - java.net.URL imgURL = MainView.class.getResource(path); - if(imgURL == null) - { - return null; - } - else - { - return new ImageIcon(imgURL); - } - } - - private final Preferences _prefs; - private final Coordinator _coordinator; - private final LoginView _loginView; - private final ChatView _chatView; - private final StatusBarI _statusBar; - private final Action _login; - private final Action _logout; - private final Action _exit; - private final Action _about; - - // default size - private static final int minWidth = 400; - private static final int minHeight = 540; -} diff --git a/java/Chat/src/main/java/com/zeroc/demos/Chat/StatusBarI.java b/java/Chat/src/main/java/com/zeroc/demos/Chat/StatusBarI.java deleted file mode 100644 index e9498aa4c5..0000000000 --- a/java/Chat/src/main/java/com/zeroc/demos/Chat/StatusBarI.java +++ /dev/null @@ -1,37 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -package com.zeroc.demos.Chat; - -import java.awt.BorderLayout; - -import javax.swing.border.EmptyBorder; -import javax.swing.SwingConstants; -import javax.swing.JPanel; -import javax.swing.JLabel; - -public class StatusBarI extends JPanel -{ - StatusBarI() - { - super(new BorderLayout()); - setBorder(new EmptyBorder(7, 7, 7, 7)); - _connectedLabel.setHorizontalAlignment(SwingConstants.RIGHT); - add(_connectedLabel, BorderLayout.LINE_START); - } - - public void setConnected(boolean connected) - { - if(connected) - { - _connectedLabel.setText("Online"); - } - else - { - _connectedLabel.setText("Offline"); - } - } - - private final JLabel _connectedLabel = new JLabel("Offline"); -} diff --git a/java/Chat/src/main/resources/icons/128x128/chat.png b/java/Chat/src/main/resources/icons/128x128/chat.png deleted file mode 100644 index 9f20745c5f41dd748ffdb0b2c034fe99824b330a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8281 zcmbt)g;!h86K?{6AVEr@xVsgKI}|8hpb(@;ad(Fn3Big(fkJVLd!e{n(JxY@f#OaH z5ZvYE_uilI?m2sR@407p=JT1mGqZDUw6>-)0Ui||001CRRZ-MI_ptvp9BlNxU&dk# z-GRL1RiQZOD-g%}Gy0j*`;DQuuA8m5pM|Flz|YU`rGu-Jmz9OP%}X~=yR0KADgb~U zsjB!I>Ysg>^DmKQ=-W!jvjFIYxU}@L!h}2FL{i~;64M*FvuZ5XFRMlY201v3vw~5> zMX!?^CO#_oIOGSmGY^EKY2D4$xCz)Enx@>O?}T6J^~R~Vc=$U<45_eGq{77bzg!t) zjZ`0fy#TiWH?rm*UEAII?=(c#vy+aK0cvGiykgS3`Szst99Yo7%S&4GM5|TcrP%-H z;6DqhEMpTH0x4|kCMByRA)Ocn;$!K-gYX*dU!h%On*4!GJ zJ#t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&NJL2L<%ptO8Z`Yt9 zDQ_o^S>f~(=Pyz!N=R-lkw{2N3Q113EZTXCO7W=x0G|!s5~p|$sV7e9%gS(xl1rB? zF8dD~T>E47@IKNfNDBS1xU8HM6d=u!~l4i?Q@_kmIV*o z+W!|=uDllPz`qIqqzr(zuoi%8VJiUNLIZ%8g(iRyvyIyc0I_lh3&oH!+QwQgJ}X(s PC&XZ(7a^t)(u2PN`!0ps diff --git a/java/Chat/src/main/resources/icons/32x32/error.png b/java/Chat/src/main/resources/icons/32x32/error.png deleted file mode 100644 index ae1fd7d73a457ddfd85eb0b7db945f54f173d48d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1770 zcmVoVdRi!?36ILV95)$LuQQK@yJY#!2p1I38rw=pOF3H3h~F{*7aor!V%-gUz69AtSjxk?bp*=G z3F5MIp%4J^c&Xm* zxd##n$fSv*(Uqw8%X07~yc3ii!$q zYD#VI^TEhSaW>4(vArrx*zenA!9$-5U>v*-9ACSo*IQKvT)7Ov5VEy(Stk;S5R1jA ztgKuC091cJbalb?>v*jk80~O(_ueA2GG55-gq)+`2tFaC$Dpn5a zI(2n*M59q+vDor`t*i{|k%PRqaG5_{`GBU7pIBvRa{=!EOaQM!nSd8sw{66G=^XZz z1*~!}&iYib*H^7*G)jGa{Yo(cQcBd|PL_5Jl1odn*Z$6iH8Ifj6HkA_i2fLW3y)UC zV*_iOYbc!iGr|Dl8_z>c4B3I+6rCYJs>$=o}CL1{L%;Tq0o=G(TwFW!OqPmF*AN2AS+sm54i*S2t67sqiBLSWlAXV0ExVq$_^E{Bv7*L87S7ss}-3l>#Jj$&2^N#9r`EFIdz zm31GD!ZN_iki;;a>)5^tIdv8{D<}-@#oD|RCzHmu?Pc+JJe)amhT-91_U+rp*w`4R zX)Zr^90z+YgOTbYboel?3)gP^litbzUS0qCQP}n|00)l8Th~S+T8_fZMP$Ha@qs6> zEE`J-Y^iWmQSy#MT_QnGUmxwM4jP+Vu!O*ta+N5oTn_*KgP74OG7C23mq>+z-qjx} zv*dk;G|dC4%^ld2zr&HBl)#v|fYZ=|g#_0|+Fnf4#K|ww*3!&dZ=OcDF5&7hv)8T` zYoL@S+qQAgD10!9o41j`mCOR&HPyVAHNHG5#O^WpwFdAL_-Xsr-p6~ILM;5@H%J|% z0N3>5CfblnLn#pGC_pL=iH2c#kP0l@K`0PPA(X;ZAf!a1Q@A*dvyesVUD-{S3N}>cPRWvA7QCCP1s(6hA zR8hxkXc*-tQh=!`=JOVH6+V2Lwh^U@DG*Y=d-1|dlhJ+$ZnZ!OiF5@@N|aPcA&^oc zg+vL7CMCKMAd7oVNDLv7QlLapU#-%Ya>br5B~zA-qtx_r4e0Rg3+JXhlhgm`RhlM+ zQc406g+fCrRg4O%lnRQeKoz|%4Ix=_UZ9Zb!+l9tsSn4MVM{fo!MFJT0{#WNx%35O zBF -#include -#include - -["java:package:com.zeroc.demos"] -module Chat -{ - -/** - * - * The ChatRoomCallback interface is the interface that clients implement - * as their callback object. - * - * The server calls operations of this interface to communicate - * with connected clients. - * - **/ -interface ChatRoomCallback -{ - /** - * - * The server invokes this operation when the client sets the callback - * for a session. This provides the client with the initial list of users - * currently in the chat room. - * - * @param users The names of users currently in the chat room. - * - **/ - void init(Ice::StringSeq users); - - /** - * - * The server invokes this operation to deliver a message - * that was sent to the chat room. - * - * @param name The name of the user that send the message. - * - * @param message The contents of the message. - * - * @param timestamp The time at which the message was sent. - * - **/ - void send(long timestamp, string name, string message); - - /** - * - * The server invokes this operation when a user joins - * the chat room. - * - * @param name The name of the user that joined the chat room. - * - * @param timestamp The time at which the user joined the chat room. - * - **/ - void join(long timestamp, string name); - - /** - * - * The servers invokes this operation when a user leaves - * the chat room. - * - * @param name The name of the user that left the chat room. - * - * @param timestamp The time at which the user left the chat room. - * - **/ - void leave(long timestamp, string name); -} - -/** - * - * A ChatSession is a custom Glacier2::Session for clients that use - * Glacier2 and support callbacks (C++, Java, and .NET clients). - * - * @see Glacier2::Session - * - **/ -interface ChatSession extends Glacier2::Session -{ - /** - * - * The setCallback operation is called by clients to set the - * callback used to receive notification of activity in the - * room. Clients receive notifications as soon as they call this - * operation (before setCallback returns). - * - * The first callback made by the server is a call to - * ChatRoomCallback::init, which delivers the current list of - * users to the client. - * - * @param cb The callback the server uses to deliver notifications. - * - * @see ChatRoomCallback - * - **/ - void setCallback(ChatRoomCallback* cb); - - /** - * - * Send a message to the chat room. - * - * @param message The message to be sent. - * - * @return The time at which the message is sent. - * - * @throws InvalidMessageException should the message be invalid. - * - **/ - long send(string message) throws InvalidMessageException; -} - -} diff --git a/java/Glacier2/README.md b/java/Glacier2/README.md index a97385621c..9cc549a3ad 100644 --- a/java/Glacier2/README.md +++ b/java/Glacier2/README.md @@ -4,8 +4,3 @@ Demos in this directory: Illustrates how to allow a server to call back into a client via a Glacier2 connection. - -- [simpleChat](./simpleChat) - - A swing application that shows how to use write a graphical Glacier2 - simple chat client. diff --git a/java/Glacier2/build.gradle b/java/Glacier2/build.gradle index 552fdab99e..ef74b9a8cb 100644 --- a/java/Glacier2/build.gradle +++ b/java/Glacier2/build.gradle @@ -2,7 +2,7 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -['callback', 'simpleChat'].each { +['callback'].each { def name = it project(":demoGlacier2${it.capitalize()}") { slice { @@ -30,10 +30,6 @@ jar.enabled = false demoJar("client") - - // The simpleChat demo has no serverJar. - if(name != "simpleChat") { - demoJar("server") - } + demoJar("server") } } diff --git a/java/Glacier2/simpleChat/Chat.ice b/java/Glacier2/simpleChat/Chat.ice deleted file mode 100644 index 34e7ad8157..0000000000 --- a/java/Glacier2/simpleChat/Chat.ice +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -["java:package:com.zeroc.demos.Glacier2.simpleChat"] -module Demo -{ - interface ChatCallback - { - void message(string data); - } - - interface ChatSession extends Glacier2::Session - { - void setCallback(ChatCallback* callback); - void say(string data); - } -} diff --git a/java/Glacier2/simpleChat/Client.java b/java/Glacier2/simpleChat/Client.java deleted file mode 100644 index c28dc5c29f..0000000000 --- a/java/Glacier2/simpleChat/Client.java +++ /dev/null @@ -1,492 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import javax.swing.BoxLayout; -import javax.swing.JDialog; -import javax.swing.AbstractAction; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JPasswordField; -import javax.swing.JPopupMenu; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JSplitPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.ScrollPaneConstants; -import javax.swing.SwingConstants; -import javax.swing.SwingUtilities; -import javax.swing.WindowConstants; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.DefaultEditorKit; -import javax.swing.text.Document; -import javax.swing.text.Element; - -import com.zeroc.demos.Glacier2.simpleChat.Demo.*; -import com.zeroc.Glacier2.SessionFactoryHelper; -import com.zeroc.Glacier2.SessionHelper; -import com.zeroc.Glacier2.SessionCallback; -import com.zeroc.Glacier2.SessionNotExistException; -import com.zeroc.Ice.Current; -import com.zeroc.Ice.LocalException; -import com.zeroc.Ice.Util; - -@SuppressWarnings("serial") -public class Client extends JFrame -{ - public static void main(final String[] args) - { - SwingUtilities.invokeLater(() -> - { - try - { - // - // Create and set up the window. - // - new Client(args); - } - catch(com.zeroc.Ice.LocalException e) - { - JOptionPane.showMessageDialog(null, e.toString(), "Initialization failed", JOptionPane.ERROR_MESSAGE); - } - }); - } - - Client(String[] args) - { - // Build the JTextArea that shows the chat conversation. - _output = new JTextArea(""); - _output.setLineWrap(true); - _output.setEditable(false); - - final JPopupMenu textMenu = new JPopupMenu(); - textMenu.add(new DefaultEditorKit.CopyAction()); - textMenu.pack(); - - _output.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - if(e.isPopupTrigger()) - { - textMenu.show(_output, e.getX(), e.getY()); - } - } - }); - - // Build the JTextArea where the user writes input messages. - _input = new JTextArea(""); - _input.setLineWrap(true); - _input.setEditable(true); - _input.addKeyListener(new KeyListener() - { - @Override - public void keyTyped(KeyEvent e) - { - if(e.getKeyChar() == KeyEvent.VK_ENTER) - { - Document doc = _input.getDocument(); - try - { - String msg = doc.getText(0, doc.getLength()).trim(); - if(msg.length() > 0) - { - _chat.sayAsync(msg).whenCompleteAsync((result, ex) -> - { - if(ex != null) - { - appendMessage(" - " + ex); - } - }, - _chat.ice_executor()); - } - } - catch(BadLocationException e1) - { - } - - _input.setText(""); - } - } - - @Override - public void keyPressed(KeyEvent e) - { - } - - @Override - public void keyReleased(KeyEvent e) - { - } - }); - - _outputScroll = new JScrollPane(_output); - _outputScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - _outputScroll.setBorder(null); - - _outputScroll.setMinimumSize(new Dimension(100, 100)); - _outputScroll.setPreferredSize(new Dimension(100, 100)); - - JSplitPane verticalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT); - verticalSplit.setTopComponent(_outputScroll); - - JScrollPane conversationInputScroll = new JScrollPane(_input); - conversationInputScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - conversationInputScroll.setBorder(null); - - conversationInputScroll.setMinimumSize(new Dimension(100, 100)); - conversationInputScroll.setPreferredSize(new Dimension(100, 100)); - verticalSplit.setBottomComponent(conversationInputScroll); - - verticalSplit.setResizeWeight(0.9); - - _output.addComponentListener(new ComponentListener() - { - @Override - public void componentResized(ComponentEvent e) - { - JScrollBar vertivalScrollbar = _outputScroll.getVerticalScrollBar(); - vertivalScrollbar.setValue(vertivalScrollbar.getMaximum()); - } - - @Override - public void componentHidden(ComponentEvent e) - { - } - - @Override - public void componentMoved(ComponentEvent e) - { - } - - @Override - public void componentShown(ComponentEvent e) - { - } - }); - - add(verticalSplit, BorderLayout.CENTER); - - JPanel statusPanel = new JPanel(); - JSeparator statusPanelSeparator = new JSeparator(); - _status = new JLabel(); - _status.setText("Not connected"); - - statusPanel.add(statusPanelSeparator, BorderLayout.NORTH); - statusPanel.add(_status, BorderLayout.SOUTH); - - add(statusPanel, BorderLayout.SOUTH); - - JMenuBar menuBar = new JMenuBar(); - JMenu connectMenu = new JMenu("Session"); - - _login = new AbstractAction("Login") - { - @Override - public void actionPerformed(ActionEvent e) - { - login(); - } - }; - - _logout = new AbstractAction("Logout") - { - @Override - public void actionPerformed(ActionEvent e) - { - setEnabled(false); - _status.setText("Logging out"); - destroySession(); - _chat = null; - } - }; - _logout.setEnabled(false); - - _exit = new AbstractAction("Exit") - { - @Override - public void actionPerformed(ActionEvent e) - { - exit(); - } - }; - - connectMenu.add(_login); - connectMenu.add(_logout); - if(!System.getProperty("os.name").startsWith("Mac OS")) - { - connectMenu.add(_exit); - } - - menuBar.add(connectMenu); - - setJMenuBar(menuBar); - - setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - - addWindowListener(new WindowAdapter() - { - @Override - public void windowClosing(WindowEvent e) - { - exit(); - } - }); - - pack(); - setSize(640, 480); - locateOnScreen(this); - setVisible(true); - - // Create the labels and text fields. - JLabel hostLabel = new JLabel("Host: ", SwingConstants.RIGHT); - _hostField = new JTextField("", 12); - _hostField.setText("127.0.0.1"); - JLabel userNameLabel = new JLabel("Username: ", SwingConstants.RIGHT); - _userNameField = new JTextField("", 12); - _userNameField.setText("test"); - JLabel passwordLabel = new JLabel("Password: ", SwingConstants.RIGHT); - _passwordField = new JPasswordField("", 12); - _connectionPanel = new JPanel(false); - _connectionPanel.setLayout(new BoxLayout(_connectionPanel, BoxLayout.X_AXIS)); - - JPanel labelPanel = new JPanel(false); - labelPanel.setLayout(new GridLayout(0, 1)); - labelPanel.add(hostLabel); - labelPanel.add(userNameLabel); - labelPanel.add(passwordLabel); - JPanel fieldPanel = new JPanel(false); - fieldPanel.setLayout(new GridLayout(0, 1)); - fieldPanel.add(_hostField); - fieldPanel.add(_userNameField); - fieldPanel.add(_passwordField); - _connectionPanel.add(labelPanel); - _connectionPanel.add(fieldPanel); - - _input.setEnabled(false); - - com.zeroc.Ice.InitializationData initData = new com.zeroc.Ice.InitializationData(); - - // Load the configuration file. - initData.properties = new com.zeroc.Ice.Properties(); - initData.properties.load("config.client"); - initData.properties.setProperty("Ice.Default.Package", "com.zeroc.demos.Glacier2.simpleChat"); - initData.properties = new com.zeroc.Ice.Properties(args, initData.properties); - - // Setup a dispatcher to dispath Ice and Glacier2 helper callbacks to the GUI thread. - initData.dispatcher = (runnable, connection) -> - { - SwingUtilities.invokeLater(runnable); - }; - - _factory = new SessionFactoryHelper(initData, new SessionCallback() - { - @Override - public void connected(SessionHelper session) - throws SessionNotExistException - { - // If the session has been reassigned avoid the spurious callback. - if(session != _session) - { - return; - } - - // The chat callback servant. We use an anonymous - // inner class since the implementation is very - // simple. - ChatCallback servant = new ChatCallback() - { - @Override - public void message(final String data, Current current) - { - appendMessage(data); - } - }; - - ChatCallbackPrx callback = ChatCallbackPrx.uncheckedCast(_session.addWithUUID(servant)); - - _chat = ChatSessionPrx.uncheckedCast(_session.session()); - _chat.setCallbackAsync(callback).whenCompleteAsync((result, ex) -> - { - if(ex == null) - { - assert _loginDialog != null; - _loginDialog.dispose(); - - _login.setEnabled(false); - _logout.setEnabled(true); - - _input.setEnabled(true); - - _status.setText("Connected with " + _hostField.getText()); - } - else - { - destroySession(); - } - }, - _chat.ice_executor()); - } - - @Override - public void disconnected(SessionHelper session) - { - // If the session has been reassigned avoid the spurious callback. - if(session != _session) - { - return; - } - - if(_loginDialog != null) - { - _loginDialog.dispose(); - } - - _session = null; - _chat = null; - - _login.setEnabled(true); - _logout.setEnabled(false); - - _input.setEnabled(false); - _status.setText("Not connected"); - } - - @Override - public void connectFailed(SessionHelper session, Throwable ex) - { - // If the session has been reassigned avoid the - // spurious callback. - if(session != _session) - { - return; - } - - if(_loginDialog != null) - { - _loginDialog.dispose(); - } - _status.setText(ex.getClass().getName()); - } - - @Override - public void createdCommunicator(SessionHelper session) - { - } - }); - _factory.setRouterIdentity(new com.zeroc.Ice.Identity("router", "DemoGlacier2")); - - login(); - } - - protected void login() - { - String[] options = {"Login", "Cancel" }; - // Show Login Dialog. - int option = JOptionPane.showOptionDialog(this, _connectionPanel, "Login", JOptionPane.OK_CANCEL_OPTION, - JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); - - if(option == 0) - { - _factory.setRouterHost(_hostField.getText()); - // Connect to Glacier2 using SessionFactoryHelper - _session = _factory.connect(_userNameField.getText(), _passwordField.getText()); - String[] cancel = { "Cancel" }; - - // Show Connecting Dialog - JOptionPane pane = new JOptionPane("Please wait while connecting...", JOptionPane.INFORMATION_MESSAGE, - JOptionPane.DEFAULT_OPTION, null, cancel, cancel[0]); - _loginDialog = pane.createDialog(this, "Connecting"); - _loginDialog.setVisible(true); - - // User pressed cancel. - if(pane.getValue() != JOptionPane.UNINITIALIZED_VALUE) - { - // Destroy session - destroySession(); - } - } - } - - private void destroySession() - { - if(_session != null) - { - _session.destroy(); - //The session will be set to null on disconnected. - } - } - - private void exit() - { - destroySession(); - dispose(); - Runtime.getRuntime().exit(0); - } - - public void appendMessage(String message) - { - Document doc = _output.getDocument(); - Element e = doc.getDefaultRootElement(); - AttributeSet attr = e.getAttributes().copyAttributes(); - try - { - doc.insertString(doc.getLength(), message + "\n", attr); - } - catch(BadLocationException ex) - { - } - _output.setCaretPosition(doc.getLength()); - } - - private static void locateOnScreen(Component component) - { - Dimension paneSize = component.getSize(); - Dimension screenSize = component.getToolkit().getScreenSize(); - component.setLocation((screenSize.width - paneSize.width) / 2, (screenSize.height - paneSize.height) / 2); - } - - private JLabel _status; - private JTextArea _output; - private JTextArea _input; - private JScrollPane _outputScroll; - - // Login/Logout actions. - private AbstractAction _login; - private AbstractAction _logout; - private AbstractAction _exit; - - // Login dialog - private JDialog _loginDialog; - private JTextField _userNameField; - private JTextField _passwordField; - private JTextField _hostField; - private JPanel _connectionPanel; - - // The session factory and current session. - private SessionFactoryHelper _factory; - private SessionHelper _session; - private ChatSessionPrx _chat; -} diff --git a/java/Glacier2/simpleChat/README.md b/java/Glacier2/simpleChat/README.md deleted file mode 100644 index 829681c8a1..0000000000 --- a/java/Glacier2/simpleChat/README.md +++ /dev/null @@ -1,21 +0,0 @@ -This demo demonstrates the use of [Glacier2 session helpers][1] and Swing -to create a graphical client for the simple chat server. - -First follow the instructions in the C++ Glacier2 simpleChat demo -README to start the server and the Glacier2 router. - -In a separate window, start the swing client: - -``` -java -jar build/libs/client.jar -``` - -If you plan to run this demo using clients running on different hosts -than the glacier2router, it is necessary to first modify the -configuration. You need to change the `Glacier2.Client.Endpoints` -property in `config.glacier2` and the `Ice.Default.Router` property in -`config.client`. In all cases you must set the host parameter of the -`-h host` endpoint option to the actual external address of the machine -on which glacier2router is running. - -[1]: https://doc.zeroc.com/ice/3.7/ice-services/glacier2/glacier2-sessionhelper-class diff --git a/java/Glacier2/simpleChat/config.client b/java/Glacier2/simpleChat/config.client deleted file mode 100644 index e3083191fb..0000000000 --- a/java/Glacier2/simpleChat/config.client +++ /dev/null @@ -1,46 +0,0 @@ -# -# Warn about connection exceptions -# -#Ice.Warn.Connections=1 - -# -# Network Tracing -# -# 0 = no network tracing -# 1 = trace connection establishment and closure -# 2 = like 1, but more detailed -# 3 = like 2, but also trace data transfer -# -#Ice.Trace.Network=1 - -# -# Protocol Tracing -# -# 0 = no protocol tracing -# 1 = trace protocol messages -# -#Ice.Trace.Protocol=1 - -# -# Security Tracing -# -# 0 = no security tracing -# 1 = trace messages -# -#IceSSL.Trace.Security=1 - -# -# SSL Configuration -# -Ice.Plugin.IceSSL=com.zeroc.IceSSL.PluginFactory -IceSSL.DefaultDir=../../../certs -IceSSL.Keystore=client.jks -IceSSL.Password=password - -# -# IceMX configuration. -# -#Ice.Admin.Endpoints=tcp -h localhost -p 10004 -Ice.Admin.InstanceName=client -IceMX.Metrics.Debug.GroupBy=id -IceMX.Metrics.ByParent.GroupBy=parent diff --git a/java/README.md b/java/README.md index 33a082d6e3..72af4f6c14 100644 --- a/java/README.md +++ b/java/README.md @@ -15,8 +15,6 @@ following additional subdirectories: - [Manual](./Manual) contains complete examples for some of the code snippets in the [Ice manual][1]. -- [Chat](./Chat) contains a GUI client for the ZeroC [Chat Demo][2]. - Refer to the [C++11 demos](../cpp11) for more examples that use the Ice services (Glacier2, IceGrid, IceStorm). @@ -113,4 +111,3 @@ Follow these steps to open the project in Android Studio: Refer to the README.md file in each demo directory for usage instructions. [1]: https://doc.zeroc.com/ice/3.7/introduction -[2]: https://doc.zeroc.com/technical-articles/general-topics/chat-demo diff --git a/java/settings.gradle b/java/settings.gradle index 63006eef25..bb3f422233 100644 --- a/java/settings.gradle +++ b/java/settings.gradle @@ -10,7 +10,7 @@ def demos = [ 'session', 'swing', 'throughput', 'optional', 'context'], 'IceDiscovery' : ['hello', 'replication'], 'IceBox' : ['hello'], - 'Glacier2' : ['callback', 'simpleChat'], + 'Glacier2' : ['callback'], 'IceStorm' : ['clock'], 'IceGrid' : ['icebox', 'simple'], 'Manual' : ['printer', 'simpleFilesystem'] @@ -32,6 +32,3 @@ demos.each { project("${projectName}").projectDir = new File("${dir}/${it}") } } - -include ":demoChat" -project(":demoChat").projectDir = new File("Chat")