bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
Map getRestrictedClassMap () { return _restrictedClasses; }
|
Map getRestrictedClassMap () { return _restrictedClasses; }
| 3,231,419
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
| 3,231,420
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
| 3,231,421
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
| 3,231,422
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
| 3,231,423
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
|
final public void init (Broker b, Settings config) throws InitException { String cacheManager; _log = b.getLog("resource", "Object loading and caching"); cacheManager = b.getSetting("PropertyOperator.CacheManager"); if (cacheManager == null || cacheManager.equals("")) { _log.info("CachingProvider: No cache manager specified for PropertyOperator, using SimpleCacheManager"); _cache = new SimpleCacheManager(); } else { try { _cache = (CacheManager) b.classForName(cacheManager).newInstance(); } catch (Exception e) { _log.warning("Unable to load cache manager " + cacheManager + " for PropertyOperator, using SimpleCacheManager. Reason:\n" + e); _cache = new SimpleCacheManager(); } } _cache.init(b, config, "PropertyOperator"); _restrictedClasses = new HashMap(11); String restrictList = b.getSetting("RestrictedClasses"); if (restrictList != null) { StringTokenizer stok = new StringTokenizer(restrictList, ","); while (stok.hasMoreTokens()) { String className = stok.nextToken(); try { Class c = Class.forName(className); String okMethList = b.getSetting("RestrictedClasses.AllowedMethods." + className); ArrayList okMeths = null; if (okMethList != null) { okMeths = new ArrayList(20); StringTokenizer stok2 = new StringTokenizer(okMethList, ","); while (stok2.hasMoreTokens()) { okMeths.add(stok2.nextToken()); } } _restrictedClasses.put(c, okMeths); } catch (Exception e) { _log.error("Configuration error: restricted class " + className + " cannot be loaded", e); } } } }
| 3,231,424
|
final public boolean setProperty (final Context context, Object instance, final Object[] names, int start, final Object value) throws PropertyException, SecurityException { try { if (instance == null) { return false; } return getOperator(instance) .setProperty(context, instance, names, value, start); } catch (PropertyException e) { throw e; } catch (NoSuchMethodException e) { throw new PropertyException("No method to access property: " + e, e); } }
|
final public boolean setProperty (final Context context, Object instance, final Object[] names, int start, final Object value) throws PropertyException, SecurityException { try { if (instance == null) { return false; } return getOperator(instance) .setProperty(context, instance, names, value, start); } catch (PropertyException e) { throw e; } catch (NoSuchMethodException e) { throw new PropertyException("No method to access property: " + e, e); } }
| 3,231,425
|
UnaryMethodAccessor (final String name, final Method m, final Class[] params) throws PropertyException { super(name, m, params); }
|
UnaryMethodAccessor (final String name, final Method m, final Class[] params) throws PropertyException { super(name, m, params); }
| 3,231,426
|
final Object get (final Object instance) throws PropertyException, NoSuchMethodException { return PropertyOperator.invoke(_getMethod, instance, null); }
|
final Object get (final Object instance) throws PropertyException, NoSuchMethodException { return PropertyOperator.invoke(_getMethod, instance, null); }
| 3,231,427
|
final int numArgsGet () { return 0; }
|
final int numArgsGet () { return 0; }
| 3,231,428
|
final int numArgsSet () { return 1; }
|
final int numArgsSet () { return 1; }
| 3,231,429
|
final boolean set (final Object instance, final Object value) throws PropertyException, NoSuchMethodException { Object[] args = {value}; return setImpl(instance, args); }
|
final boolean set (final Object instance, final Object value) throws PropertyException, NoSuchMethodException { Object[] args = {value}; return setImpl(instance, args); }
| 3,231,430
|
private void retrieveNotes() { final PrivateNotes privateNotes = PrivateNotes.getPrivateNotes(); String text = privateNotes.getNotes(); final JLabel titleLabel = new JLabel("Notepad"); titleLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 13)); titleLabel.setHorizontalAlignment(JLabel.CENTER); final Image backgroundImage = SparkRes.getImageIcon(SparkRes.STICKY_NOTE_IMAGE).getImage(); final JTextPane pane = new JTextPane(); pane.setOpaque(false); final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(null); pane.setText(text); final RolloverButton button = new RolloverButton("Save", null); final RolloverButton cancelButton = new RolloverButton("Cancel", null); final JFrame frame = new JFrame("Notes"); frame.setUndecorated(true); titleLabel.addMouseMotionListener(new DragWindowAdapter(frame)); final JPanel mainPanel = new JPanel() { public void paintComponent(Graphics g) { double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } }; pane.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } } }); mainPanel.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); frame.setIconImage(SparkManager.getMainWindow().getIconImage()); frame.getContentPane().add(mainPanel); mainPanel.add(titleLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(scrollPane, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(button, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(cancelButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); frame.pack(); frame.setSize(400, 400); GraphicUtils.centerWindowOnComponent(frame, SparkManager.getMainWindow()); frame.setVisible(true); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); } }); }
|
private void retrieveNotes() { final PrivateNotes privateNotes = PrivateNotes.getPrivateNotes(); String text = privateNotes.getNotes(); final JLabel titleLabel = new JLabel("Notepad"); titleLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 13)); titleLabel.setHorizontalAlignment(JLabel.CENTER); final Image backgroundImage = SparkRes.getImageIcon(SparkRes.STICKY_NOTE_IMAGE).getImage(); final JTextPane pane = new JTextPane(); pane.setOpaque(false); final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(null); pane.setText(text); final RolloverButton button = new RolloverButton("Save", null); final RolloverButton cancelButton = new RolloverButton("Cancel", null); final JFrame frame = new JFrame("Notes"); frame.setUndecorated(true); titleLabel.addMouseMotionListener(new DragWindowAdapter(frame)); final JPanel mainPanel = new JPanel() { public void paintComponent(Graphics g) { double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } }; pane.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } } }); mainPanel.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); frame.setIconImage(SparkManager.getMainWindow().getIconImage()); frame.getContentPane().add(mainPanel); mainPanel.add(titleLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(scrollPane, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(button, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(cancelButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); frame.pack(); frame.setSize(400, 400); GraphicUtils.centerWindowOnComponent(frame, SparkManager.getMainWindow()); frame.setVisible(true); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); } }); }
| 3,231,431
|
private void retrieveNotes() { final PrivateNotes privateNotes = PrivateNotes.getPrivateNotes(); String text = privateNotes.getNotes(); final JLabel titleLabel = new JLabel("Notepad"); titleLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 13)); titleLabel.setHorizontalAlignment(JLabel.CENTER); final Image backgroundImage = SparkRes.getImageIcon(SparkRes.STICKY_NOTE_IMAGE).getImage(); final JTextPane pane = new JTextPane(); pane.setOpaque(false); final JScrollPane scrollPane = new JScrollPane(pane, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(null); pane.setText(text); final RolloverButton button = new RolloverButton("Save", null); final RolloverButton cancelButton = new RolloverButton("Cancel", null); final JFrame frame = new JFrame("Notes"); frame.setUndecorated(true); titleLabel.addMouseMotionListener(new DragWindowAdapter(frame)); final JPanel mainPanel = new JPanel() { public void paintComponent(Graphics g) { double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleY = getHeight() / (double)backgroundImage.getHeight(null); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); ((Graphics2D)g).drawImage(backgroundImage, xform, this); } }; pane.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } } }); mainPanel.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); frame.setIconImage(SparkManager.getMainWindow().getIconImage()); frame.getContentPane().add(mainPanel); mainPanel.add(titleLabel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(scrollPane, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(button, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add(cancelButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); frame.pack(); frame.setSize(400, 400); GraphicUtils.centerWindowOnComponent(frame, SparkManager.getMainWindow()); frame.setVisible(true); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); // Save it. String text = pane.getText(); privateNotes.setNotes(text); PrivateNotes.savePrivateNotes(privateNotes); } }); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { frame.dispose(); } }); }
|
pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); privatepane.setCaretPosition(0); voidpane.setCaretPosition(0); retrieveNotes()pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); PrivateNotespane.setCaretPosition(0); privateNotespane.setCaretPosition(0); =pane.setCaretPosition(0); PrivateNotes.getPrivateNotes();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); Stringpane.setCaretPosition(0); textpane.setCaretPosition(0); =pane.setCaretPosition(0); privateNotes.getNotes();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); JLabelpane.setCaretPosition(0); titleLabelpane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); JLabel("Notepad");pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); titleLabel.setBorder(BorderFactory.createMatteBorder(0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); Color.LIGHT_GRAY));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); titleLabel.setFont(newpane.setCaretPosition(0); Font("Dialog",pane.setCaretPosition(0); Font.BOLD,pane.setCaretPosition(0); 13));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); titleLabel.setHorizontalAlignment(JLabel.CENTER);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); Imagepane.setCaretPosition(0); backgroundImagepane.setCaretPosition(0); =pane.setCaretPosition(0); SparkRes.getImageIcon(SparkRes.STICKY_NOTE_IMAGE).getImage();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); JTextPanepane.setCaretPosition(0); panepane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); JTextPane();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setOpaque(false);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); JScrollPanepane.setCaretPosition(0); scrollPanepane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); JScrollPane(pane,pane.setCaretPosition(0); JScrollPane.VERTICAL_SCROLLBAR_NEVER,pane.setCaretPosition(0); JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); scrollPane.setOpaque(false);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); scrollPane.getViewport().setOpaque(false);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); scrollPane.setBorder(null);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setText(text);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); RolloverButtonpane.setCaretPosition(0); buttonpane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); RolloverButton("Save",pane.setCaretPosition(0); null);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); RolloverButtonpane.setCaretPosition(0); cancelButtonpane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); RolloverButton("Cancel",pane.setCaretPosition(0); null);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); JFramepane.setCaretPosition(0); framepane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); JFrame("Notes");pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.setUndecorated(true);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); titleLabel.addMouseMotionListener(newpane.setCaretPosition(0); DragWindowAdapter(frame));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); finalpane.setCaretPosition(0); JPanelpane.setCaretPosition(0); mainPanelpane.setCaretPosition(0); =pane.setCaretPosition(0); newpane.setCaretPosition(0); JPanel()pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); publicpane.setCaretPosition(0); voidpane.setCaretPosition(0); paintComponent(Graphicspane.setCaretPosition(0); g)pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); doublepane.setCaretPosition(0); scaleXpane.setCaretPosition(0); =pane.setCaretPosition(0); getWidth()pane.setCaretPosition(0); /pane.setCaretPosition(0); (double)backgroundImage.getWidth(null);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); doublepane.setCaretPosition(0); scaleYpane.setCaretPosition(0); =pane.setCaretPosition(0); getHeight()pane.setCaretPosition(0); /pane.setCaretPosition(0); (double)backgroundImage.getHeight(null);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); AffineTransformpane.setCaretPosition(0); xformpane.setCaretPosition(0); =pane.setCaretPosition(0); AffineTransform.getScaleInstance(scaleX,pane.setCaretPosition(0); scaleY);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); ((Graphics2D)g).drawImage(backgroundImage,pane.setCaretPosition(0); xform,pane.setCaretPosition(0); this);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); }pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); };pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.addKeyListener(newpane.setCaretPosition(0); KeyAdapter()pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); publicpane.setCaretPosition(0); voidpane.setCaretPosition(0); keyReleased(KeyEventpane.setCaretPosition(0); e)pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); ifpane.setCaretPosition(0); (e.getKeyChar()pane.setCaretPosition(0); ==pane.setCaretPosition(0); KeyEvent.VK_ESCAPE)pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.dispose();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); //pane.setCaretPosition(0); Savepane.setCaretPosition(0); it.pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); Stringpane.setCaretPosition(0); textpane.setCaretPosition(0); =pane.setCaretPosition(0); pane.getText();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); privateNotes.setNotes(text);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); PrivateNotes.savePrivateNotes(privateNotes);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); }pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); }pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); });pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); mainPanel.setBackground(Color.white);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); mainPanel.setLayout(newpane.setCaretPosition(0); GridBagLayout());pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.setIconImage(SparkManager.getMainWindow().getIconImage());pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.getContentPane().add(mainPanel);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); mainPanel.add(titleLabel,pane.setCaretPosition(0); newpane.setCaretPosition(0); GridBagConstraints(0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 3,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 1.0,pane.setCaretPosition(0); 0.0,pane.setCaretPosition(0); GridBagConstraints.WEST,pane.setCaretPosition(0); GridBagConstraints.HORIZONTAL,pane.setCaretPosition(0); newpane.setCaretPosition(0); Insets(0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0),pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); mainPanel.add(scrollPane,pane.setCaretPosition(0); newpane.setCaretPosition(0); GridBagConstraints(0,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 3,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 1.0,pane.setCaretPosition(0); 1.0,pane.setCaretPosition(0); GridBagConstraints.WEST,pane.setCaretPosition(0); GridBagConstraints.BOTH,pane.setCaretPosition(0); newpane.setCaretPosition(0); Insets(0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0),pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); mainPanel.add(button,pane.setCaretPosition(0); newpane.setCaretPosition(0); GridBagConstraints(1,pane.setCaretPosition(0); 2,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 1.0,pane.setCaretPosition(0); 0.0,pane.setCaretPosition(0); GridBagConstraints.EAST,pane.setCaretPosition(0); GridBagConstraints.NONE,pane.setCaretPosition(0); newpane.setCaretPosition(0); Insets(0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0),pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); mainPanel.add(cancelButton,pane.setCaretPosition(0); newpane.setCaretPosition(0); GridBagConstraints(2,pane.setCaretPosition(0); 2,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 1,pane.setCaretPosition(0); 0.0,pane.setCaretPosition(0); 0.0,pane.setCaretPosition(0); GridBagConstraints.EAST,pane.setCaretPosition(0); GridBagConstraints.NONE,pane.setCaretPosition(0); newpane.setCaretPosition(0); Insets(0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0),pane.setCaretPosition(0); 0,pane.setCaretPosition(0); 0));pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.pack();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.setSize(400,pane.setCaretPosition(0); 400);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); GraphicUtils.centerWindowOnComponent(frame,pane.setCaretPosition(0); SparkManager.getMainWindow());pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.setVisible(true);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); button.addActionListener(newpane.setCaretPosition(0); ActionListener()pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); publicpane.setCaretPosition(0); voidpane.setCaretPosition(0); actionPerformed(ActionEventpane.setCaretPosition(0); actionEvent)pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.dispose();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); //pane.setCaretPosition(0); Savepane.setCaretPosition(0); it.pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); Stringpane.setCaretPosition(0); textpane.setCaretPosition(0); =pane.setCaretPosition(0); pane.getText();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); privateNotes.setNotes(text);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); PrivateNotes.savePrivateNotes(privateNotes);pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); }pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); });pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); cancelButton.addActionListener(newpane.setCaretPosition(0); ActionListener()pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); publicpane.setCaretPosition(0); voidpane.setCaretPosition(0); actionPerformed(ActionEventpane.setCaretPosition(0); actionEvent)pane.setCaretPosition(0); {pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); frame.dispose();pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); }pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); });pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); pane.setCaretPosition(0); }
| 3,231,432
|
public RubyObject eval(Ruby ruby, RubyObject self) { return StringEvaluate.eval(ruby, self, this); }
|
public RubyObject eval(Ruby ruby, RubyObject self) { if (simple) { return getLiteral().to_s(); } else { return StringEvaluate.eval(ruby, self, this); } }
| 3,231,433
|
public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } }
|
public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } }
| 3,231,434
|
public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } }
|
public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: model.setPlayerState(Player.PAUSE); break; case STOP_CMD: model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } }
| 3,231,435
|
public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: view.setMoviePlay(false); model.setPlayerState(Player.PAUSE); break; case STOP_CMD: view.setMoviePlay(false); model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } }
|
public void actionPerformed(ActionEvent ae) { try { int index = Integer.parseInt(ae.getActionCommand()); switch (index) { case START_T: movieStartActionHandler(view.startT, view.endT, TYPE_T); break; case END_T: movieEndActionHandler(view.startT, view.endT, TYPE_T); break; case START_Z: movieStartActionHandler(view.startZ, view.endZ, TYPE_Z); break; case END_Z: movieEndActionHandler(view.startZ, view.endZ, TYPE_Z); break; case ACROSS_T_CMD: model.setMovieIndex(MoviePlayer.ACROSS_T); break; case ACROSS_Z_CMD: model.setMovieIndex(MoviePlayer.ACROSS_Z); break; case ACROSS_ZT_CMD: model.setMovieIndex(MoviePlayer.ACROSS_ZT); break; case PLAY_CMD: view.setMoviePlay(true); model.setPlayerState(Player.START); break; case PAUSE_CMD: model.setPlayerState(Player.PAUSE); break; case STOP_CMD: model.setPlayerState(Player.STOP); break; case EDITOR_CMD: editorActionHandler(); break; case MOVIE_TYPE_CMD: int i = ((JComboBox) ae.getSource()).getSelectedIndex(); model.setMovieType(view.getMovieType(i)); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+ae.getActionCommand(), nfe); } }
| 3,231,436
|
void visitCollection(Collection collection) throws BeansException;
|
void visitCollection(Collection collection) throws BeansException;
| 3,231,441
|
void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues) throws BeansException;
|
void visitConstructorArgumentValues(ConstructorArgumentValues constructorArgumentValues) throws BeansException;
| 3,231,442
|
void visitMap(Map map) throws BeansException;
|
void visitMap(Map map) throws BeansException;
| 3,231,443
|
void visitMutablePropertyValues(MutablePropertyValues propertyValues) throws BeansException;
|
void visitMutablePropertyValues(MutablePropertyValues propertyValues) throws BeansException;
| 3,231,444
|
void visitObject(Object value) throws BeansException;
|
void visitObject(Object value) throws BeansException;
| 3,231,445
|
void visitPropertyValue(PropertyValue propertyValue) throws BeansException;
|
void visitPropertyValue(PropertyValue propertyValue) throws BeansException;
| 3,231,446
|
void visitRuntimeBeanReference(RuntimeBeanReference beanReference) throws BeansException;
|
void visitRuntimeBeanReference(RuntimeBeanReference beanReference) throws BeansException;
| 3,231,447
|
public RubyModule module_function(IRubyObject[] args) { if (getRuntime().getSafeLevel() >= 4 && !isTaint()) { throw new RubySecurityException(getRuntime(), "Insecure: can't change method visibility"); } if (args.length == 0) { getRuntime().setCurrentVisibility(Visibility.MODULE_FUNCTION); } else { setMethodVisibility(args, Visibility.PRIVATE); for (int i = 0; i < args.length; i++) { String name = args[i].toId(); ICallable method = searchMethod(name); if (method.isUndefined()) { throw new RubyBugException("undefined method '" + name + "'; can't happen"); } getSingletonClass().addMethod(name, new WrapperCallable(method, Visibility.PUBLIC)); callMethod("singleton_method_added", RubySymbol.newSymbol(getRuntime(), name)); } } return this; }
|
public RubyModule module_function(IRubyObject[] args) { if (getRuntime().getSafeLevel() >= 4 && !isTaint()) { throw new RubySecurityException(getRuntime(), "Insecure: can't change method visibility"); } if (args.length == 0) { getRuntime().setCurrentVisibility(Visibility.MODULE_FUNCTION); } else { setMethodVisibility(args, Visibility.PRIVATE); for (int i = 0; i < args.length; i++) { String name = args[i].toId(); ICallable method = searchMethod(name); if (method.isUndefined()) { throw new RubyBugException("undefined method '" + name + "'; can't happen"); } getSingletonClass().addMethod(name, new WrapperCallable(method, Visibility.PUBLIC)); callMethod("singleton_method_added", RubySymbol.newSymbol(getRuntime(), name)); } } return this; }
| 3,231,448
|
public IRubyObject op_cmp(IRubyObject other) { long millis = getTimeInMillis(); if (other.isNil()) { return other; } if (other instanceof RubyFloat || other instanceof RubyBignum) { double time = millis / 1000.0; double time_other = ((RubyNumeric) other).getDoubleValue(); if (time > time_other) { return RubyFixnum.one(getRuntime()); } else if (time < time_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } long millis_other = (other instanceof RubyTime) ? ((RubyTime) other).getTimeInMillis() : RubyNumeric.num2long(other) * 1000; if (millis > millis_other) { return RubyFixnum.one(getRuntime()); } else if (millis < millis_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } }
|
public IRubyObject op_cmp(IRubyObject other) { long millis = getTimeInMillis(); if (other.isNil()) { return other; } if (other instanceof RubyFloat || other instanceof RubyBignum) { double time = millis / 1000.0; double time_other = ((RubyNumeric) other).getDoubleValue(); if (time > time_other) { return RubyFixnum.one(getRuntime()); } else if (time < time_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } long millis_other = (other instanceof RubyTime) ? ((RubyTime) other).getTimeInMillis() : RubyNumeric.num2long(other) * 1000; if (millis > millis_other) { return RubyFixnum.one(getRuntime()); } else if (millis < millis_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } }
| 3,231,449
|
public IRubyObject op_cmp(IRubyObject other) { long millis = getTimeInMillis(); if (other.isNil()) { return other; } if (other instanceof RubyFloat || other instanceof RubyBignum) { double time = millis / 1000.0; double time_other = ((RubyNumeric) other).getDoubleValue(); if (time > time_other) { return RubyFixnum.one(getRuntime()); } else if (time < time_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } long millis_other = (other instanceof RubyTime) ? ((RubyTime) other).getTimeInMillis() : RubyNumeric.num2long(other) * 1000; if (millis > millis_other) { return RubyFixnum.one(getRuntime()); } else if (millis < millis_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } }
|
public IRubyObject op_cmp(IRubyObject other) { long millis = getTimeInMillis(); if (other.isNil()) { return other; } if (other instanceof RubyFloat || other instanceof RubyBignum) { double time = millis / 1000.0; double time_other = ((RubyNumeric) other).getDoubleValue(); if (time > time_other) { return RubyFixnum.one(getRuntime()); } else if (time < time_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } } long millis_other = (other instanceof RubyTime) ? ((RubyTime) other).getTimeInMillis() : RubyNumeric.num2long(other) * 1000; if (millis > millis_other) { return RubyFixnum.one(getRuntime()); } else if (millis < millis_other) { return RubyFixnum.minus_one(getRuntime()); } else { return RubyFixnum.zero(getRuntime()); } }
| 3,231,450
|
public List childNodes() { return Collections.EMPTY_LIST; }
|
public List childNodes() { return EMPTY_LIST; }
| 3,231,451
|
public BeanGlobalVariable(Ruby ruby, BSFDeclaredBean bean) { super(ruby, bean.name, null); this.bean = bean; }
|
public BeanGlobalVariable(Ruby ruby, BSFDeclaredBean bean) { super(ruby, "$" + bean.name, null); this.bean = bean; }
| 3,231,452
|
public Object apply(String file, int line, int col, Object funcBody, Vector paramNames, Vector args) { ISourcePosition oldPosition = ruby.getPosition(); ruby.setPosition(file, line); StringBuffer sb = new StringBuffer(((String) funcBody).length() + 100); sb.append("def __jruby_bsf_anonymous ("); int paramLength = paramNames.size(); for (int i = 0; i < paramLength; i++) { if (i > 0) { sb.append(", "); } sb.append(paramNames.elementAt(i)); } sb.append(") \n"); sb.append(funcBody); sb.append("\nend\n"); ruby.evalScript((String) sb.toString(), null); IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(ruby, args.toArray()); Object result = JavaUtil.convertRubyToJava(ruby, ruby.getTopSelf().callMethod("__jruby_bsf_anonymous", rubyArgs)); ruby.setPosition(oldPosition); return result; }
|
public Object apply(String file, int line, int col, Object funcBody, Vector paramNames, Vector args) { ISourcePosition oldPosition = ruby.getPosition(); ruby.setPosition(file, line); StringBuffer sb = new StringBuffer(((String) funcBody).length() + 100); sb.append("def __jruby_bsf_anonymous ("); int paramLength = paramNames.size(); for (int i = 0; i < paramLength; i++) { if (i > 0) { sb.append(", "); } sb.append(paramNames.elementAt(i)); } sb.append(") \n"); sb.append(funcBody); sb.append("\nend\n"); ruby.evalScript(sb.toString(), null); IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(ruby, args.toArray()); Object result = JavaUtil.convertRubyToJava(ruby, ruby.getTopSelf().callMethod("__jruby_bsf_anonymous", rubyArgs)); ruby.setPosition(oldPosition); return result; }
| 3,231,453
|
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); ruby = Ruby.getDefaultInstance(); int size = declaredBeans.size(); for (int i = 0; i < size; i++) { BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.elementAt(i); ruby.defineVariable(new BeanGlobalVariable(ruby, bean)); } // ruby.defineGlobalFunction("declareBean", method); }
|
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); ruby = Ruby.getDefaultInstance(); int size = declaredBeans.size(); for (int i = 0; i < size; i++) { BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.elementAt(i); ruby.defineVariable(new BeanGlobalVariable(ruby, bean)); } // ruby.defineGlobalFunction("declareBean", method); }
| 3,231,454
|
public String toString() { return "Token: Type = " + getType() + "; Line = " + getLine() + "; Column = " + getColumn() + "; Data = \"" + String.valueOf(getData()).replaceAll("\n", "\\\\n") + "\""; }
|
public String toString() { return "Token: Type = " + getType() + "; Line = " + getLine() + "; Column = " + getColumn() + "; Data = \"" + String.valueOf(getData()) + "\""; }
| 3,231,455
|
private static String convert2String(IRubyObject l2Conv) { IRuby runtime = l2Conv.getRuntime(); if (l2Conv.getMetaClass() != runtime.getClass("String")) { l2Conv = l2Conv.convertToType("String", "to_s", true); //we may need a false here, not sure } return ((RubyString) l2Conv).getValue(); }
|
private static String convert2String(IRubyObject l2Conv) { IRuby runtime = l2Conv.getRuntime(); if (l2Conv.getMetaClass() != runtime.getClass("String")) { l2Conv = l2Conv.convertToType("String", "to_s", true); //we may need a false here, not sure } return ((RubyString) l2Conv).toString(); }
| 3,231,456
|
public static RubyString pack(List list, RubyString formatString) { IRuby runtime = formatString.getRuntime(); PtrList format = new PtrList(formatString.getValue()); StringBuffer result = new StringBuffer(); int listSize = list.size(); char type = format.nextChar(); int idx = 0; String lCurElemString; while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); if (Character.isWhitespace(type)) { // skip all spaces type = next; continue; } if (next == '!' || next == '_') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } next = format.nextChar(); } // Determine how many of type are needed (default: 1) boolean isStar = false; int occurrences = 1; if (next == '*') { if ("@Xxu".indexOf(type) != -1) { occurrences = 0; } else { occurrences = listSize; isStar = true; } next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); // an exception may occur here if an int can't hold this but ... occurrences = format.nextAsciiNumber(); next = format.nextChar(); } Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { idx = encode(runtime, occurrences, result, list, idx, converter); type = next; continue; } switch (type) { case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : case 'a' : case 'Z' : case 'B' : case 'b' : case 'H' : case 'h' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); if (isStar) { occurrences = lCurElemString.length(); } switch (type) { case 'a' : case 'A' : case 'Z' : if (lCurElemString.length() >= occurrences) { result.append(lCurElemString.toCharArray(), 0, occurrences); } else {//need padding //I'm fairly sure there is a library call to create a //string filled with a given char with a given length but I couldn't find it result.append(lCurElemString); occurrences -= lCurElemString.length(); grow(result, (type == 'a') ? sNil10 : sSp10, occurrences); } break; //I believe there is a bug in the b and B case we skip a char too easily case 'b' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { if ((lCurElemString.charAt(i++) & 1) != 0) {//if the low bit is set currentByte |= 128; //set the high bit of the result } if ((i & 7) == 0) { result.append((char) (currentByte & 0xff)); currentByte = 0; continue; } //if the index is not a multiple of 8, we are not on a byte boundary currentByte >>= 1; //shift the byte } if ((occurrences & 7) != 0) { //if the length is not a multiple of 8 currentByte >>= 7 - (occurrences & 7); //we need to pad the last byte result.append((char) (currentByte & 0xff)); } //do some padding, I don't understand the padding strategy result.setLength(result.length() + padLength); } break; case 'B' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { currentByte |= lCurElemString.charAt(i++) & 1; // we filled up current byte; append it and create next one if ((i & 7) == 0) { result.append((char) (currentByte & 0xff)); currentByte = 0; continue; } //if the index is not a multiple of 8, we are not on a byte boundary currentByte <<= 1; } if ((occurrences & 7) != 0) { //if the length is not a multiple of 8 currentByte <<= 7 - (occurrences & 7); //we need to pad the last byte result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; case 'h' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { char currentChar = lCurElemString.charAt(i++); if (Character.isJavaIdentifierStart(currentChar)) { //this test may be too lax but it is the same as in MRI currentByte |= (((currentChar & 15) + 9) & 15) << 4; } else { currentByte |= (currentChar & 15) << 4; } if ((i & 1) != 0) { currentByte >>= 4; } else { result.append((char) (currentByte & 0xff)); currentByte = 0; } } if ((occurrences & 1) != 0) { result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; case 'H' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { char currentChar = lCurElemString.charAt(i++); if (Character.isJavaIdentifierStart(currentChar)) { //this test may be too lax but it is the same as in MRI currentByte |= ((currentChar & 15) + 9) & 15; } else { currentByte |= currentChar & 15; } if ((i & 1) != 0) { currentByte <<= 4; } else { result.append((char) (currentByte & 0xff)); currentByte = 0; } } if ((occurrences & 1) != 0) { result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; } break; } case 'x' : grow(result, sNil10, occurrences); break; case 'X' : try { shrink(result, occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `pack': X outside of string"); } break; case '@' : occurrences -= result.length(); if (occurrences > 0) { grow(result, sNil10, occurrences); } occurrences = -occurrences; if (occurrences > 0) { shrink(result, occurrences); } break; case 'u' : case 'm' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); occurrences = occurrences <= 2 ? 45 : occurrences / 3 * 3; for (;;) { encodes(runtime, result, lCurElemString, occurrences, type); if (occurrences >= lCurElemString.length()) { break; } lCurElemString = lCurElemString.substring(occurrences); } } break; case 'M' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); if (occurrences <= 1) { occurrences = 72; } qpencode(result, lCurElemString, occurrences); } break; case 'U' : char[] c = new char[occurrences]; for (int cIndex = 0; occurrences-- > 0; cIndex++) { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); long l = from == runtime.getNil() ? 0 : RubyNumeric.num2long(from); c[cIndex] = (char) l; } try { byte[] bytes = new String(c).getBytes("UTF-8"); result.append(RubyString.bytesToString(bytes)); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert to UTF8"; } break; } type = next; } return runtime.newString(result.toString()); }
|
public static RubyString pack(List list, RubyString formatString) { IRuby runtime = formatString.getRuntime(); PtrList format = new PtrList(formatString.toString()); StringBuffer result = new StringBuffer(); int listSize = list.size(); char type = format.nextChar(); int idx = 0; String lCurElemString; while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); if (Character.isWhitespace(type)) { // skip all spaces type = next; continue; } if (next == '!' || next == '_') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } next = format.nextChar(); } // Determine how many of type are needed (default: 1) boolean isStar = false; int occurrences = 1; if (next == '*') { if ("@Xxu".indexOf(type) != -1) { occurrences = 0; } else { occurrences = listSize; isStar = true; } next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); // an exception may occur here if an int can't hold this but ... occurrences = format.nextAsciiNumber(); next = format.nextChar(); } Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { idx = encode(runtime, occurrences, result, list, idx, converter); type = next; continue; } switch (type) { case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : case 'a' : case 'Z' : case 'B' : case 'b' : case 'H' : case 'h' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); if (isStar) { occurrences = lCurElemString.length(); } switch (type) { case 'a' : case 'A' : case 'Z' : if (lCurElemString.length() >= occurrences) { result.append(lCurElemString.toCharArray(), 0, occurrences); } else {//need padding //I'm fairly sure there is a library call to create a //string filled with a given char with a given length but I couldn't find it result.append(lCurElemString); occurrences -= lCurElemString.length(); grow(result, (type == 'a') ? sNil10 : sSp10, occurrences); } break; //I believe there is a bug in the b and B case we skip a char too easily case 'b' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { if ((lCurElemString.charAt(i++) & 1) != 0) {//if the low bit is set currentByte |= 128; //set the high bit of the result } if ((i & 7) == 0) { result.append((char) (currentByte & 0xff)); currentByte = 0; continue; } //if the index is not a multiple of 8, we are not on a byte boundary currentByte >>= 1; //shift the byte } if ((occurrences & 7) != 0) { //if the length is not a multiple of 8 currentByte >>= 7 - (occurrences & 7); //we need to pad the last byte result.append((char) (currentByte & 0xff)); } //do some padding, I don't understand the padding strategy result.setLength(result.length() + padLength); } break; case 'B' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { currentByte |= lCurElemString.charAt(i++) & 1; // we filled up current byte; append it and create next one if ((i & 7) == 0) { result.append((char) (currentByte & 0xff)); currentByte = 0; continue; } //if the index is not a multiple of 8, we are not on a byte boundary currentByte <<= 1; } if ((occurrences & 7) != 0) { //if the length is not a multiple of 8 currentByte <<= 7 - (occurrences & 7); //we need to pad the last byte result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; case 'h' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { char currentChar = lCurElemString.charAt(i++); if (Character.isJavaIdentifierStart(currentChar)) { //this test may be too lax but it is the same as in MRI currentByte |= (((currentChar & 15) + 9) & 15) << 4; } else { currentByte |= (currentChar & 15) << 4; } if ((i & 1) != 0) { currentByte >>= 4; } else { result.append((char) (currentByte & 0xff)); currentByte = 0; } } if ((occurrences & 1) != 0) { result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; case 'H' : { int currentByte = 0; int padLength = 0; if (occurrences > lCurElemString.length()) { padLength = occurrences - lCurElemString.length(); occurrences = lCurElemString.length(); } for (int i = 0; i < occurrences;) { char currentChar = lCurElemString.charAt(i++); if (Character.isJavaIdentifierStart(currentChar)) { //this test may be too lax but it is the same as in MRI currentByte |= ((currentChar & 15) + 9) & 15; } else { currentByte |= currentChar & 15; } if ((i & 1) != 0) { currentByte <<= 4; } else { result.append((char) (currentByte & 0xff)); currentByte = 0; } } if ((occurrences & 1) != 0) { result.append((char) (currentByte & 0xff)); } result.setLength(result.length() + padLength); } break; } break; } case 'x' : grow(result, sNil10, occurrences); break; case 'X' : try { shrink(result, occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `pack': X outside of string"); } break; case '@' : occurrences -= result.length(); if (occurrences > 0) { grow(result, sNil10, occurrences); } occurrences = -occurrences; if (occurrences > 0) { shrink(result, occurrences); } break; case 'u' : case 'm' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); occurrences = occurrences <= 2 ? 45 : occurrences / 3 * 3; for (;;) { encodes(runtime, result, lCurElemString, occurrences, type); if (occurrences >= lCurElemString.length()) { break; } lCurElemString = lCurElemString.substring(occurrences); } } break; case 'M' : { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); lCurElemString = from == runtime.getNil() ? "" : convert2String(from); if (occurrences <= 1) { occurrences = 72; } qpencode(result, lCurElemString, occurrences); } break; case 'U' : char[] c = new char[occurrences]; for (int cIndex = 0; occurrences-- > 0; cIndex++) { if (listSize-- <= 0) { throw runtime.newArgumentError(sTooFew); } IRubyObject from = (IRubyObject) list.get(idx++); long l = from == runtime.getNil() ? 0 : RubyNumeric.num2long(from); c[cIndex] = (char) l; } try { byte[] bytes = new String(c).getBytes("UTF-8"); result.append(RubyString.bytesToString(bytes)); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert to UTF8"; } break; } type = next; } return runtime.newString(result.toString()); }
| 3,231,457
|
public static RubyArray unpack(String encodedString, RubyString formatString) { IRuby runtime = formatString.getRuntime(); RubyArray result = runtime.newArray(); PtrList format = new PtrList(formatString.getValue()); PtrList encode = new PtrList(encodedString); char type = format.nextChar(); // Type to be unpacked while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); // Next indicates to decode using native encoding format if (next == '_' || next == '!') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } // We advance in case occurences follows next = format.nextChar(); } // How many occurrences of 'type' we want int occurrences = 0; if (format.isAtEnd()) { occurrences = 1; } else if (next == '*') { occurrences = IS_STAR; next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); occurrences = format.nextAsciiNumber(); next = format.nextChar(); } else { occurrences = type == '@' ? 0 : 1; } // See if we have a converter for the job... Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { decode(runtime, encode, occurrences, result, converter); type = next; continue; } // Otherwise the unpack should be here... switch (type) { case '@' : encode.setPosition(occurrences); break; case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0' && c != ' ') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'Z' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'a' : if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } result.append(runtime.newString(encode.nextSubstring(occurrences))); break; case 'b' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) { bits >>>= 1; } else { bits = encode.nextChar(); } lElem.append((bits & 1) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'B' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) bits <<= 1; else bits = encode.nextChar(); lElem.append((bits & 128) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'h' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) { bits >>>= 4; } else { bits = encode.nextChar(); } lElem.append(sHexDigits[bits & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'H' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) bits <<= 4; else bits = encode.nextChar(); lElem.append(sHexDigits[(bits >>> 4) & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'u': { int length = encode.remaining() * 3 / 4; StringBuffer lElem = new StringBuffer(length); char s; int total = 0; s = encode.nextChar(); while (!encode.isAtEnd() && s > ' ' && s < 'a') { int a, b, c, d; char[] hunk = new char[3]; int len = (s - ' ') & 077; s = encode.nextChar(); total += len; if (total > length) { len -= total - length; total = length; } while (len > 0) { int mlen = len > 3 ? 3 : len; if (!encode.isAtEnd() && s >= ' ') { a = (s - ' ') & 077; s = encode.nextChar(); } else a = 0; if (!encode.isAtEnd() && s >= ' ') { b = (s - ' ') & 077; s = encode.nextChar(); } else b = 0; if (!encode.isAtEnd() && s >= ' ') { c = (s - ' ') & 077; s = encode.nextChar(); } else c = 0; if (!encode.isAtEnd() && s >= ' ') { d = (s - ' ') & 077; s = encode.nextChar(); } else d = 0; hunk[0] = (char) ((a << 2 | b >> 4) & 255); hunk[1] = (char) ((b << 4 | c >> 2) & 255); hunk[2] = (char) ((c << 6 | d) & 255); lElem.append(hunk, 0, (int) mlen); len -= mlen; } if (s == '\r') s = encode.nextChar(); if (s == '\n') s = encode.nextChar(); else if (!encode.isAtEnd()) { if (encode.nextChar() == '\n') { encode.nextChar(); // Possible Checksum Byte } else if (!encode.isAtEnd()) { encode.backup(1); } } } result.append(runtime.newString(lElem.toString())); } break; case 'm': { int length = encode.remaining()*3/4; StringBuffer lElem = new StringBuffer(length); int a = -1, b = -1, c = 0, d; while (!encode.isAtEnd()) { char s; do { s = encode.nextChar(); } while (s == '\r' || s == '\n'); if ((a = b64_xtable[s]) == -1) break; if ((b = b64_xtable[s = encode.nextChar()]) == -1) break; if ((c = b64_xtable[s = encode.nextChar()]) == -1) break; if ((d = b64_xtable[s = encode.nextChar()]) == -1) break; lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); lElem.append((char)((c << 6 | d) & 255)); } if (a != -1 && b != -1) { int remaining = encode.remaining(); char[] s = encode.nextSubstring(4).toCharArray(); if (remaining > 2 && s[2] == '=') lElem.append((char)((a << 2 | b >> 4) & 255)); if (c != -1 && remaining > 3 && s[3] == '=') { lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); } } result.append(runtime.newString(lElem.toString())); } break; case 'M' : { StringBuffer lElem = new StringBuffer(Math.max(encode.remaining(),0)); for(;;) { char c = encode.nextChar(); if (encode.isAtEnd()) break; if (c != '=') { lElem.append(c); } else { char c1 = encode.nextChar(); if (encode.isAtEnd()) break; if (c1 == '\n') continue; char c2 = encode.nextChar(); if (encode.isAtEnd()) break; String hexString = new String(new char[]{c1,c2}); int value = Integer.parseInt(hexString,16); lElem.append((char)value); } } result.append(runtime.newString(lElem.toString())); } break; case 'U' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } //get the correct substring String toUnpack = encode.nextSubstring(occurrences); String lUtf8 = null; try { lUtf8 = new String(toUnpack.getBytes("iso8859-1"), "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert from UTF8"; } char[] c = lUtf8.toCharArray(); for (int lCurCharIdx = 0; occurrences-- > 0 && lCurCharIdx < c.length; lCurCharIdx++) result.append(runtime.newFixnum(c[lCurCharIdx])); } break; case 'X': if (occurrences == IS_STAR) { occurrences = encode.getLength() - encode.remaining(); } try { encode.backup(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': X outside of string"); } break; case 'x': if (occurrences == IS_STAR) { occurrences = encode.remaining(); } try { encode.nextSubstring(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': x outside of string"); } break; } type = next; } return result; }
|
public static RubyArray unpack(String encodedString, RubyString formatString) { IRuby runtime = formatString.getRuntime(); RubyArray result = runtime.newArray(); PtrList format = new PtrList(formatString.toString()); PtrList encode = new PtrList(encodedString); char type = format.nextChar(); // Type to be unpacked while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); // Next indicates to decode using native encoding format if (next == '_' || next == '!') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } // We advance in case occurences follows next = format.nextChar(); } // How many occurrences of 'type' we want int occurrences = 0; if (format.isAtEnd()) { occurrences = 1; } else if (next == '*') { occurrences = IS_STAR; next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); occurrences = format.nextAsciiNumber(); next = format.nextChar(); } else { occurrences = type == '@' ? 0 : 1; } // See if we have a converter for the job... Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { decode(runtime, encode, occurrences, result, converter); type = next; continue; } // Otherwise the unpack should be here... switch (type) { case '@' : encode.setPosition(occurrences); break; case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0' && c != ' ') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'Z' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'a' : if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } result.append(runtime.newString(encode.nextSubstring(occurrences))); break; case 'b' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) { bits >>>= 1; } else { bits = encode.nextChar(); } lElem.append((bits & 1) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'B' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) bits <<= 1; else bits = encode.nextChar(); lElem.append((bits & 128) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'h' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) { bits >>>= 4; } else { bits = encode.nextChar(); } lElem.append(sHexDigits[bits & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'H' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) bits <<= 4; else bits = encode.nextChar(); lElem.append(sHexDigits[(bits >>> 4) & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'u': { int length = encode.remaining() * 3 / 4; StringBuffer lElem = new StringBuffer(length); char s; int total = 0; s = encode.nextChar(); while (!encode.isAtEnd() && s > ' ' && s < 'a') { int a, b, c, d; char[] hunk = new char[3]; int len = (s - ' ') & 077; s = encode.nextChar(); total += len; if (total > length) { len -= total - length; total = length; } while (len > 0) { int mlen = len > 3 ? 3 : len; if (!encode.isAtEnd() && s >= ' ') { a = (s - ' ') & 077; s = encode.nextChar(); } else a = 0; if (!encode.isAtEnd() && s >= ' ') { b = (s - ' ') & 077; s = encode.nextChar(); } else b = 0; if (!encode.isAtEnd() && s >= ' ') { c = (s - ' ') & 077; s = encode.nextChar(); } else c = 0; if (!encode.isAtEnd() && s >= ' ') { d = (s - ' ') & 077; s = encode.nextChar(); } else d = 0; hunk[0] = (char) ((a << 2 | b >> 4) & 255); hunk[1] = (char) ((b << 4 | c >> 2) & 255); hunk[2] = (char) ((c << 6 | d) & 255); lElem.append(hunk, 0, (int) mlen); len -= mlen; } if (s == '\r') s = encode.nextChar(); if (s == '\n') s = encode.nextChar(); else if (!encode.isAtEnd()) { if (encode.nextChar() == '\n') { encode.nextChar(); // Possible Checksum Byte } else if (!encode.isAtEnd()) { encode.backup(1); } } } result.append(runtime.newString(lElem.toString())); } break; case 'm': { int length = encode.remaining()*3/4; StringBuffer lElem = new StringBuffer(length); int a = -1, b = -1, c = 0, d; while (!encode.isAtEnd()) { char s; do { s = encode.nextChar(); } while (s == '\r' || s == '\n'); if ((a = b64_xtable[s]) == -1) break; if ((b = b64_xtable[s = encode.nextChar()]) == -1) break; if ((c = b64_xtable[s = encode.nextChar()]) == -1) break; if ((d = b64_xtable[s = encode.nextChar()]) == -1) break; lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); lElem.append((char)((c << 6 | d) & 255)); } if (a != -1 && b != -1) { int remaining = encode.remaining(); char[] s = encode.nextSubstring(4).toCharArray(); if (remaining > 2 && s[2] == '=') lElem.append((char)((a << 2 | b >> 4) & 255)); if (c != -1 && remaining > 3 && s[3] == '=') { lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); } } result.append(runtime.newString(lElem.toString())); } break; case 'M' : { StringBuffer lElem = new StringBuffer(Math.max(encode.remaining(),0)); for(;;) { char c = encode.nextChar(); if (encode.isAtEnd()) break; if (c != '=') { lElem.append(c); } else { char c1 = encode.nextChar(); if (encode.isAtEnd()) break; if (c1 == '\n') continue; char c2 = encode.nextChar(); if (encode.isAtEnd()) break; String hexString = new String(new char[]{c1,c2}); int value = Integer.parseInt(hexString,16); lElem.append((char)value); } } result.append(runtime.newString(lElem.toString())); } break; case 'U' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } //get the correct substring String toUnpack = encode.nextSubstring(occurrences); String lUtf8 = null; try { lUtf8 = new String(toUnpack.getBytes("iso8859-1"), "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert from UTF8"; } char[] c = lUtf8.toCharArray(); for (int lCurCharIdx = 0; occurrences-- > 0 && lCurCharIdx < c.length; lCurCharIdx++) result.append(runtime.newFixnum(c[lCurCharIdx])); } break; case 'X': if (occurrences == IS_STAR) { occurrences = encode.getLength() - encode.remaining(); } try { encode.backup(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': X outside of string"); } break; case 'x': if (occurrences == IS_STAR) { occurrences = encode.remaining(); } try { encode.nextSubstring(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': x outside of string"); } break; } type = next; } return result; }
| 3,231,458
|
public void invoke(JFrame parentFrame) { // Before creating any connections. Update proxy if needed. try { updateProxyConfig(); } catch (Exception e) { Log.error(e); } LoginPanel loginPanel = new LoginPanel(); // Construct Dialog loginDialog = new JFrame(Default.getString(Default.APPLICATION_NAME)); loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); final JPanel mainPanel = new GrayBackgroundPanel(); final GridBagLayout mainLayout = new GridBagLayout(); mainPanel.setLayout(mainLayout); final ImagePanel imagePanel = new ImagePanel(); mainPanel.add(imagePanel, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); final String showPoweredBy = Default.getString(Default.SHOW_POWERED_BY); if (ModelUtil.hasLength(showPoweredBy) && "true".equals(showPoweredBy)) { // Handle PoweredBy for custom clients. final JLabel poweredBy = new JLabel(SparkRes.getImageIcon(SparkRes.POWERED_BY_IMAGE)); mainPanel.add(poweredBy, new GridBagConstraints(0, 1, 4, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 2, 0), 0, 0)); } // imagePanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.lightGray)); loginPanel.setOpaque(false); mainPanel.add(loginPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); loginDialog.setContentPane(mainPanel); loginDialog.setLocationRelativeTo(parentFrame); loginDialog.setResizable(false); loginDialog.pack(); // Center dialog on screen GraphicUtils.centerWindowOnScreen(loginDialog); // Show dialog loginDialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { quitLogin(); } }); if (loginPanel.getUsername().trim().length() > 0) { loginPanel.getPasswordField().requestFocus(); } if (!localPref.isStartedHidden() || !localPref.isAutoLogin()) { // Make dialog top most. loginDialog.setVisible(true); } }
|
public void invoke(JFrame parentFrame) { // Before creating any connections. Update proxy if needed. try { updateProxyConfig(); } catch (Exception e) { Log.error(e); } LoginPanel loginPanel = new LoginPanel(); // Construct Dialog loginDialog = new JFrame(Default.getString(Default.APPLICATION_NAME)); loginDialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); final JPanel mainPanel = new GrayBackgroundPanel(); final GridBagLayout mainLayout = new GridBagLayout(); mainPanel.setLayout(mainLayout); final ImagePanel imagePanel = new ImagePanel(); mainPanel.add(imagePanel, new GridBagConstraints(0, 0, 4, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); final String showPoweredBy = Default.getString(Default.SHOW_POWERED_BY); if (ModelUtil.hasLength(showPoweredBy) && "true".equals(showPoweredBy)) { // Handle PoweredBy for custom clients. final JLabel poweredBy = new JLabel(SparkRes.getImageIcon(SparkRes.POWERED_BY_IMAGE)); mainPanel.add(poweredBy, new GridBagConstraints(0, 1, 4, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 2, 0), 0, 0)); } // imagePanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.lightGray)); loginPanel.setOpaque(false); mainPanel.add(loginPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); loginDialog.setContentPane(mainPanel); loginDialog.setLocationRelativeTo(parentFrame); loginDialog.setResizable(false); loginDialog.pack(); // Center dialog on screen GraphicUtils.centerWindowOnScreen(loginDialog); // Show dialog loginDialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { quitLogin(); } }); if (loginPanel.getUsername().trim().length() > 0) { loginPanel.getPasswordField().requestFocus(); } if (!localPref.isStartedHidden() || !localPref.isAutoLogin()) { // Make dialog top most. loginDialog.setVisible(true); } }
| 3,231,460
|
void setZoomPanel(ZoomPanel zoomPanel) { this.zoomPanel = zoomPanel; Dimension imageDim = new Dimension(imageWidth, imageHeight); zoomPanel.setPreferredSize(imageDim); zoomPanel.setSize(imageDim); }
|
void setZoomPanel(ZoomPanel zoomPanel) { this.zoomPanel = zoomPanel; Dimension imageDim = new Dimension(imageWidth, imageHeight); zoomPanel.setPreferredSize(imageDim); zoomPanel.setSize(imageDim); }
| 3,231,461
|
public void setItemSelected(double level) { Integer index = (Integer) values.get(new Double(level)); Iterator i = items.keySet().iterator(); AbstractButton item; Integer j; if (index != null) { while (i.hasNext()) { j = (Integer) i.next(); item = (AbstractButton) items.get(j); item.setSelected(j.equals(index)); } } else { while (i.hasNext()) { item = (AbstractButton) items.get(i.next()); item.setSelected(false); } } }
|
public void setItemSelected(double level) { Integer index = (Integer) values.get(new Double(level)); Iterator i = items.keySet().iterator(); AbstractButton item; Integer j; if (index != null) { while (i.hasNext()) { j = (Integer) i.next(); item = (AbstractButton) items.get(j); item.setSelected(j.equals(index)); } } else { while (i.hasNext()) { item = (AbstractButton) items.get(i.next()); item.setSelected(false); } } }
| 3,231,462
|
private void buildContactList() { XMPPConnection con = SparkManager.getConnection(); final Roster roster = con.getRoster(); roster.addRosterListener(this); for (RosterGroup group : roster.getGroups()) { ContactGroup contactGroup = addContactGroup(group.getName()); for (RosterEntry entry : group.getEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); contactItem.setPresence(null); if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { // Add to contact group. contactGroup.addContactItem(contactItem); contactGroup.setVisible(true); } else { if (offlineGroup.getContactItemByJID(entry.getUser()) == null) { offlineGroup.addContactItem(contactItem); } } } } // Add Unfiled Group // addContactGroup(unfiledGroup); for (RosterEntry entry : roster.getUnfiledEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); offlineGroup.addContactItem(contactItem); } unfiledGroup.setVisible(false); }
|
private void buildContactList() { XMPPConnection con = SparkManager.getConnection(); final Roster roster = con.getRoster(); roster.addRosterListener(this); for (RosterGroup group : roster.getGroups()) { ContactGroup contactGroup = addContactGroup(group.getName()); for (RosterEntry entry : group.getEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); contactItem.setPresence(null); if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { // Add to contact group. contactGroup.addContactItem(contactItem); contactGroup.setVisible(true); } else { if (offlineGroup.getContactItemByJID(entry.getUser()) == null) { offlineGroup.addContactItem(contactItem); } } } } // Add Unfiled Group // addContactGroup(unfiledGroup); for (RosterEntry entry : roster.getUnfiledEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); offlineGroup.addContactItem(contactItem); } unfiledGroup.setVisible(false); }
| 3,231,464
|
public void connectionClosedOnError(final Exception ex) { String errorMessage = Res.getString("message.disconnected.error"); if (ex != null && ex instanceof XMPPException) { XMPPException xmppEx = (XMPPException)ex; StreamError error = xmppEx.getStreamError(); String reason = error.getCode(); if ("conflict".equals(reason)) { errorMessage = Res.getString("message.disconnected.conflict.error"); } else { errorMessage = Res.getString("message.general.error", reason); } } final String message = errorMessage; SwingUtilities.invokeLater(new Runnable() { public void run() { reconnect(message); } }); }
|
publicvoidconnectionClosedOnError(finalExceptionex){StringerrorMessage=Res.getString("message.disconnected.error");if(ex!=null&&exinstanceofXMPPException){XMPPExceptionxmppEx=(XMPPException)ex;StreamErrorerror=xmppEx.getStreamError();Stringreason=error.getCode();if("conflict".equals(reason)){errorMessage=Res.getString("message.disconnected.conflict.error");}else{errorMessage=Res.getString("message.general.error",reason);}}finalStringmessage=errorMessage;SwingUtilities.invokeLater(newRunnable(){publicvoidrun(){reconnect(message);}});}
| 3,231,465
|
private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
|
private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
| 3,231,466
|
private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
|
private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
| 3,231,467
|
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
|
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
| 3,231,468
|
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
|
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { RosterEntry entry = roster.getEntry(jid); Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); if (entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { contactGroup.setVisible(true); } contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
| 3,231,469
|
private void removeAllUsers() { // Behind the scenes, move everyone to the offline group. Iterator contactGroups = new ArrayList(getContactGroups()).iterator(); while (contactGroups.hasNext()) { ContactGroup contactGroup = (ContactGroup)contactGroups.next(); Iterator contactItems = new ArrayList(contactGroup.getContactItems()).iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); contactGroup.removeContactItem(item); } } }
|
private void removeAllUsers() { // Behind the scenes, move everyone to the offline group. final Iterator contactGroups = new ArrayList(getContactGroups()).iterator(); while (contactGroups.hasNext()) { ContactGroup contactGroup = (ContactGroup)contactGroups.next(); Iterator contactItems = new ArrayList(contactGroup.getContactItems()).iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); contactGroup.removeContactItem(item); } } }
| 3,231,470
|
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = Res.getString("message.approve.subscription", UserManager.unescapeJID(jid)); final JPanel layoutPanel = new JPanel(); layoutPanel.setBackground(Color.white); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); RolloverButton acceptButton = new RolloverButton(); ResourceUtils.resButton(acceptButton, Res.getString("button.accept")); RolloverButton viewInfoButton = new RolloverButton(); ResourceUtils.resButton(viewInfoButton, Res.getString("button.profile")); RolloverButton denyButton = new RolloverButton(); ResourceUtils.resButton(denyButton, Res.getString("button.deny")); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), Res.getString("message.add.user"), Res.getString("message.add.to.roster"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(UserManager.unescapeJID(jid)); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog SparkManager.getWorkspace().addAlert(layoutPanel); SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow()); }
|
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = Res.getString("message.approve.subscription", UserManager.unescapeJID(jid)); final JPanel layoutPanel = new JPanel(); layoutPanel.setBackground(Color.white); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); RolloverButton acceptButton = new RolloverButton(); ResourceUtils.resButton(acceptButton, Res.getString("button.accept")); RolloverButton viewInfoButton = new RolloverButton(); ResourceUtils.resButton(viewInfoButton, Res.getString("button.profile")); RolloverButton denyButton = new RolloverButton(); ResourceUtils.resButton(denyButton, Res.getString("button.deny")); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), Res.getString("message.add.user"), Res.getString("message.add.to.roster"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(UserManager.unescapeJID(jid)); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getWorkspace().removeAlert(layoutPanel); // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog SparkManager.getWorkspace().addAlert(layoutPanel); SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow()); }
| 3,231,471
|
private void updateUserPresence(Presence presence) { if (presence == null) { return; } Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); RosterEntry entry = roster.getEntry(bareJID); boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); // If online, check to see if they are in the offline group. // If so, remove from offline group and add to all groups they // belong to. if (presence.getType() == Presence.Type.available && offlineGroup.getContactItemByJID(bareJID) != null) { changeOfflineToOnline(bareJID, entry, presence); } else if (presence.getFrom().indexOf("workgroup.") != -1) { changeOfflineToOnline(bareJID, entry, presence); } // If online, but not in offline group, update presence. else if (presence.getType() == Presence.Type.available) { final Iterator groupIterator = groupList.iterator(); while (groupIterator.hasNext()) { ContactGroup group = (ContactGroup)groupIterator.next(); ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.setPresence(presence); group.fireContactGroupUpdated(); } } } // If not available, move to offline group. else if (presence.getType() == Presence.Type.unavailable && !isPending) { presence = roster.getPresence(bareJID); if (presence == null) { moveToOfflineGroup(bareJID); } } }
|
private void updateUserPresence(Presence presence) { if (presence == null) { return; } Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); RosterEntry entry = roster.getEntry(bareJID); boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); // If online, check to see if they are in the offline group. // If so, remove from offline group and add to all groups they // belong to. if (presence.getType() == Presence.Type.available && offlineGroup.getContactItemByJID(bareJID) != null) { changeOfflineToOnline(bareJID, entry, presence); } else if (presence.getFrom().indexOf("workgroup.") != -1) { changeOfflineToOnline(bareJID, entry, presence); } // If online, but not in offline group, update presence. else if (presence.getType() == Presence.Type.available) { final Iterator groupIterator = groupList.iterator(); while (groupIterator.hasNext()) { ContactGroup group = (ContactGroup)groupIterator.next(); ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.setPresence(presence); group.fireContactGroupUpdated(); } } } // If not available, move to offline group. else if (presence.getType() == Presence.Type.unavailable && !isPending) { presence = roster.getPresence(bareJID); if (presence == null) { moveToOfflineGroup(bareJID); } } }
| 3,231,472
|
private void setupListeners() { chat.addParticipantStatusListener(new DefaultParticipantStatusListener() { public void kicked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.kicked.from.room", nickname)); } public void voiceGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.given.voice", nickname)); } public void voiceRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.voice.revoked", nickname)); } public void banned(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.banned", nickname)); } public void membershipGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.membership", nickname)); } public void membershipRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.membership", nickname)); } public void moderatorGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.moderator", nickname)); } public void moderatorRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.moderator", nickname)); } public void ownershipGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.owner", nickname)); } public void ownershipRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.owner", nickname)); } public void adminGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.admin", nickname)); } public void adminRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.admin", nickname)); } public void nicknameChanged(String participant, String nickname) { insertText(Res.getString("message.user.nickname.changed", StringUtils.parseResource(participant), nickname)); } }); chat.addUserStatusListener(new DefaultUserStatusListener() { public void kicked(String s, String reason) { insertText(Res.getString("message.your.kicked", s)); getChatInputEditor().setEnabled(false); getSplitPane().setRightComponent(null); leaveChatRoom(); } public void voiceGranted() { insertText(Res.getString("message.your.voice.revoked")); getChatInputEditor().setEnabled(true); } public void voiceRevoked() { insertText(Res.getString("message.your.voice.revoked")); getChatInputEditor().setEnabled(false); } public void banned(String s, String reason) { insertText(Res.getString("message.your.banned")); } public void membershipGranted() { insertText(Res.getString("message.your.membership.granted")); } public void membershipRevoked() { insertText(Res.getString("message.your.membership.revoked")); } public void moderatorGranted() { insertText(Res.getString("message.your.moderator.granted")); } public void moderatorRevoked() { insertText(Res.getString("message.your.moderator.revoked")); } public void ownershipGranted() { insertText(Res.getString("message.your.ownership.granted")); } public void ownershipRevoked() { insertText(Res.getString("message.your.ownership.revoked")); } public void adminGranted() { insertText(Res.getString("message.your.admin.granted")); } public void adminRevoked() { insertText(Res.getString("message.your.revoked.granted")); } }); chat.addSubjectUpdatedListener(new SubjectListener()); }
|
private void setupListeners() { chat.addParticipantStatusListener(new DefaultParticipantStatusListener() { public void kicked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.kicked.from.room", nickname)); } public void voiceGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.given.voice", nickname)); } public void voiceRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.voice.revoked", nickname)); } public void banned(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.banned", nickname)); } public void membershipGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.membership", nickname)); } public void membershipRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.membership", nickname)); } public void moderatorGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.moderator", nickname)); } public void moderatorRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.moderator", nickname)); } public void ownershipGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.owner", nickname)); } public void ownershipRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.owner", nickname)); } public void adminGranted(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.granted.admin", nickname)); } public void adminRevoked(String participant) { String nickname = StringUtils.parseResource(participant); insertText(Res.getString("message.user.revoked.admin", nickname)); } public void nicknameChanged(String participant, String nickname) { insertText(Res.getString("message.user.nickname.changed", StringUtils.parseResource(participant), nickname)); } }); chat.addUserStatusListener(new DefaultUserStatusListener() { public void kicked(String s, String reason) { insertText(Res.getString("message.your.kicked", s)); getChatInputEditor().setEnabled(false); getSplitPane().setRightComponent(null); leaveChatRoom(); } public void voiceGranted() { insertText(Res.getString("message.your.voice.granted")); getChatInputEditor().setEnabled(true); } public void voiceRevoked() { insertText(Res.getString("message.your.voice.granted")); getChatInputEditor().setEnabled(false); } public void banned(String s, String reason) { insertText(Res.getString("message.your.banned")); } public void membershipGranted() { insertText(Res.getString("message.your.membership.granted")); } public void membershipRevoked() { insertText(Res.getString("message.your.membership.revoked")); } public void moderatorGranted() { insertText(Res.getString("message.your.moderator.granted")); } public void moderatorRevoked() { insertText(Res.getString("message.your.moderator.revoked")); } public void ownershipGranted() { insertText(Res.getString("message.your.ownership.granted")); } public void ownershipRevoked() { insertText(Res.getString("message.your.ownership.revoked")); } public void adminGranted() { insertText(Res.getString("message.your.admin.granted")); } public void adminRevoked() { insertText(Res.getString("message.your.revoked.granted")); } }); chat.addSubjectUpdatedListener(new SubjectListener()); }
| 3,231,473
|
public void voiceGranted() { insertText(Res.getString("message.your.voice.revoked")); getChatInputEditor().setEnabled(true); }
|
public void voiceGranted() { insertText(Res.getString("message.your.voice.granted")); getChatInputEditor().setEnabled(true); }
| 3,231,474
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); RosterEntry entry = roster.getEntry(participantJID); if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText("View information about this user"); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText("Add this user to your roster."); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); RosterEntry entry = roster.getEntry(participantJID); if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText("View information about this user"); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText("Add this user to your roster."); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
| 3,231,475
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); RosterEntry entry = roster.getEntry(participantJID); if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText("View information about this user"); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText("Add this user to your roster."); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(presence); RosterEntry entry = roster.getEntry(participantJID); if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { String status = presence.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(presence); if (icon != null) { tabIcon = icon; } PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText("View information about this user"); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText("Add this user to your roster."); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
| 3,231,476
|
public void actionPerformed(ActionEvent e) { int index = -1; try { index = Integer.parseInt(e.getActionCommand()); switch (index) { case SAVE: save(); break; case CANCEL: cancel(); break; case SELECT_IMAGE: selectImage(); break; case RESET_SELECT_IMAGE: resetSelectionImage(); break; case SHOW_IMAGES: showImages();; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } }
|
public void actionPerformed(ActionEvent e) { int index = -1; try { index = Integer.parseInt(e.getActionCommand()); switch (index) { case SAVE: save(); break; case CANCEL: cancel(); break; case SELECT_IMAGE: selectImage(); break; case RESET_SELECT_IMAGE: resetSelectionImage(); break; case SHOW_IMAGES: showImages(); break; case IMAGES_SELECTION: bringSelector(e); break; } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } }
| 3,231,477
|
private void showImages() { CategoryGroupData group = (CategoryGroupData) view.getExistingGroups().getSelectedItem(); int selectedIndex = view.getImagesSelection().getSelectedIndex(); if (selectedIndex != selectionIndex) { selectionIndex = selectedIndex; List images = null; switch (selectedIndex) { case CreateCategoryImagesPane.IMAGES_IMPORTED: images = control.getImagesNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_GROUP: images = control.getImagesInUserGroupNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_SYSTEM: images = control.getImagesInSystemNotInCategoryGroup(group); break; } if (images == null || images.size() == 0) return; view.showImages(images); } }
|
private void showImages() { CategoryGroupData group = (CategoryGroupData) view.getExistingGroups().getSelectedItem(); int selectedIndex = view.getImagesSelection().getSelectedIndex(); if (selectedIndex != selectionIndex) { selectionIndex = selectedIndex; List images = null; switch (selectedIndex) { case CreateCategoryImagesPane.IMAGES_IMPORTED: images = control.getImagesNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_GROUP: images = control.getImagesInUserGroupNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_SYSTEM: images = control.getImagesInSystemNotInCategoryGroup(group); break; } if (images == null || images.size() == 0) return; view.showImages(images); } }
| 3,231,479
|
private void showImages() { CategoryGroupData group = (CategoryGroupData) view.getExistingGroups().getSelectedItem(); int selectedIndex = view.getImagesSelection().getSelectedIndex(); if (selectedIndex != selectionIndex) { selectionIndex = selectedIndex; List images = null; switch (selectedIndex) { case CreateCategoryImagesPane.IMAGES_IMPORTED: images = control.getImagesNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_GROUP: images = control.getImagesInUserGroupNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_SYSTEM: images = control.getImagesInSystemNotInCategoryGroup(group); break; } if (images == null || images.size() == 0) return; view.showImages(images); } }
|
private void showImages() { CategoryGroupData group = (CategoryGroupData) view.getExistingGroups().getSelectedItem(); int selectedIndex = view.getImagesSelection().getSelectedIndex(); if (selectedIndex != selectionIndex) { selectionIndex = selectedIndex; List images = null; switch (selectedIndex) { case CreateCategoryImagesPane.IMAGES_IMPORTED: images = control.getImagesNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_USED: images = control.getImagesInUserDatasetsNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_GROUP: images = control.getImagesInUserGroupNotInCategoryGroup(group); break; case CreateCategoryImagesPane.IMAGES_SYSTEM: images = control.getImagesInSystemNotInCategoryGroup(group); break; } if (images == null || images.size() == 0) return; view.showImages(images); } }
| 3,231,480
|
public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (ImViewer.Z_SELECTED_PROPERTY.equals(propName)) { view.setZSection(((Integer) pce.getNewValue()).intValue()); } else if (ImViewer.T_SELECTED_PROPERTY.equals(propName)) { view.setTimepoint(((Integer) pce.getNewValue()).intValue()); } else if (ChannelButton.CHANNEL_SELECTED_PROPERTY.equals(propName)) { Map map = (Map) pce.getNewValue(); if (map == null) return; if (map.size() != 1) return; Iterator i = map.keySet().iterator(); Integer index; while (i.hasNext()) { index = (Integer) i.next(); model.setChannelSelection(index.intValue(), ((Boolean) map.get(index)).booleanValue()); } } else if (ZoomAction.ZOOM_PROPERTY.equals(propName)) { view.setZoomFactor((ViewerAction) pce.getNewValue()); } else if (RateImageAction.RATE_IMAGE_PROPERTY.equals(propName)) { view.setRatingFactor((ViewerAction) pce.getNewValue()); } else if (LoadingWindow.CLOSED_PROPERTY.equals(propName)) { model.discard(); } else if (Renderer.RENDER_PLANE_PROPERTY.equals(propName)) { model.renderXYPlane(); } else if (Renderer.SELECTED_CHANNEL_PROPERTY.equals(propName)) { if (model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL)) { int c = ((Integer) pce.getNewValue()).intValue(); for (int i = 0; i < model.getMaxC(); i++) model.setChannelActive(i, i == c); model.displayChannelMovie(); } } else if (ChannelButton.INFO_PROPERTY.equals(propName)) { int index = ((Integer) pce.getNewValue()).intValue(); ChannelMetadata data = model.getChannelMetadata(index); if (data != null) { InfoDialog dialog = new InfoDialog(model.getUI(), data); dialog.addPropertyChangeListener(this); UIUtilities.setLocationRelativeToAndShow(view, dialog); } else { UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); un.notifyInfo("Channel info", "No metadata for the " + "selected channel."); } } else if (ChannelButton.CHANNEL_COLOR_PROPERTY.equals(propName)) { colorPickerIndex = ((Integer) pce.getNewValue()).intValue(); Color c = model.getChannelColor(colorPickerIndex); ColourPicker dialog = new ColourPicker(view, c); dialog.addPropertyChangeListener(this); UIUtilities.setLocationRelativeToAndShow(view, dialog); } else if (ColourPicker.COLOUR_PROPERTY.equals(propName)) { Color c = (Color) pce.getNewValue(); if (colorPickerIndex != -1) { model.setChannelColor(colorPickerIndex, c); } } else if (UnitBarSizeDialog.UNIT_BAR_VALUE_PROPERTY.equals(propName)) { double v = ((Double) pce.getNewValue()).doubleValue(); model.setUnitBarSize(v); } else if (InfoDialog.UPDATE_PROPERTY.equals(propName)) { //TODO: implement method } }
|
public void propertyChange(PropertyChangeEvent pce) { String propName = pce.getPropertyName(); if (ImViewer.Z_SELECTED_PROPERTY.equals(propName)) { view.setZSection(((Integer) pce.getNewValue()).intValue()); } else if (ImViewer.T_SELECTED_PROPERTY.equals(propName)) { view.setTimepoint(((Integer) pce.getNewValue()).intValue()); } else if (ChannelButton.CHANNEL_SELECTED_PROPERTY.equals(propName)) { Map map = (Map) pce.getNewValue(); if (map == null) return; if (map.size() != 1) return; Iterator i = map.keySet().iterator(); Integer index; while (i.hasNext()) { index = (Integer) i.next(); model.setChannelSelection(index.intValue(), ((Boolean) map.get(index)).booleanValue()); } } else if (ZoomAction.ZOOM_PROPERTY.equals(propName)) { view.setZoomFactor((ViewerAction) pce.getNewValue()); } else if (RateImageAction.RATE_IMAGE_PROPERTY.equals(propName)) { view.setRatingFactor((ViewerAction) pce.getNewValue()); } else if (LoadingWindow.CLOSED_PROPERTY.equals(propName)) { model.discard(); } else if (Renderer.RENDER_PLANE_PROPERTY.equals(propName)) { model.renderXYPlane(); } else if (Renderer.SELECTED_CHANNEL_PROPERTY.equals(propName)) { if (model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL)) { int c = ((Integer) pce.getNewValue()).intValue(); for (int i = 0; i < model.getMaxC(); i++) model.setChannelActive(i, i == c); model.displayChannelMovie(); } } else if (ChannelButton.INFO_PROPERTY.equals(propName)) { int index = ((Integer) pce.getNewValue()).intValue(); ChannelMetadata data = model.getChannelMetadata(index); if (data != null) { InfoDialog dialog = new InfoDialog(model.getUI(), data); dialog.addPropertyChangeListener(this); UIUtilities.setLocationRelativeToAndShow(view, dialog); } else { UserNotifier un = ImViewerAgent.getRegistry().getUserNotifier(); un.notifyInfo("Channel info", "No metadata for the " + "selected channel."); } } else if (ChannelButton.CHANNEL_COLOR_PROPERTY.equals(propName) || ChannelColorMenuItem.CHANNEL_COLOR_PROPERTY.equals(propName)) { colorPickerIndex = ((Integer) pce.getNewValue()).intValue(); Color c = model.getChannelColor(colorPickerIndex); ColourPicker dialog = new ColourPicker(view, c); dialog.addPropertyChangeListener(this); UIUtilities.setLocationRelativeToAndShow(view, dialog); } else if (ColourPicker.COLOUR_PROPERTY.equals(propName)) { Color c = (Color) pce.getNewValue(); if (colorPickerIndex != -1) { model.setChannelColor(colorPickerIndex, c); } } else if (UnitBarSizeDialog.UNIT_BAR_VALUE_PROPERTY.equals(propName)) { double v = ((Double) pce.getNewValue()).doubleValue(); model.setUnitBarSize(v); } else if (InfoDialog.UPDATE_PROPERTY.equals(propName)) { //TODO: implement method } }
| 3,231,482
|
public String toString(){ return "AnalysisNodeExecution"+(analysisNodeExecutionId==null ? ":Hash"+this.hashCode() : ":"+analysisNodeExecutionId); }
|
public String toString(){ return "AnalysisNodeExecution"+(analysisNodeExecutionId==null ? ":Hash_"+this.hashCode() : ":Id_"+analysisNodeExecutionId); }
| 3,231,483
|
public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
|
public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Dialog", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
| 3,231,484
|
public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
|
public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
| 3,231,485
|
public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
|
public ReceiveMessage() { setLayout(new GridBagLayout()); setBackground(new Color(250, 249, 242)); add(imageLabel, new GridBagConstraints(0, 0, 1, 3, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(titleLabel, new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); titleLabel.setFont(new Font("Verdana", Font.BOLD, 11)); titleLabel.setForeground(new Color(211, 174, 102)); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); add(acceptLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(declineLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); ResourceUtils.resButton(acceptLabel, "Accept"); ResourceUtils.resButton(declineLabel, "Reject"); // Decorate Cancel Button decorateCancelButton(); acceptLabel.setForeground(new Color(73, 113, 196)); declineLabel.setForeground(new Color(73, 113, 196)); declineLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setFont(new Font("Verdana", Font.BOLD, 10)); acceptLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); declineLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.white)); acceptLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { acceptLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { declineLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
| 3,231,486
|
public void acceptFileTransfer(final FileTransferRequest request) { String fileName = request.getFileName(); long fileSize = request.getFileSize(); String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText(contactItem.getNickname() + " is sending you a file."); File tempFile = new File(Spark.getUserHome(), "Spark/tmp"); try { tempFile.mkdirs(); File file = new File(tempFile, fileName); file.delete(); BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("a"); out.close(); imageLabel.setIcon(GraphicUtils.getIcon(file)); // Delete temp file when program exits. file.delete(); } catch (IOException e) { imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); Log.error(e); } acceptLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { acceptRequest(request); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { rejectRequest(request); } }); }
|
public void acceptFileTransfer(final FileTransferRequest request) { String fileName = request.getFileName(); long fileSize = request.getFileSize(); String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ByteFormat format = new ByteFormat(); String text = format.format(fileSize); fileLabel.setText(fileName + " (" + text + ")"); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText(Res.getString("message.user.is.sending.you.a.file", contactItem.getNickname())); File tempFile = new File(Spark.getUserHome(), "Spark/tmp"); try { tempFile.mkdirs(); File file = new File(tempFile, fileName); file.delete(); BufferedWriter out = new BufferedWriter(new FileWriter(file)); out.write("a"); out.close(); imageLabel.setIcon(GraphicUtils.getIcon(file)); // Delete temp file when program exits. file.delete(); } catch (IOException e) { imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); Log.error(e); } acceptLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { acceptRequest(request); } }); declineLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { rejectRequest(request); } }); }
| 3,231,487
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText(Res.getString("message.negotiate.file.transfer")); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,488
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,489
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,490
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,491
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,492
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.error) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,493
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = Res.getString("message.error.during.file.transfer"); } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,494
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,495
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.cancelled || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,496
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
|
private void acceptRequest(final FileTransferRequest request) { String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactList contactList = SparkManager.getWorkspace().getContactList(); final ContactItem contactItem = contactList.getContactItemByJID(bareJID); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); titleLabel.setText("Negotiating file transfer. Please wait..."); titleLabel.setForeground(new Color(65, 139, 179)); add(progressBar, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 150, 0)); add(cancelButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); cancelButton.setVisible(true); transfer = request.accept(); try { Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); progressBar.setMaximum((int)request.getFileSize()); progressBar.setStringPainted(true); SwingWorker worker = new SwingWorker() { public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; } public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = Res.getString("message.transfer.cancelled"); } setFinishedText(transferMessage); showAlert(true); } }; worker.start(); } catch (Exception e) { Log.error(e); } }
| 3,231,497
|
public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; }
|
public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; }
| 3,231,498
|
public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; }
|
public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; }
| 3,231,499
|
public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; }
|
public Object construct() { try { transfer.recieveFile(downloadedFile); } catch (XMPPException e) { Log.error(e); } while (true) { try { Thread.sleep(10); } catch (InterruptedException e) { Log.error(e); } long bytesRead = transfer.getAmountWritten(); if (bytesRead == -1) { bytesRead = 0; } ByteFormat format = new ByteFormat(); String text = format.format(bytesRead); progressBar.setString(text + " received"); progressBar.setValue((int)bytesRead); FileTransfer.Status status = transfer.getStatus(); if (status == FileTransfer.Status.ERROR || status == FileTransfer.Status.COMPLETE || status == FileTransfer.Status.CANCLED || status == FileTransfer.Status.REFUSED) { break; } else if (status == FileTransfer.Status.NEGOTIATING_STREAM) { titleLabel.setText("Negotiating connection stream. Please wait..."); } else if (status == FileTransfer.Status.IN_PROGRESS) { titleLabel.setText("You are receiving a file from " + contactItem.getNickname()); } } return "ok"; }
| 3,231,500
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
| 3,231,501
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.error) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
| 3,231,502
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = Res.getString("message.error.during.file.transfer"); } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
| 3,231,503
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
| 3,231,504
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.cancelled || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
| 3,231,505
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = "The file transfer was cancelled."; } setFinishedText(transferMessage); showAlert(true); }
|
public void finished() { if (transfer.getAmountWritten() >= request.getFileSize()) { transferDone(request, transfer); imageLabel.setToolTipText("Click to open"); titleLabel.setToolTipText("Click to open"); imageLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); imageLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { imageLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { openFile(downloadedFile); } } }); titleLabel.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { titleLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); invalidate(); validate(); repaint(); return; } String transferMessage = ""; if (transfer.getStatus() == FileTransfer.Status.ERROR) { if (transfer.getException() != null) { Log.error("There was an error during file transfer.", transfer.getException()); } transferMessage = "There was an error during file transfer."; } else if (transfer.getStatus() == FileTransfer.Status.REFUSED) { transferMessage = "The file transfer was refused."; } else if (transfer.getStatus() == FileTransfer.Status.CANCLED || transfer.getAmountWritten() < request.getFileSize()) { transferMessage = Res.getString("message.transfer.cancelled"); } setFinishedText(transferMessage); showAlert(true); }
| 3,231,506
|
private void decorateCancelButton() { cancelButton.setVisible(false); ResourceUtils.resButton(cancelButton, "Cancel"); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelTransfer(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
|
private void decorateCancelButton() { cancelButton.setVisible(false); ResourceUtils.resButton(cancelButton, Res.getString("cancel")); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelTransfer(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
| 3,231,507
|
private void decorateCancelButton() { cancelButton.setVisible(false); ResourceUtils.resButton(cancelButton, "Cancel"); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Verdana", Font.BOLD, 10)); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelTransfer(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
|
private void decorateCancelButton() { cancelButton.setVisible(false); ResourceUtils.resButton(cancelButton, "Cancel"); cancelButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); cancelButton.setForeground(new Color(73, 113, 196)); cancelButton.setFont(new Font("Dialog", Font.BOLD, 10)); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelTransfer(); } }); cancelButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { cancelButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); }
| 3,231,508
|
private void rejectRequest(FileTransferRequest request) { request.reject(); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); fileLabel.setText(""); titleLabel.setText("You have cancelled the file transfer."); titleLabel.setForeground(new Color(65, 139, 179)); invalidate(); validate(); repaint(); }
|
private void rejectRequest(FileTransferRequest request) { request.reject(); setBackground(new Color(239, 245, 250)); acceptLabel.setText(""); declineLabel.setText(""); fileLabel.setText(""); titleLabel.setText(Res.getString("message.file.transfer.canceled")); titleLabel.setForeground(new Color(65, 139, 179)); invalidate(); validate(); repaint(); }
| 3,231,509
|
private void showPopup(MouseEvent e, final File downloadedFile) { if (e.isPopupTrigger()) { final JPopupMenu popup = new JPopupMenu(); final ReceiveMessage ui = this; Action saveAsAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { final JFileChooser chooser = Downloads.getInstance().getFileChooser(); File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { selectedFile = new File(selectedFile.getParent(), downloadedFile.getName()); } else { selectedFile = downloadedFile; } chooser.setSelectedFile(selectedFile); int ok = chooser.showSaveDialog(ui); if (ok == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { if (file.exists()) { int confirm = JOptionPane.showConfirmDialog(ui, "The file already exists. Overwrite?", "File Exists", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { return; } } URLFileSystem.copy(downloadedFile.toURL(), file); } catch (IOException e1) { Log.error(e1); } } } }; saveAsAction.putValue(Action.NAME, "Save As..."); popup.add(saveAsAction); popup.show(this, e.getX(), e.getY()); } }
|
private void showPopup(MouseEvent e, final File downloadedFile) { if (e.isPopupTrigger()) { final JPopupMenu popup = new JPopupMenu(); final ReceiveMessage ui = this; Action saveAsAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { final JFileChooser chooser = Downloads.getInstance().getFileChooser(); File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { selectedFile = new File(selectedFile.getParent(), downloadedFile.getName()); } else { selectedFile = downloadedFile; } chooser.setSelectedFile(selectedFile); int ok = chooser.showSaveDialog(ui); if (ok == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { if (file.exists()) { int confirm = JOptionPane.showConfirmDialog(ui, Res.getString("message.file.exists.question"), Res.getString("title.file.exists"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { return; } } URLFileSystem.copy(downloadedFile.toURL(), file); } catch (IOException e1) { Log.error(e1); } } } }; saveAsAction.putValue(Action.NAME, "Save As..."); popup.add(saveAsAction); popup.show(this, e.getX(), e.getY()); } }
| 3,231,510
|
private void showPopup(MouseEvent e, final File downloadedFile) { if (e.isPopupTrigger()) { final JPopupMenu popup = new JPopupMenu(); final ReceiveMessage ui = this; Action saveAsAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { final JFileChooser chooser = Downloads.getInstance().getFileChooser(); File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { selectedFile = new File(selectedFile.getParent(), downloadedFile.getName()); } else { selectedFile = downloadedFile; } chooser.setSelectedFile(selectedFile); int ok = chooser.showSaveDialog(ui); if (ok == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { if (file.exists()) { int confirm = JOptionPane.showConfirmDialog(ui, "The file already exists. Overwrite?", "File Exists", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { return; } } URLFileSystem.copy(downloadedFile.toURL(), file); } catch (IOException e1) { Log.error(e1); } } } }; saveAsAction.putValue(Action.NAME, "Save As..."); popup.add(saveAsAction); popup.show(this, e.getX(), e.getY()); } }
|
private void showPopup(MouseEvent e, final File downloadedFile) { if (e.isPopupTrigger()) { final JPopupMenu popup = new JPopupMenu(); final ReceiveMessage ui = this; Action saveAsAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { final JFileChooser chooser = Downloads.getInstance().getFileChooser(); File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { selectedFile = new File(selectedFile.getParent(), downloadedFile.getName()); } else { selectedFile = downloadedFile; } chooser.setSelectedFile(selectedFile); int ok = chooser.showSaveDialog(ui); if (ok == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { if (file.exists()) { int confirm = JOptionPane.showConfirmDialog(ui, "The file already exists. Overwrite?", "File Exists", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { return; } } URLFileSystem.copy(downloadedFile.toURL(), file); } catch (IOException e1) { Log.error(e1); } } } }; saveAsAction.putValue(Action.NAME, Res.getString("menuitem.save.as")); popup.add(saveAsAction); popup.show(this, e.getX(), e.getY()); } }
| 3,231,511
|
public void actionPerformed(ActionEvent e) { final JFileChooser chooser = Downloads.getInstance().getFileChooser(); File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { selectedFile = new File(selectedFile.getParent(), downloadedFile.getName()); } else { selectedFile = downloadedFile; } chooser.setSelectedFile(selectedFile); int ok = chooser.showSaveDialog(ui); if (ok == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { if (file.exists()) { int confirm = JOptionPane.showConfirmDialog(ui, "The file already exists. Overwrite?", "File Exists", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { return; } } URLFileSystem.copy(downloadedFile.toURL(), file); } catch (IOException e1) { Log.error(e1); } } }
|
public void actionPerformed(ActionEvent e) { final JFileChooser chooser = Downloads.getInstance().getFileChooser(); File selectedFile = chooser.getSelectedFile(); if (selectedFile != null) { selectedFile = new File(selectedFile.getParent(), downloadedFile.getName()); } else { selectedFile = downloadedFile; } chooser.setSelectedFile(selectedFile); int ok = chooser.showSaveDialog(ui); if (ok == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { if (file.exists()) { int confirm = JOptionPane.showConfirmDialog(ui, Res.getString("message.file.exists.question"), Res.getString("title.file.exists"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (confirm == JOptionPane.NO_OPTION) { return; } } URLFileSystem.copy(downloadedFile.toURL(), file); } catch (IOException e1) { Log.error(e1); } } }
| 3,231,512
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText(Res.getString("message.received.file", contactItem.getNickname())); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
| 3,231,513
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
| 3,231,514
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Dialog", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
| 3,231,515
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Verdana", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
|
private void transferDone(final FileTransferRequest request, FileTransfer transfer) { cancelButton.setVisible(false); showAlert(true); String bareJID = StringUtils.parseBareAddress(request.getRequestor()); ContactList contactList = SparkManager.getWorkspace().getContactList(); ContactItem contactItem = contactList.getContactItemByJID(bareJID); titleLabel.setText("You have received a file from " + contactItem.getNickname() + "."); fileLabel.setText(request.getFileName()); remove(acceptLabel); remove(declineLabel); remove(progressBar); final TransferButton openFileButton = new TransferButton(); final TransferButton openFolderButton = new TransferButton(); add(openFileButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); add(openFolderButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0)); Downloads downloads = Downloads.getInstance(); final File downloadedFile = new File(downloads.getDownloadDirectory(), request.getFileName()); openFileButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFileButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); openFolderButton.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); } public void mouseExited(MouseEvent e) { openFolderButton.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); add(fileLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); ResourceUtils.resButton(openFileButton, "Open"); ResourceUtils.resButton(openFolderButton, "Open Folder"); openFileButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFileButton.setForeground(new Color(73, 113, 196)); openFileButton.setFont(new Font("Verdana", Font.BOLD, 10)); openFolderButton.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(73, 113, 196))); openFolderButton.setForeground(new Color(73, 113, 196)); openFolderButton.setFont(new Font("Dialog", Font.BOLD, 10)); imageLabel.setIcon(GraphicUtils.getIcon(downloadedFile)); imageLabel.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { showPopup(e, downloadedFile); } public void mouseReleased(MouseEvent e) { showPopup(e, downloadedFile); } }); openFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { openFile(downloadedFile); } }); openFolderButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { try { Downloads downloads = Downloads.getInstance(); if (!Spark.isMac()) { try { Desktop.open(downloads.getDownloadDirectory()); } catch (DesktopException e) { Log.error(e); } } else if (Spark.isMac()) { Runtime.getRuntime().exec("open " + downloads.getDownloadDirectory().getCanonicalPath()); } } catch (IOException e1) { Log.error(e1); } } }); if (isImage(downloadedFile.getName())) { try { URL imageURL = downloadedFile.toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image); } catch (MalformedURLException e) { Log.error("Could not locate image.", e); imageLabel.setIcon(SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32)); } } invalidate(); validate(); repaint(); }
| 3,231,516
|
public static Test suite() { TestSuite suite = new TestSuite(); Ruby ruby = Ruby.getDefaultInstance(null); ruby.initLoad(new ArrayList()); suite.addTest(new ScriptTest(ruby, "testRegexp")); suite.addTest(new ScriptTest(ruby, "testStringEval")); suite.addTest(new ScriptTest(ruby, "testHereDocument")); suite.addTest(new ScriptTest(ruby, "testClass"));// suite.addTest(new ScriptTest(ruby, "testArray")); suite.addTest(new ScriptTest(ruby, "testVariableAndMethod")); suite.addTest(new ScriptTest(ruby, "testIf")); suite.addTest(new ScriptTest(ruby, "testLoops")); suite.addTest(new ScriptTest(ruby, "testMethods")); suite.addTest(new ScriptTest(ruby, "testGlobalVars")); suite.addTest(new ScriptTest(ruby, "testClasses")); suite.addTest(new ScriptTest(ruby, "testNumber")); suite.addTest(new ScriptTest(ruby, "testFloat")); suite.addTest(new ScriptTest(ruby, "testBlock")); suite.addTest(new ScriptTest(ruby, "testRange")); suite.addTest(new ScriptTest(ruby, "testString"));// suite.addTest(new ScriptTest(ruby, "testException"));// suite.addTest(new ScriptTest(ruby, "testSpecialVar")); suite.addTest(new ScriptTest(ruby, "testFile")); suite.addTest(new ScriptTest(ruby, "testMarshal")); suite.addTest(new ScriptTest(ruby, "testHash")); suite.addTest(new ScriptTest(ruby, "testSymbol")); suite.addTest(new ScriptTest(ruby, "testRandom")); return suite; }
|
public static Test suite() { TestSuite suite = new TestSuite(); Ruby ruby = Ruby.getDefaultInstance(null); ruby.initLoad(new ArrayList()); suite.addTest(new ScriptTest(ruby, "testRegexp")); suite.addTest(new ScriptTest(ruby, "testStringEval")); suite.addTest(new ScriptTest(ruby, "testHereDocument")); suite.addTest(new ScriptTest(ruby, "testClass"));// suite.addTest(new ScriptTest(ruby, "testArray")); suite.addTest(new ScriptTest(ruby, "testVariableAndMethod")); suite.addTest(new ScriptTest(ruby, "testIf")); suite.addTest(new ScriptTest(ruby, "testLoops")); suite.addTest(new ScriptTest(ruby, "testMethods")); suite.addTest(new ScriptTest(ruby, "testGlobalVars")); suite.addTest(new ScriptTest(ruby, "testClasses")); suite.addTest(new ScriptTest(ruby, "testNumber")); suite.addTest(new ScriptTest(ruby, "testFloat")); suite.addTest(new ScriptTest(ruby, "testBlock")); suite.addTest(new ScriptTest(ruby, "testRange")); suite.addTest(new ScriptTest(ruby, "testString"));// suite.addTest(new ScriptTest(ruby, "testException"));// suite.addTest(new ScriptTest(ruby, "testSpecialVar")); suite.addTest(new ScriptTest(ruby, "testFile")); suite.addTest(new ScriptTest(ruby, "testMarshal")); suite.addTest(new ScriptTest(ruby, "testHash")); suite.addTest(new ScriptTest(ruby, "testSymbol")); suite.addTest(new ScriptTest(ruby, "testRandom")); return suite; }
| 3,231,517
|
private boolean attempt() { UserCredentials uc = config.getCredentials(); try { if (uc == null) throw new DSOutOfServiceException( "No user's credentials have been entered yet."); //NOTE: This will never happen if the Splash Screen always blocks //waiting for the user's credentials and the login dialog never //passes null credentials along. DataServicesFactory factory = DataServicesFactory.getInstance( container); if (factory.isConnected()) return true; factory.connect(uc); //Log success. LogMessage msg = new LogMessage(); msg.println("Logged onto OMERO at: "+uc.getHostName()); msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.info(this, msg); Preferences userPrefs = Preferences.userNodeForPackage(LoginConfig.class); String servers = null; servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers); String listOfServers = null; if (servers == null) { listOfServers = uc.getHostName(); } else { String[] l = servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0); if (l == null || l.length == 0) { listOfServers = uc.getHostName(); } else { int n = l.length-1; String name = uc.getHostName(); String host; String list = null; for (int index = 0; index < l.length; index++) { host = l[index].trim(); if (!name.equals(host)) { if (index == 0) list = host; else list += host; if (index != n) list += ","; } } listOfServers = uc.getHostName()+","+list; } } if (listOfServers != null) { userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers); } return true; } catch (DSOutOfServiceException dsose) { //Log failure. LogMessage msg = new LogMessage(); msg.println("Failed to log onto OMERO."); msg.println("Reason: "+dsose); msg.println("OMERO Address: "+uc.getHostName()); if (uc != null) msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.error(this, msg); } return false; }
|
private boolean attempt() { UserCredentials uc = config.getCredentials(); try { if (uc == null) throw new DSOutOfServiceException( "No user's credentials have been entered yet."); //NOTE: This will never happen if the Splash Screen always blocks //waiting for the user's credentials and the login dialog never //passes null credentials along. DataServicesFactory factory = DataServicesFactory.getInstance( container); if (factory.isConnected()) return true; factory.connect(uc); //Log success. LogMessage msg = new LogMessage(); msg.println("Logged onto OMERO at: "+uc.getHostName()); msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.info(this, msg); Preferences userPrefs = Preferences.userNodeForPackage(LoginConfig.class); String servers = null; servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers); String listOfServers = null; if (servers == null) { listOfServers = uc.getHostName(); } else { String[] l = servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0); if (l == null || l.length == 0) { listOfServers = uc.getHostName(); } else { int n = l.length-1; String name = uc.getHostName(); String host; String list = ""; for (int index = 0; index < l.length; index++) { host = l[index].trim(); if (!name.equals(host)) { if (index == 0) list = host; else list += host; if (index != n) list += ","; } } listOfServers = uc.getHostName()+","+list; } } if (listOfServers != null) { userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers); } return true; } catch (DSOutOfServiceException dsose) { //Log failure. LogMessage msg = new LogMessage(); msg.println("Failed to log onto OMERO."); msg.println("Reason: "+dsose); msg.println("OMERO Address: "+uc.getHostName()); if (uc != null) msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.error(this, msg); } return false; }
| 3,231,519
|
private boolean attempt() { UserCredentials uc = config.getCredentials(); try { if (uc == null) throw new DSOutOfServiceException( "No user's credentials have been entered yet."); //NOTE: This will never happen if the Splash Screen always blocks //waiting for the user's credentials and the login dialog never //passes null credentials along. DataServicesFactory factory = DataServicesFactory.getInstance( container); if (factory.isConnected()) return true; factory.connect(uc); //Log success. LogMessage msg = new LogMessage(); msg.println("Logged onto OMERO at: "+uc.getHostName()); msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.info(this, msg); Preferences userPrefs = Preferences.userNodeForPackage(LoginConfig.class); String servers = null; servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers); String listOfServers = null; if (servers == null) { listOfServers = uc.getHostName(); } else { String[] l = servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0); if (l == null || l.length == 0) { listOfServers = uc.getHostName(); } else { int n = l.length-1; String name = uc.getHostName(); String host; String list = null; for (int index = 0; index < l.length; index++) { host = l[index].trim(); if (!name.equals(host)) { if (index == 0) list = host; else list += host; if (index != n) list += ","; } } listOfServers = uc.getHostName()+","+list; } } if (listOfServers != null) { userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers); } return true; } catch (DSOutOfServiceException dsose) { //Log failure. LogMessage msg = new LogMessage(); msg.println("Failed to log onto OMERO."); msg.println("Reason: "+dsose); msg.println("OMERO Address: "+uc.getHostName()); if (uc != null) msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.error(this, msg); } return false; }
|
private boolean attempt() { UserCredentials uc = config.getCredentials(); try { if (uc == null) throw new DSOutOfServiceException( "No user's credentials have been entered yet."); //NOTE: This will never happen if the Splash Screen always blocks //waiting for the user's credentials and the login dialog never //passes null credentials along. DataServicesFactory factory = DataServicesFactory.getInstance( container); if (factory.isConnected()) return true; factory.connect(uc); //Log success. LogMessage msg = new LogMessage(); msg.println("Logged onto OMERO at: "+uc.getHostName()); msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.info(this, msg); Preferences userPrefs = Preferences.userNodeForPackage(LoginConfig.class); String servers = null; servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers); String listOfServers = null; if (servers == null) { listOfServers = uc.getHostName(); } else { String[] l = servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0); if (l == null || l.length == 0) { listOfServers = uc.getHostName(); } else { int n = l.length-1; String name = uc.getHostName(); String host; String list = null; for (int index = 0; index < l.length; index++) { host = l[index].trim(); if (!name.equals(host)) { if (index == 0) list = host; else list += host; if (index != n) list += ","; } } listOfServers = uc.getHostName()+","+list; } } if (listOfServers != null) { userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers); } return true; } catch (DSOutOfServiceException dsose) { //Log failure. LogMessage msg = new LogMessage(); msg.println("Failed to log onto OMERO."); msg.println("Reason: "+dsose); msg.println("OMERO Address: "+uc.getHostName()); if (uc != null) msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.error(this, msg); } return false; }
| 3,231,520
|
private boolean attempt() { UserCredentials uc = config.getCredentials(); try { if (uc == null) throw new DSOutOfServiceException( "No user's credentials have been entered yet."); //NOTE: This will never happen if the Splash Screen always blocks //waiting for the user's credentials and the login dialog never //passes null credentials along. DataServicesFactory factory = DataServicesFactory.getInstance( container); if (factory.isConnected()) return true; factory.connect(uc); //Log success. LogMessage msg = new LogMessage(); msg.println("Logged onto OMERO at: "+uc.getHostName()); msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.info(this, msg); Preferences userPrefs = Preferences.userNodeForPackage(LoginConfig.class); String servers = null; servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers); String listOfServers = null; if (servers == null) { listOfServers = uc.getHostName(); } else { String[] l = servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0); if (l == null || l.length == 0) { listOfServers = uc.getHostName(); } else { int n = l.length-1; String name = uc.getHostName(); String host; String list = null; for (int index = 0; index < l.length; index++) { host = l[index].trim(); if (!name.equals(host)) { if (index == 0) list = host; else list += host; if (index != n) list += ","; } } listOfServers = uc.getHostName()+","+list; } } if (listOfServers != null) { userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers); } return true; } catch (DSOutOfServiceException dsose) { //Log failure. LogMessage msg = new LogMessage(); msg.println("Failed to log onto OMERO."); msg.println("Reason: "+dsose); msg.println("OMERO Address: "+uc.getHostName()); if (uc != null) msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.error(this, msg); } return false; }
|
private boolean attempt() { UserCredentials uc = config.getCredentials(); try { if (uc == null) throw new DSOutOfServiceException( "No user's credentials have been entered yet."); //NOTE: This will never happen if the Splash Screen always blocks //waiting for the user's credentials and the login dialog never //passes null credentials along. DataServicesFactory factory = DataServicesFactory.getInstance( container); if (factory.isConnected()) return true; factory.connect(uc); //Log success. LogMessage msg = new LogMessage(); msg.println("Logged onto OMERO at: "+uc.getHostName()); msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.info(this, msg); Preferences userPrefs = Preferences.userNodeForPackage(LoginConfig.class); String servers = null; servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers); String listOfServers = null; if (servers == null) { listOfServers = uc.getHostName(); } else { String[] l = servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0); if (l == null || l.length == 0) { listOfServers = uc.getHostName(); } else { int n = l.length-1; String name = uc.getHostName(); String host; String list = null; for (int index = 0; index < l.length; index++) { host = l[index].trim(); if (!name.equals(host)) { if (index == 0) list = host; else list += host; if (index != n) list += ","; } } listOfServers = uc.getHostName()+ LoginConfig.SERVER_NAME_SEPARATOR+list; } } if (listOfServers != null) { userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers); } return true; } catch (DSOutOfServiceException dsose) { //Log failure. LogMessage msg = new LogMessage(); msg.println("Failed to log onto OMERO."); msg.println("Reason: "+dsose); msg.println("OMERO Address: "+uc.getHostName()); if (uc != null) msg.println(uc); Logger logger = container.getRegistry().getLogger(); logger.error(this, msg); } return false; }
| 3,231,521
|
public void sortBy(int index) { model.getSorter().setByDate(SortByAction.BY_DATE == index); view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Browser browser = getBrowser(); switch (browser.getSelectedLayout()) { case LayoutFactory.SQUARY_LAYOUT: browser.accept(LayoutFactory.createLayout( LayoutFactory.SQUARY_LAYOUT, model.getSorter()), ImageDisplayVisitor.IMAGE_SET_ONLY); break; case LayoutFactory.FLAT_LAYOUT: browser.resetChildDisplay(); Layout l = LayoutFactory.createLayout(LayoutFactory.FLAT_LAYOUT, model.getSorter()); browser.accept(l); l.doLayout(); } model.getTreeView().sortNodes(index, (ImageDisplay) model.getBrowser().getUI()); view.setCursor( Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
|
public void sortBy(int index) { model.getSorter().setByDate(SortByAction.BY_DATE == index); view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Browser browser = getBrowser(); switch (browser.getSelectedLayout()) { case LayoutFactory.SQUARY_LAYOUT: browser.accept(LayoutFactory.createLayout( LayoutFactory.SQUARY_LAYOUT, model.getSorter()), ImageDisplayVisitor.IMAGE_SET_ONLY); break; case LayoutFactory.FLAT_LAYOUT: browser.resetChildDisplay(); Layout l = LayoutFactory.createLayout(LayoutFactory.FLAT_LAYOUT, model.getSorter()); browser.accept(l); l.doLayout(); } model.getTreeView().sortNodes(index, (ImageDisplay) model.getBrowser().getUI()); view.setCursor( Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); }
| 3,231,523
|
private JPanel createChannelButtons() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); ChannelMetadata[] data = model.getChannelData(); boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); ChannelMetadata d; ChannelToggleButton channelButton; p.add(Box.createRigidArea(VBOX)); for (int j = 0; j < data.length; j++) { d = data[j]; channelButton = new ChannelToggleButton(""+d.getEmissionWavelength() , model.getChannelColor(j), j); channelList.add(channelButton); if (model.getSelectedChannel() == j) channelButton.setSelected(true); channelButton.setGrayedOut(gs); channelButton.addPropertyChangeListener(controller); channelButton.setPreferredSize(new Dimension(30, 30)); channelButton.setMinimumSize(new Dimension(30, 30)); p.add(channelButton); p.add(Box.createRigidArea(VBOX)); } return UIUtilities.buildComponentPanel(p); }
|
private JPanel createChannelButtons() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); ChannelMetadata[] data = model.getChannelData(); boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); ChannelMetadata d; ChannelToggleButton item; p.add(Box.createRigidArea(VBOX)); for (int j = 0; j < data.length; j++) { d = data[j]; channelButton = new ChannelToggleButton(""+d.getEmissionWavelength() , model.getChannelColor(j), j); channelList.add(channelButton); if (model.getSelectedChannel() == j) channelButton.setSelected(true); channelButton.setGrayedOut(gs); channelButton.addPropertyChangeListener(controller); channelButton.setPreferredSize(new Dimension(30, 30)); channelButton.setMinimumSize(new Dimension(30, 30)); p.add(channelButton); p.add(Box.createRigidArea(VBOX)); } return UIUtilities.buildComponentPanel(p); }
| 3,231,524
|
private JPanel createChannelButtons() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); ChannelMetadata[] data = model.getChannelData(); boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); ChannelMetadata d; ChannelToggleButton channelButton; p.add(Box.createRigidArea(VBOX)); for (int j = 0; j < data.length; j++) { d = data[j]; channelButton = new ChannelToggleButton(""+d.getEmissionWavelength() , model.getChannelColor(j), j); channelList.add(channelButton); if (model.getSelectedChannel() == j) channelButton.setSelected(true); channelButton.setGrayedOut(gs); channelButton.addPropertyChangeListener(controller); channelButton.setPreferredSize(new Dimension(30, 30)); channelButton.setMinimumSize(new Dimension(30, 30)); p.add(channelButton); p.add(Box.createRigidArea(VBOX)); } return UIUtilities.buildComponentPanel(p); }
|
private JPanel createChannelButtons() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); ChannelMetadata[] data = model.getChannelData(); boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); ChannelMetadata d; ChannelToggleButton channelButton; p.add(Box.createRigidArea(VBOX)); for (int j = 0; j < data.length; j++) { d = data[j]; channelButton = new ChannelToggleButton(""+d.getEmissionWavelength() , model.getChannelColor(j), j); channelList.add(channelButton); if (model.getSelectedChannel() == j) channelButton.setSelected(true); channelButton.setGrayedOut(gs); channelButton.addPropertyChangeListener(controller); channelButton.setPreferredSize(new Dimension(30, 30)); channelButton.setMinimumSize(new Dimension(30, 30)); p.add(channelButton); p.add(Box.createRigidArea(VBOX)); } return UIUtilities.buildComponentPanel(p); }
| 3,231,525
|
private JPanel createChannelButtons() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); ChannelMetadata[] data = model.getChannelData(); boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); ChannelMetadata d; ChannelToggleButton channelButton; p.add(Box.createRigidArea(VBOX)); for (int j = 0; j < data.length; j++) { d = data[j]; channelButton = new ChannelToggleButton(""+d.getEmissionWavelength() , model.getChannelColor(j), j); channelList.add(channelButton); if (model.getSelectedChannel() == j) channelButton.setSelected(true); channelButton.setGrayedOut(gs); channelButton.addPropertyChangeListener(controller); channelButton.setPreferredSize(new Dimension(30, 30)); channelButton.setMinimumSize(new Dimension(30, 30)); p.add(channelButton); p.add(Box.createRigidArea(VBOX)); } return UIUtilities.buildComponentPanel(p); }
|
private JPanel createChannelButtons() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); ChannelMetadata[] data = model.getChannelData(); boolean gs = model.getColorModel().equals(ImViewer.GREY_SCALE_MODEL); ChannelMetadata d; ChannelToggleButton channelButton; p.add(Box.createRigidArea(VBOX)); for (int j = 0; j < data.length; j++) { d = data[j]; channelButton = new ChannelToggleButton(""+d.getEmissionWavelength() , model.getChannelColor(j), j); channelList.add(channelButton); if (model.getSelectedChannel() == j) channelButton.setSelected(true); channelButton.setGrayedOut(gs); channelButton.addPropertyChangeListener(controller); channelButton.setPreferredSize(new Dimension(30, 30)); channelButton.setMinimumSize(new Dimension(30, 30)); p.add(channelButton); p.add(Box.createRigidArea(VBOX)); } return UIUtilities.buildComponentPanel(p); }
| 3,231,526
|
public void activate() { }
|
public void activate() { }
| 3,231,527
|
void showPresentation() { if (presentation != null) { topFrame.addToDesktop(presentation, TopFrame.PALETTE_LAYER); presentation.setVisible(true); } }
|
void showPresentation() { if (presentation != null) { topFrame.addToDesktop(presentation, TopFrame.PALETTE_LAYER); presentation.setVisible(true); } }
| 3,231,528
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.