rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (jj_scan_token(SLASH)) return true;
if (jj_scan_token(QCHAR)) return true;
final private boolean jj_3R_71() { if (jj_scan_token(SLASH)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (jj_3R_76()) return true;
if (jj_scan_token(SLASH)) return true;
final private boolean jj_3R_72() { if (jj_3R_76()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (jj_scan_token(QUOTE)) return true;
if (jj_3R_78()) return true;
final private boolean jj_3R_74() { if (jj_scan_token(QUOTE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (jj_scan_token(SQUOTE)) return true;
if (jj_scan_token(QUOTE)) return true;
final private boolean jj_3R_75() { if (jj_scan_token(SQUOTE)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (jj_scan_token(POUNDPOUND)) return true;
if (jj_scan_token(SQUOTE)) return true;
final private boolean jj_3R_76() { if (jj_scan_token(POUNDPOUND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
Token xsp; xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; if (jj_3R_79()) return true;
if (jj_scan_token(POUNDPOUND)) return true;
final private boolean jj_3R_77() { Token xsp; xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; if (jj_3R_79()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
} else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
final private boolean jj_3R_77() { Token xsp; xsp = jj_scanpos; if (jj_3R_78()) { jj_scanpos = xsp; if (jj_3R_79()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (jj_3R_66()) return true;
Token xsp; xsp = jj_scanpos; if (jj_3R_79()) { jj_scanpos = xsp; if (jj_3R_80()) return true;
final private boolean jj_3R_78() { if (jj_3R_66()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
} else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
final private boolean jj_3R_78() { if (jj_3R_66()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (jj_scan_token(DOLLAR)) return true;
if (jj_3R_67()) return true;
final private boolean jj_3R_79() { if (jj_scan_token(DOLLAR)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
if (!jj_semLA || jj_3R_43()) return true;
if (!jj_semLA || jj_3R_44()) return true;
final private boolean jj_3_21() { Token xsp; xsp = jj_scanpos; if (jj_3R_41()) { jj_scanpos = xsp; if (jj_3R_42()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
} else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false;
final private boolean jj_3_21() { Token xsp; xsp = jj_scanpos; if (jj_3R_41()) { jj_scanpos = xsp; if (jj_3R_42()) { jj_scanpos = xsp; lookingAhead = true; jj_semLA = lookahead_not_breaking_subd(); lookingAhead = false; if (!jj_semLA || jj_3R_43()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; }
Log.error("Could not locate chat room.", e1);
Log.debug("Could not locate chat room " + roomname);
private void handleRoomPresence(final Presence p) { final String roomname = StringUtils.parseBareAddress(p.getFrom()); ChatRoom chatRoom; try { chatRoom = getChatRoom(roomname); } catch (ChatRoomNotFoundException e1) { Log.error("Could not locate chat room.", e1); return; } final String userid = StringUtils.parseResource(p.getFrom()); if (p.getType() == Presence.Type.unavailable) { fireUserHasLeft(chatRoom, userid); } else if (p.getType() == Presence.Type.available) { fireUserHasJoined(chatRoom, userid); } // Change tab icon if (chatRoom instanceof ChatRoomImpl) { StatusItem statusItem = SparkManager.getWorkspace().getStatusBar().getItemFromPresence(p); Icon tabIcon = null; if (statusItem == null && p == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else if (statusItem == null && p != null && p.getType() == Presence.Type.available) { tabIcon = SparkRes.getImageIcon(SparkRes.GREEN_BALL); } else { String status = p.getStatus(); if (status != null && status.indexOf("phone") != -1) { tabIcon = SparkRes.getImageIcon(SparkRes.ON_PHONE_IMAGE); } else if (statusItem == null) { tabIcon = SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON); } else { tabIcon = statusItem.getIcon(); } } Icon icon = SparkManager.getChatManager().getPresenceIconForContactHandler(p); if (icon != null) { tabIcon = icon; } int tabLoc = indexOfComponent(chatRoom); if (tabLoc != -1) { getTabAt(tabLoc).setIcon(tabIcon); } } }
finder.addBaseDirectory(new File(args[++i]));
baseDir = args[++i];
private void parseArguments(String[] args) throws Exception { FileFinder finder = new FileFinder(); for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) { finder.addBaseDirectory(new File(args[++i])); } else if (args[i].equals("--datafile")) { setDataFile( args[++i]); } else if (args[i].equals("--destination")) { setDestination( args[++i]); } else if (args[i].equals("--format")) { setFormat( args[++i]); } else { finder.addSourceFilePath(args[i]); } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (format == null) { System.err.println("Error: format must be set"); System.exit(1); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("format is " + format); LOGGER.debug("dataFile is " + dataFile.getAbsolutePath()); LOGGER.debug("destinationDir is " + destinationDir.getAbsolutePath()); } ProjectData projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) { System.err.println("Error: Unable to read from data file " + dataFile.getAbsolutePath()); System.exit(1); } if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, finder); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, finder); } }
finder.addSourceFilePath(args[i]);
if( baseDir==null) { finder.addSourceDirectory( args[i]); } else { finder.addSourceFile( baseDir, args[i]); }
private void parseArguments(String[] args) throws Exception { FileFinder finder = new FileFinder(); for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) { finder.addBaseDirectory(new File(args[++i])); } else if (args[i].equals("--datafile")) { setDataFile( args[++i]); } else if (args[i].equals("--destination")) { setDestination( args[++i]); } else if (args[i].equals("--format")) { setFormat( args[++i]); } else { finder.addSourceFilePath(args[i]); } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (format == null) { System.err.println("Error: format must be set"); System.exit(1); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("format is " + format); LOGGER.debug("dataFile is " + dataFile.getAbsolutePath()); LOGGER.debug("destinationDir is " + destinationDir.getAbsolutePath()); } ProjectData projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) { System.err.println("Error: Unable to read from data file " + dataFile.getAbsolutePath()); System.exit(1); } if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, finder); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, finder); } }
new HTMLReport(projectData, destinationDir, finder);
new HTMLReport(projectData, destinationDir, finder, complexity);
private void parseArguments(String[] args) throws Exception { FileFinder finder = new FileFinder(); for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) { finder.addBaseDirectory(new File(args[++i])); } else if (args[i].equals("--datafile")) { setDataFile( args[++i]); } else if (args[i].equals("--destination")) { setDestination( args[++i]); } else if (args[i].equals("--format")) { setFormat( args[++i]); } else { finder.addSourceFilePath(args[i]); } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (format == null) { System.err.println("Error: format must be set"); System.exit(1); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("format is " + format); LOGGER.debug("dataFile is " + dataFile.getAbsolutePath()); LOGGER.debug("destinationDir is " + destinationDir.getAbsolutePath()); } ProjectData projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) { System.err.println("Error: Unable to read from data file " + dataFile.getAbsolutePath()); System.exit(1); } if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, finder); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, finder); } }
new XMLReport(projectData, destinationDir, finder);
new XMLReport(projectData, destinationDir, finder, complexity);
private void parseArguments(String[] args) throws Exception { FileFinder finder = new FileFinder(); for (int i = 0; i < args.length; i++) { if (args[i].equals("--basedir")) { finder.addBaseDirectory(new File(args[++i])); } else if (args[i].equals("--datafile")) { setDataFile( args[++i]); } else if (args[i].equals("--destination")) { setDestination( args[++i]); } else if (args[i].equals("--format")) { setFormat( args[++i]); } else { finder.addSourceFilePath(args[i]); } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (format == null) { System.err.println("Error: format must be set"); System.exit(1); } if (LOGGER.isDebugEnabled()) { LOGGER.debug("format is " + format); LOGGER.debug("dataFile is " + dataFile.getAbsolutePath()); LOGGER.debug("destinationDir is " + destinationDir.getAbsolutePath()); } ProjectData projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) { System.err.println("Error: Unable to read from data file " + dataFile.getAbsolutePath()); System.exit(1); } if (format.equalsIgnoreCase("html")) { new HTMLReport(projectData, destinationDir, finder); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, finder); } }
sourceFilePaths.add(path);
sourceFilePaths.add(getCorrectedPath(path));
public void addSourceFilePath(String path) { change(); sourceFilePaths.add(path); }
System.err.println ("build: >");
public void gt() { newData (); _currentData.setType (WikiDataTypes.GT); }
System.err.println ("build: <");
public void lt() { newData (); _currentData.setType (WikiDataTypes.LT); }
StringTokenizer st = new StringTokenizer(plugin, ", ", false);
final StringTokenizer st = new StringTokenizer(plugin, ",", false);
public void loadPlugins() { // Delete all old plugins File[] oldFiles = PLUGINS_DIRECTORY.listFiles(); final int no = oldFiles != null ? oldFiles.length : 0; for (int i = 0; i < no; i++) { File file = oldFiles[i]; if (file.isDirectory()) { // Check to see if it has an associated .jar File jarFile = new File(PLUGINS_DIRECTORY, file.getName() + ".jar"); if (!jarFile.exists()) { uninstall(file); } } } updateClasspath(); // At the moment, the plug list is hardcode internally until I begin // using external property files. All depends on deployment. final URL url = getClass().getClassLoader().getResource("META-INF/plugins.xml"); try { InputStreamReader reader = new InputStreamReader(url.openStream()); loadInternalPlugins(reader); } catch (IOException e) { Log.error("Could not load plugins.xml file."); } // Load extension plugins loadPublicPlugins(); // For development purposes, load the plugin specified by -Dplugin=... String plugin = System.getProperty("plugin"); if (plugin != null) { StringTokenizer st = new StringTokenizer(plugin, ", ", false); while (st.hasMoreTokens()) { String token = st.nextToken(); File pluginXML = new File(token); loadPublicPlugin(pluginXML.getParentFile()); } } }
return;
public static void main(String arg[]) { // Build a context WebMacro wm = null; Context context = null; String encoding = null; try { wm = new WM(); context = wm.getContext(); Object names[] = {"prop"}; context.setProperty(names, "Example property"); encoding = wm.getConfig(WMConstants.TEMPLATE_INPUT_ENCODING); } catch (Exception e) { e.printStackTrace(); } try { /* HashMap hm = new HashMap(); hm.put("one", "the first"); hm.put("two", "the second"); hm.put("three", "the third"); context.setBean(hm); */ context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); context.put("today", new Date()); TestObject[] fruits = {new TestObject("apple", false), new TestObject("lemon", true), new TestObject("pear", false), new TestObject("orange", true), new TestObject("watermelon", false), new TestObject("peach", false), new TestObject("lime", true)}; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip", false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); FastWriter w = FastWriter.getInstance(wm.getBroker(), encoding); t1.write(w, context); System.out.println("*** RESULT ***"); w.writeTo(System.out); w.close(); context.clear(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
if (holder instanceof Note) parent = (Note) holder;
this.holder = holder;
public Note(String name, NoteHolder holder, String text) { this.name = name; if (holder instanceof Note) parent = (Note) holder; this.notes = new LinkedList<Note>(); this.text = text; holder.addNote(this); }
_levels.put(keys[i], levels.getSetting(keys[i]));
_levels.put(keys[i], new Integer(LogSystem.getLevel(levels.getSetting(keys[i]))));
public LogFile(Settings s) throws FileNotFoundException { this(s.getSetting("LogFile")); _trace = s.getBooleanSetting("LogTraceExceptions"); String slevel = s.getSetting("LogLevel", "NOTICE"); _defaultLevel = LogSystem.getLevel(slevel); String format = s.getSetting("LogFormat"); if (format != null) { _mf = new MessageFormat(format); } Settings levels = s.getSubSettings("LogLevel"); String[] keys = levels.keys(); for (int i = 0; i < keys.length; i++) { _levels.put(keys[i], levels.getSetting(keys[i])); } }
try { b = Expression.isTrue(conditions[i].evaluate(context)); } catch (Exception e) { String warning = "#if: Error evaluating condition: " + e; writeWarning(warning, context, out); }
b = Expression.isTrue(conditions[i].evaluate(context));
public void write(FastWriter out, Context context) throws PropertyException, IOException { for (int i = 0; i < nConditions; i++) { boolean b = false; try { b = Expression.isTrue(conditions[i].evaluate(context)); } catch (Exception e) { String warning = "#if: Error evaluating condition: " + e; writeWarning(warning, context, out); } if (b) { blocks[i].write(out, context); return; } } // If we fell out, we ran out of conditions, try the else block if any if (elseBlock != null) elseBlock.write(out, context); }
dialog.setSize(400, 225);
dialog.setSize(400, 250);
public void invoke(final String jid) { this.jid = jid; final Roster roster = SparkManager.getConnection().getRoster(); // If User is already in roster, do not show. 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)); Transport transport = TransportUtils.getTransport(StringUtils.parseServer(jid)); Icon icon = null; if (transport != null) { icon = transport.getIcon(); } messageLabel = new TitlePanel("", message, icon, true); // Add Message Label mainPanel.add(messageLabel, new GridBagConstraints(0, 0, 6, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); String username = StringUtils.parseName(UserManager.unescapeJID(jid)); usernameLabelValue.setText(UserManager.unescapeJID(jid)); nicknameField.setText(username); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (!rosterBox.isSelected()) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); return; } boolean addEntry = addEntry(); if (addEntry) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); } else { dialog.dispose(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, mainPanel); } }); dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkRes.getImageIcon(SparkRes.MAIN_IMAGE).getImage()); dialog.getContentPane().add(mainPanel); dialog.pack(); dialog.setSize(400, 225); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); if (SparkManager.getMainWindow().isFocused()) { dialog.setState(Frame.NORMAL); dialog.setVisible(true); } else if (!SparkManager.getMainWindow().isVisible() || !SparkManager.getMainWindow().isFocused()) { dialog.setFocusableWindowState(false); dialog.setState(Frame.ICONIFIED); dialog.setVisible(true); SparkManager.getAlertManager().flashWindowStopOnFocus(dialog); dialog.setFocusableWindowState(true); } }
titlePanel = new TitlePanel("AIM Registration", transport.getTitle(), transport.getIcon(), true);
titlePanel = new TitlePanel(transport.getTitle(), transport.getInstructions(), transport.getIcon(), true);
public TransportRegistrationPanel(String serviceName) { setLayout(new GridBagLayout()); final Transport transport = TransportManager.getTransport(serviceName); titlePanel = new TitlePanel("AIM Registration", transport.getTitle(), transport.getIcon(), true); add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); final JLabel usernameLabel = new JLabel(); usernameLabel.setFont(new Font("Dialog", Font.BOLD, 11)); ResourceUtils.resLabel(usernameLabel, usernameField, "&Username:"); add(usernameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(usernameField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); final JLabel passwordLabel = new JLabel(); passwordLabel.setFont(new Font("Dialog", Font.BOLD, 11)); ResourceUtils.resLabel(passwordLabel, passwordField, "&Password:"); add(passwordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(passwordField, new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) };
try { context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) };
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = new Context(null); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); try { Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -");
context.registerTool("testTool", new TestTool());
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = new Context(null); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); try { Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
try {
System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -");
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = new Context(null); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); try { Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence);
Presence p = new Presence(presence.getType(), presence.getStatus(), presence.getPriority(), presence.getMode()); p.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(p);
private void registerPresenceListener() { SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportUtils.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.unavailable) { registered = false; } GatewayButton button = uiMap.get(transport); button.signedIn(registered); } } }, new PacketTypeFilter(Presence.class)); ChatManager chatManager = SparkManager.getChatManager(); chatManager.addContactItemHandler(this); // Iterate through Contacts and check for final ContactList contactList = SparkManager.getWorkspace().getContactList(); for (ContactGroup contactGroup : contactList.getContactGroups()) { for (ContactItem contactItem : contactGroup.getContactItems()) { Presence presence = contactItem.getPresence(); if (presence != null) { String domain = StringUtils.parseServer(presence.getFrom()); Transport transport = TransportUtils.getTransport(domain); if (transport != null) { handlePresence(contactItem, presence); contactGroup.fireContactGroupUpdated(); } } } } SparkManager.getSessionManager().addPresenceListener(new PresenceListener() { public void presenceChanged(Presence presence) { for (Transport transport : TransportUtils.getTransports()) { presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } } }); }
presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence);
Presence p = new Presence(presence.getType(), presence.getStatus(), presence.getPriority(), presence.getMode()); p.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(p);
public void presenceChanged(Presence presence) { for (Transport transport : TransportUtils.getTransports()) { presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } }
sourceFiles.addAll(packageData.getChildren());
sourceFiles.addAll(packageData.getSourceFiles());
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getChildren()); } return sourceFiles; }
public Collection getSubPackages(String packageName)
public SortedSet getSubPackages(String packageName)
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
Collection subPackages = new HashSet();
SortedSet subPackages = new TreeSet();
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
if (packageData.getName().equals(packageName))
if (packageData.getName().startsWith(packageName))
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
item.setCacheEnabled(false);
private UIComponent getPreviewPanel() { String ref = ARTICLE_ITEM_BEAN_ID + "."; WFComponentSelector cs = new WFComponentSelector(); cs.setId(COMPONENT_SELECTOR_ID); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(1); p.setId(NO_ARTICLE_ID); p.getChildren().add(WFResourceUtil.getResourceUtilArticle().getHeaderTextVB("no_article_selected")); cs.add(p); ArticleItemViewer item = new ArticleItemViewer(); item.setId(ARTICLE_VIEW_ID); WFUtil.setValueBinding(item, "author", ref+"author"); WFUtil.setValueBinding(item, "creation_date", ref+"creationDate"); WFUtil.setValueBinding(item, "headline", ref+"headline"); WFUtil.setValueBinding(item, "teaser", ref+"teaser"); WFUtil.setValueBinding(item, "body", ref+"body"); cs.add(item); cs.setSelectedId(NO_ARTICLE_ID, true); return cs; }
String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline");
ArticleItemBean articleBean = (ArticleItemBean) WFUtil.getBeanInstance(ARTICLE_ITEM_BEAN_ID); String headline = articleBean.getHeadline();
private void selectComponent() { WFComponentSelector cs = (WFComponentSelector) findComponent(COMPONENT_SELECTOR_ID); String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline"); if (cs != null) { if (headline == null || headline.length() == 0) { cs.setSelectedId(NO_ARTICLE_ID, true); cs.setSelectedId(ARTICLE_VIEW_ID, false); }else { cs.setSelectedId(NO_ARTICLE_ID, false); cs.setSelectedId(ARTICLE_VIEW_ID, true); } }else { cs.setSelectedId(NO_ARTICLE_ID, false); cs.setSelectedId(ARTICLE_VIEW_ID, true); System.out.println("Could not find the Component selector!!!"); } }
fw.reset(out);
if (fw != null) { fw.reset(out); return fw; }
public static FastWriter getInstance(OutputStream out, String encoding) throws UnsupportedEncodingException { FastWriter fw = null; SimpleStack ss = (SimpleStack) _writerCache.get(encoding); if (ss != null) { fw = (FastWriter) ss.pop(); fw.reset(out); } if (fw == null) { fw = new FastWriter(out,encoding); } return fw; }
if (fw == null) { fw = new FastWriter(out,encoding); } return fw;
return new FastWriter(out,encoding);
public static FastWriter getInstance(OutputStream out, String encoding) throws UnsupportedEncodingException { FastWriter fw = null; SimpleStack ss = (SimpleStack) _writerCache.get(encoding); if (ss != null) { fw = (FastWriter) ss.pop(); fw.reset(out); } if (fw == null) { fw = new FastWriter(out,encoding); } return fw; }
LogSystem.removeInstance(_ls);
public synchronized void stopClient() { if ( --_count == 0 ) { shutdown(); } }
_servletContext.log(e, _mf.format(_args));
_servletContext.log(_mf.format(_args),e);
public void log(Date date, String name, String level, String message, Exception e) { synchronized(_args) { _args[0] = date; _args[1] = name; _args[2] = level; _args[3] = message; if (e == null) _servletContext.log(_mf.format(_args)); else _servletContext.log(e, _mf.format(_args)); } }
HtmlInputText sourceArea = WFUtil.getInputText(AUTHOR_ID, ref + "source");
HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source");
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(AUTHOR_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); ArticleItemBean articleItemBean = (ArticleItemBean) WFUtil.getBeanInstance(ARTICLE_ITEM_BEAN_ID); String resourcePath = articleItemBean.getArticleResourcePath(); categoriesUI.setResourcePath(resourcePath); p.getChildren().add(categoriesUI); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); WFComponentSelector editorSelector = new WFComponentSelector(); editorSelector.setId(EDITOR_SELECTOR_ID); editorSelector.add(mainContainer); editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); editorSelector.add(getRelatedContentItemsContainer()); editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); return editorSelector; }
searchContacts("");
SparkManager.getUserManager().searchContacts("", SparkManager.getWorkspace().getContactList());
public ContactList() { // Load Local Preferences localPreferences = SettingsManager.getLocalPreferences(); offlineGroup = new ContactGroup("Offline Group"); JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); addContactMenu = new JMenuItem(Res.getString("menuitem.add.contact"), SparkRes.getImageIcon(SparkRes.USER1_ADD_16x16)); addContactGroupMenu = new JMenuItem(Res.getString("menuitem.add.contact.group"), SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE)); removeContactFromGroupMenu = new JMenuItem(Res.getString("menuitem.remove.from.group"), SparkRes.getImageIcon(SparkRes.SMALL_DELETE)); chatMenu = new JMenuItem(Res.getString("menuitem.start.a.chat"), SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); renameMenu = new JMenuItem(Res.getString("menuitem.rename"), SparkRes.getImageIcon(SparkRes.DESKTOP_IMAGE)); addContactMenu.addActionListener(this); removeContactFromGroupMenu.addActionListener(this); chatMenu.addActionListener(this); renameMenu.addActionListener(this); setLayout(new BorderLayout()); addingGroupButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.ADD_CONTACT_IMAGE)); RolloverButton groupChatButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.JOIN_GROUPCHAT_IMAGE)); toolbar.add(addingGroupButton); toolbar.add(groupChatButton); addingGroupButton.addActionListener(this); mainPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false)); mainPanel.setBackground((Color)UIManager.get("List.background")); treeScroller = new JScrollPane(mainPanel); treeScroller.setBorder(BorderFactory.createEmptyBorder()); treeScroller.getVerticalScrollBar().setBlockIncrement(50); treeScroller.getVerticalScrollBar().setUnitIncrement(20); retryPanel = new RetryPanel(); workspace = SparkManager.getWorkspace(); workspace.getCardPanel().add(RETRY_PANEL, retryPanel); add(treeScroller, BorderLayout.CENTER); // Load Properties file props = new Properties(); // Save to properties file. propertiesFile = new File(new File(Spark.getUserHome(), "Spark"), "groups.properties"); try { props.load(new FileInputStream(propertiesFile)); } catch (IOException e) { // File does not exist. } // Add ActionListener(s) to menus addContactGroup(unfiledGroup); addContactGroup(offlineGroup); showHideMenu.setSelected(false); // Add KeyMappings getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control N"), "searchContacts"); getActionMap().put("searchContacts", new AbstractAction("searchContacts") { public void actionPerformed(ActionEvent evt) { searchContacts(""); } }); // Save state on shutdown. SparkManager.getMainWindow().addMainWindowListener(new MainWindowListener() { public void shutdown() { saveState(); } public void mainWindowActivated() { } public void mainWindowDeactivated() { } }); SparkManager.getConnection().addConnectionListener(this); // Get command panel and add View Online/Offline, Add Contact StatusBar statusBar = SparkManager.getWorkspace().getStatusBar(); JPanel commandPanel = statusBar.getCommandPanel(); final RolloverButton addContactButton = new RolloverButton(SparkRes.getImageIcon(SparkRes.USER1_ADD_16x16)); commandPanel.add(addContactButton); addContactButton.setToolTipText(Res.getString("message.add.a.contact")); addContactButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new RosterDialog().showRosterDialog(); } }); }
searchContacts("");
SparkManager.getUserManager().searchContacts("", SparkManager.getWorkspace().getContactList());
public void actionPerformed(ActionEvent evt) { searchContacts(""); }
activateChat(activeItem.getContactJID(), activeItem.getNickname());
SparkManager.getChatManager().activateChat(activeItem.getContactJID(), activeItem.getNickname());
public void actionPerformed(ActionEvent e) { if (e.getSource() == addingGroupButton) { new RosterDialog().showRosterDialog(); } else if (e.getSource() == chatMenu) { if (activeItem != null) { activateChat(activeItem.getContactJID(), activeItem.getNickname()); } } else if (e.getSource() == addContactMenu) { RosterDialog rosterDialog = new RosterDialog(); if (activeGroup != null) { rosterDialog.setDefaultGroup(activeGroup); } rosterDialog.showRosterDialog(); } else if (e.getSource() == removeContactFromGroupMenu) { if (activeItem != null) { removeContactFromGroup(activeItem); } } else if (e.getSource() == renameMenu) { if (activeItem == null) { return; } String oldNickname = activeItem.getNickname(); String newNickname = JOptionPane.showInputDialog(this, Res.getString("label.rename.to") + ":", oldNickname); if (ModelUtil.hasLength(newNickname)) { String address = activeItem.getFullJID(); ContactGroup contactGroup = getContactGroup(activeItem.getGroupName()); ContactItem contactItem = contactGroup.getContactItemByNickname(activeItem.getNickname()); contactItem.setNickname(newNickname); final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(address); entry.setName(newNickname); final Iterator contactGroups = groupList.iterator(); String user = StringUtils.parseBareAddress(address); while (contactGroups.hasNext()) { ContactGroup cg = (ContactGroup)contactGroups.next(); ContactItem ci = cg.getContactItemByJID(user); if (ci != null) { ci.setNickname(newNickname); } } } } }
new RosterDialog().showRosterDialog();
String groupName = JOptionPane.showInputDialog(getGUI(), Res.getString("message.name.of.group") + ":", Res.getString("title.add.new.group"), JOptionPane.QUESTION_MESSAGE); if (ModelUtil.hasLength(groupName)) { ContactGroup contactGroup = getContactGroup(groupName); if (contactGroup == null) { contactGroup = addContactGroup(groupName); contactGroup.setVisible(true); validateTree(); repaint(); } }
public void actionPerformed(ActionEvent e) { new RosterDialog().showRosterDialog(); }
String groupName = JOptionPane.showInputDialog(getGUI(), Res.getString("message.name.of.group") + ":", Res.getString("title.add.new.group"), JOptionPane.QUESTION_MESSAGE); if (ModelUtil.hasLength(groupName)) { ContactGroup contactGroup = getContactGroup(groupName); if (contactGroup == null) { contactGroup = addContactGroup(groupName); contactGroup.setVisible(true); validateTree(); repaint(); } }
showEmptyGroups(showHideMenu.isSelected());
public void actionPerformed(ActionEvent e) { String groupName = JOptionPane.showInputDialog(getGUI(), Res.getString("message.name.of.group") + ":", Res.getString("title.add.new.group"), JOptionPane.QUESTION_MESSAGE); if (ModelUtil.hasLength(groupName)) { ContactGroup contactGroup = getContactGroup(groupName); if (contactGroup == null) { contactGroup = addContactGroup(groupName); contactGroup.setVisible(true); validateTree(); repaint(); } } }
subscriptionRequest(presence.getFrom());
Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(presence.getFrom()); if (entry != null) { try { removeContactItem(presence.getFrom()); roster.removeEntry(entry); } catch (XMPPException e) { Presence unsub = new Presence(Presence.Type.unsubscribed); unsub.setTo(presence.getFrom()); SparkManager.getConnection().sendPacket(unsub); Log.error(e); } }
public void run() { subscriptionRequest(presence.getFrom()); }
Presence unsub = new Presence(Presence.Type.unsubscribed); unsub.setTo(presence.getFrom()); SparkManager.getConnection().sendPacket(unsub);
public void run() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(presence.getFrom()); if (entry != null) { try { removeContactItem(presence.getFrom()); roster.removeEntry(entry); } catch (XMPPException e) { Presence unsub = new Presence(Presence.Type.unsubscribed); unsub.setTo(presence.getFrom()); SparkManager.getConnection().sendPacket(unsub); Log.error(e); } } }
String jid = StringUtils.parseBareAddress(presence.getFrom()); removeContactItem(jid);
public void run() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(presence.getFrom()); if (entry != null) { try { removeContactItem(presence.getFrom()); roster.removeEntry(entry); } catch (XMPPException e) { Presence unsub = new Presence(Presence.Type.unsubscribed); unsub.setTo(presence.getFrom()); SparkManager.getConnection().sendPacket(unsub); Log.error(e); } } }
Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(presence.getFrom()); if (entry != null) { try { removeContactItem(presence.getFrom()); roster.removeEntry(entry);
SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator users = new ArrayList(initialPresences).iterator(); while (users.hasNext()) { Presence userToUpdate = (Presence)users.next(); initialPresences.remove(userToUpdate); updateUserPresence(userToUpdate); }
public void run() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(presence.getFrom()); if (entry != null) { try { removeContactItem(presence.getFrom()); roster.removeEntry(entry); } catch (XMPPException e) { Log.error(e); } } String jid = StringUtils.parseBareAddress(presence.getFrom()); removeContactItem(jid); }
catch (XMPPException e) { Log.error(e); } } String jid = StringUtils.parseBareAddress(presence.getFrom()); removeContactItem(jid);
});
public void run() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(presence.getFrom()); if (entry != null) { try { removeContactItem(presence.getFrom()); roster.removeEntry(entry); } catch (XMPPException e) { Log.error(e); } } String jid = StringUtils.parseBareAddress(presence.getFrom()); removeContactItem(jid); }
SwingUtilities.invokeLater(new Runnable() { public void run() {
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator users = new ArrayList(initialPresences).iterator(); while (users.hasNext()) { Presence userToUpdate = (Presence)users.next(); initialPresences.remove(userToUpdate); updateUserPresence(userToUpdate); } } }); }
}); }
public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator users = new ArrayList(initialPresences).iterator(); while (users.hasNext()) { Presence userToUpdate = (Presence)users.next(); initialPresences.remove(userToUpdate); updateUserPresence(userToUpdate); } } }); }
int ok = JOptionPane.showConfirmDialog(group, Res.getString("message.delete.confirmation", group.getGroupName()), Res.getString("title.confirmation"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.YES_OPTION) { String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster();
String newName = JOptionPane.showInputDialog(group, Res.getString("label.rename.to") + ":", Res.getString("title.rename.roster.group"), JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(newName)) { return; } String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster();
public void actionPerformed(ActionEvent e) { int ok = JOptionPane.showConfirmDialog(group, Res.getString("message.delete.confirmation", group.getGroupName()), Res.getString("title.confirmation"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.YES_OPTION) { String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster(); RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) { for (RosterEntry entry : rosterGroup.getEntries()) { try { rosterGroup.removeEntry(entry); } catch (XMPPException e1) { Log.error("Error removing entry", e1); } } } // Remove from UI removeContactGroup(group); invalidate(); repaint(); } }
RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) { for (RosterEntry entry : rosterGroup.getEntries()) { try { rosterGroup.removeEntry(entry); } catch (XMPPException e1) { Log.error("Error removing entry", e1); } } }
RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) {
public void actionPerformed(ActionEvent e) { int ok = JOptionPane.showConfirmDialog(group, Res.getString("message.delete.confirmation", group.getGroupName()), Res.getString("title.confirmation"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.YES_OPTION) { String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster(); RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) { for (RosterEntry entry : rosterGroup.getEntries()) { try { rosterGroup.removeEntry(entry); } catch (XMPPException e1) { Log.error("Error removing entry", e1); } } } // Remove from UI removeContactGroup(group); invalidate(); repaint(); } }
invalidate(); repaint();
rosterGroup.setName(newName);
public void actionPerformed(ActionEvent e) { int ok = JOptionPane.showConfirmDialog(group, Res.getString("message.delete.confirmation", group.getGroupName()), Res.getString("title.confirmation"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.YES_OPTION) { String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster(); RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) { for (RosterEntry entry : rosterGroup.getEntries()) { try { rosterGroup.removeEntry(entry); } catch (XMPPException e1) { Log.error("Error removing entry", e1); } } } // Remove from UI removeContactGroup(group); invalidate(); repaint(); } }
public void actionPerformed(ActionEvent e) { String newName = JOptionPane.showInputDialog(group, Res.getString("label.rename.to") + ":", Res.getString("title.rename.roster.group"), JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(newName)) { return; } String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster(); RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) { removeContactGroup(group); rosterGroup.setName(newName); }
public void actionPerformed(ActionEvent actionEvent) { SparkManager.getTransferManager().sendFileTo(item);
public void actionPerformed(ActionEvent e) { String newName = JOptionPane.showInputDialog(group, Res.getString("label.rename.to") + ":", Res.getString("title.rename.roster.group"), JOptionPane.QUESTION_MESSAGE); if (!ModelUtil.hasLength(newName)) { return; } String groupName = group.getGroupName(); Roster roster = SparkManager.getConnection().getRoster(); RosterGroup rosterGroup = roster.getGroup(groupName); if (rosterGroup != null) { removeContactGroup(group); rosterGroup.setName(newName); } }
activateChat(item.getContactJID(), item.getNickname());
chatManager.activateChat(item.getContactJID(), item.getNickname());
public void contactItemDoubleClicked(ContactItem item) { activeItem = item; ChatManager chatManager = SparkManager.getChatManager(); boolean handled = chatManager.fireContactItemDoubleClicked(item); if (!handled) { activateChat(item.getContactJID(), item.getNickname()); } clearSelectionList(item); }
public void actionPerformed(ActionEvent actionEvent) { SparkManager.getTransferManager().sendFileTo(item);
public void actionPerformed(ActionEvent e) { removeContactFromRoster(item);
public void actionPerformed(ActionEvent actionEvent) { SparkManager.getTransferManager().sendFileTo(item); }
removeContactFromRoster(item);
VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = item.getFullJID(); vcardSupport.viewProfile(jid, SparkManager.getWorkspace());
public void actionPerformed(ActionEvent e) { removeContactFromRoster(item); }
public void actionPerformed(ActionEvent e) { VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = item.getFullJID(); vcardSupport.viewProfile(jid, SparkManager.getWorkspace());
public void actionPerformed(ActionEvent actionEvent) { try { LastActivity activity = LastActivity.getLastActivity(SparkManager.getConnection(), item.getFullJID()); long idleTime = (activity.getIdleTime() * 1000); String time = ModelUtil.getTimeFromLong(idleTime); JOptionPane.showMessageDialog(getGUI(), Res.getString("message.idle.for", time), Res.getString("title.last.activity"), JOptionPane.INFORMATION_MESSAGE); } catch (XMPPException e1) { }
public void actionPerformed(ActionEvent e) { VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = item.getFullJID(); vcardSupport.viewProfile(jid, SparkManager.getWorkspace()); }
public void actionPerformed(ActionEvent actionEvent) { try { LastActivity activity = LastActivity.getLastActivity(SparkManager.getConnection(), item.getFullJID()); long idleTime = (activity.getIdleTime() * 1000); String time = ModelUtil.getTimeFromLong(idleTime); JOptionPane.showMessageDialog(getGUI(), Res.getString("message.idle.for", time), Res.getString("title.last.activity"), JOptionPane.INFORMATION_MESSAGE); } catch (XMPPException e1) { }
public void actionPerformed(ActionEvent e) { String jid = item.getFullJID(); Presence response = new Presence(Presence.Type.subscribe); response.setTo(jid);
public void actionPerformed(ActionEvent actionEvent) { try { LastActivity activity = LastActivity.getLastActivity(SparkManager.getConnection(), item.getFullJID()); long idleTime = (activity.getIdleTime() * 1000); String time = ModelUtil.getTimeFromLong(idleTime); JOptionPane.showMessageDialog(getGUI(), Res.getString("message.idle.for", time), Res.getString("title.last.activity"), JOptionPane.INFORMATION_MESSAGE); } catch (XMPPException e1) { } }
SparkManager.getConnection().sendPacket(response);
public void actionPerformed(ActionEvent actionEvent) { try { LastActivity activity = LastActivity.getLastActivity(SparkManager.getConnection(), item.getFullJID()); long idleTime = (activity.getIdleTime() * 1000); String time = ModelUtil.getTimeFromLong(idleTime); JOptionPane.showMessageDialog(getGUI(), Res.getString("message.idle.for", time), Res.getString("title.last.activity"), JOptionPane.INFORMATION_MESSAGE); } catch (XMPPException e1) { } }
String jid = item.getFullJID(); Presence response = new Presence(Presence.Type.subscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response);
sendMessages(items);
public void actionPerformed(ActionEvent e) { String jid = item.getFullJID(); Presence response = new Presence(Presence.Type.subscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); }
Presence response = new Presence(Presence.Type.subscribed);
Presence response = new Presence(Presence.Type.unsubscribe);
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(); } }
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(); }
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(); } }
SparkManager.getWorkspace().removeAlert(layoutPanel); Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response);
SparkManager.getVCardManager().viewProfile(jid, getGUI());
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); }
logger.debug("Putting instrumeted entry: "
logger.debug("Putting instrumented entry: "
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegexes); cr.accept(cv, CustomAttribute.getExtraAttributes(), false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
} catch (Exception e) { _log.error("Template: Unable to read template: " + this, e); out.write("<!--\n Template failed to read. Reason: ");
} catch (TemplateException e) { _log.error("Template: Unable to parse template: " + this, e); out.write("<!--\n Template failed to parse. Reason: ");
public final void write(FastWriter out, Context data) throws IOException { try { if (_content == null) { parse(); } } catch (Exception e) { _log.error("Template: Unable to read template: " + this, e); out.write("<!--\n Template failed to read. Reason: "); out.write(e.toString()); out.write(" \n-->"); } try { _content.write(out,data); } catch (PropertyException e) { String warning = "Template: Missing data in Map passed to template " + this; _log.warning(warning,e); out.write("<!--\n Could not interpret template. Reason: "); out.write(warning); out.write(e.toString()); out.write(" \n-->"); } }
"Template: Missing data in Map passed to template " + this;
"Template: Missing data in Context passed to template " + this;
public final void write(FastWriter out, Context data) throws IOException { try { if (_content == null) { parse(); } } catch (Exception e) { _log.error("Template: Unable to read template: " + this, e); out.write("<!--\n Template failed to read. Reason: "); out.write(e.toString()); out.write(" \n-->"); } try { _content.write(out,data); } catch (PropertyException e) { String warning = "Template: Missing data in Map passed to template " + this; _log.warning(warning,e); out.write("<!--\n Could not interpret template. Reason: "); out.write(warning); out.write(e.toString()); out.write(" \n-->"); } }
String message = "Would you like to end this session?"; if (true) { room.closeChatRoom(); return; } else { if (!room.isActive()) {
if (isGroupChat) { String message = "Would you like to end this session?"; final int ok = JOptionPane.showConfirmDialog(chatFrame, message, "Confirmation", JOptionPane.YES_NO_OPTION); if (ok == JOptionPane.OK_OPTION) {
public void closeActiveRoom() { ChatRoom room = null; try { room = getActiveChatRoom(); } catch (ChatRoomNotFoundException e1) { // AgentLog.logError("Chat room not found", e1); } // Confirm end session boolean isGroupChat = room.getChatType() == Message.Type.GROUP_CHAT; String message = "Would you like to end this session?"; if (true) { room.closeChatRoom(); return; } else { if (!room.isActive()) { room.closeChatRoom(); return; } } final int ok = JOptionPane.showConfirmDialog(SparkManager.getMainWindow(), message, "Confirmation", JOptionPane.YES_NO_OPTION); if (ok == JOptionPane.OK_OPTION) { room.closeChatRoom(); return; } }
final int ok = JOptionPane.showConfirmDialog(SparkManager.getMainWindow(), message, "Confirmation", JOptionPane.YES_NO_OPTION); if (ok == JOptionPane.OK_OPTION) {
else {
public void closeActiveRoom() { ChatRoom room = null; try { room = getActiveChatRoom(); } catch (ChatRoomNotFoundException e1) { // AgentLog.logError("Chat room not found", e1); } // Confirm end session boolean isGroupChat = room.getChatType() == Message.Type.GROUP_CHAT; String message = "Would you like to end this session?"; if (true) { room.closeChatRoom(); return; } else { if (!room.isActive()) { room.closeChatRoom(); return; } } final int ok = JOptionPane.showConfirmDialog(SparkManager.getMainWindow(), message, "Confirmation", JOptionPane.YES_NO_OPTION); if (ok == JOptionPane.OK_OPTION) { room.closeChatRoom(); return; } }
if(arg0.getOldValue()==null) { return; }
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); if(null==articlePath) { //Article has not been stored previousley, so nothing have to be done return; } System.out.println("Article path"+articlePath); boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); if(result) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); }else { if(null!=language) { result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); } } }
public void addClassData(ClassData classData)
public synchronized void addClassData(ClassData classData)
public void addClassData(ClassData classData) { if (children.containsKey(classData.getBaseName())) throw new IllegalArgumentException("Source file " + this.name + " already contains a class with the name " + classData.getBaseName()); // Each key is a class basename, stored as an String object. // Each value is information about the class, stored as a ClassData object. children.put(classData.getBaseName(), classData); }
return uri.replaceAll(":
return createDiscoveryPathName(uri) + "/" + localName;
protected String createDiscoveryPathName(String uri, String localName) { if (uri == null || uri.length() == 0) { return localName; } // TODO proper encoding required // lets replace any dodgy characters return uri.replaceAll("://", "/").replace(':', '/').replace(' ', '_') + "/" + localName; }
String uri = "META-INF/services/org/xbean/spring/" + createDiscoveryPathName(namespaceURI, localName);
String uri = META_INF_PREFIX + createDiscoveryPathName(namespaceURI, localName); InputStream in = loadResource(uri); if (in == null) { in = loadResource(META_INF_PREFIX + createDiscoveryPathName(namespaceURI)); }
protected MappingMetaData findNamespaceProperties(String namespaceURI, String localName) { // lets look for the magic prefix if (namespaceURI != null && namespaceURI.startsWith(JAVA_PACKAGE_PREFIX)) { String packageName = namespaceURI.substring(JAVA_PACKAGE_PREFIX.length()); return new MappingMetaData(packageName); } String uri = "META-INF/services/org/xbean/spring/" + createDiscoveryPathName(namespaceURI, localName); // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { logger.warn("Could not find resource: " + uri); return null; } } // lets load the file try { Properties properties = new Properties(); properties.load(in); return new MappingMetaData(properties); } catch (IOException e) { log.warn("Failed to load resource from uri: " + uri, e); return null; } }
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { logger.warn("Could not find resource: " + uri); return null;
if (in != null) { try { Properties properties = new Properties(); properties.load(in); return new MappingMetaData(properties); } catch (IOException e) { log.warn("Failed to load resource from uri: " + uri, e);
protected MappingMetaData findNamespaceProperties(String namespaceURI, String localName) { // lets look for the magic prefix if (namespaceURI != null && namespaceURI.startsWith(JAVA_PACKAGE_PREFIX)) { String packageName = namespaceURI.substring(JAVA_PACKAGE_PREFIX.length()); return new MappingMetaData(packageName); } String uri = "META-INF/services/org/xbean/spring/" + createDiscoveryPathName(namespaceURI, localName); // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { logger.warn("Could not find resource: " + uri); return null; } } // lets load the file try { Properties properties = new Properties(); properties.load(in); return new MappingMetaData(properties); } catch (IOException e) { log.warn("Failed to load resource from uri: " + uri, e); return null; } }
try { Properties properties = new Properties(); properties.load(in); return new MappingMetaData(properties); } catch (IOException e) { log.warn("Failed to load resource from uri: " + uri, e); return null; }
return null;
protected MappingMetaData findNamespaceProperties(String namespaceURI, String localName) { // lets look for the magic prefix if (namespaceURI != null && namespaceURI.startsWith(JAVA_PACKAGE_PREFIX)) { String packageName = namespaceURI.substring(JAVA_PACKAGE_PREFIX.length()); return new MappingMetaData(packageName); } String uri = "META-INF/services/org/xbean/spring/" + createDiscoveryPathName(namespaceURI, localName); // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { logger.warn("Could not find resource: " + uri); return null; } } // lets load the file try { Properties properties = new Properties(); properties.load(in); return new MappingMetaData(properties); } catch (IOException e) { log.warn("Failed to load resource from uri: " + uri, e); return null; } }
BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader().getBeanFactory());
protected int parseBeanDefinitions(Element root) throws BeanDefinitionStoreException { NodeList nl = root.getChildNodes(); int beanDefinitionCount = 0; for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element) { Element ele = (Element) node; if (IMPORT_ELEMENT.equals(node.getNodeName())) { importBeanDefinitionResource(ele); } else if (ALIAS_ELEMENT.equals(node.getNodeName())) { String name = ele.getAttribute(NAME_ATTRIBUTE); String alias = ele.getAttribute(ALIAS_ATTRIBUTE); getBeanDefinitionReader().getBeanFactory().registerAlias(name, alias); } else if (BEAN_ELEMENT.equals(node.getNodeName())) { beanDefinitionCount++; BeanDefinitionHolder bdHolder = parseBeanDefinitionElement(ele, false); BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader().getBeanFactory()); } else { BeanDefinitionHolder bdHolder = parseBeanFromExtensionElement(ele); if (bdHolder != null) { beanDefinitionCount++; } else { log.debug("Ignoring unknown element namespace: " + ele.getNamespaceURI() + " localName: " + ele.getLocalName()); } BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getBeanDefinitionReader().getBeanFactory()); } } } return beanDefinitionCount; }
continue;
break;
public void run() { int period = now(); while( !isInterrupted()) { try { sleep(_duration); } catch (InterruptedException e) { continue; } int newPeriod = now(); while (period != newPeriod) { if (++period >= _periods) period = 0; synchronized(_locks[period]) { Runnable tasks[] = _tasks[period]; boolean repeats[] = _repeats[period]; for (int i = 0; i < tasks.length; i++) { if (tasks[i] != null) { try { tasks[i].run(); } catch (Exception e) { _syslog.warning(this + ": task " + tasks[i] + " threw an exception", e); } finally { if (!repeats[i]) { tasks[i] = null; } } } } } } } }
File sourceDirectory) throws IOException
FileFinder finder) throws IOException
public XMLReport(ProjectData projectData, File destinationDir, File sourceDirectory) throws IOException { this.sourceDirectory = sourceDirectory; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(sourceDirectory); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
this.sourceDirectory = sourceDirectory;
this.finder = finder;
public XMLReport(ProjectData projectData, File destinationDir, File sourceDirectory) throws IOException { this.sourceDirectory = sourceDirectory; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(sourceDirectory); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
dumpSources(sourceDirectory);
dumpSources();
public XMLReport(ProjectData projectData, File destinationDir, File sourceDirectory) throws IOException { this.sourceDirectory = sourceDirectory; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(sourceDirectory); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
double ccn = Util.getCCN(new File(sourceDirectory, classData
double ccn = Util.getCCN(finder.findFile(classData
private void dumpClass(ClassData classData) { logger.debug("Dumping class " + classData.getName()); double ccn = Util.getCCN(new File(sourceDirectory, classData .getSourceFileName()), false); println("<class name=\"" + classData.getName() + "\" filename=\"" + classData.getSourceFileName() + "\" line-rate=\"" + classData.getLineCoverageRate() + "\" branch-rate=\"" + classData.getBranchCoverageRate() + "\" complexity=\"" + ccn + "\"" + ">"); increaseIndentation(); dumpMethods(classData); dumpLines(classData); decreaseIndentation(); println("</class>"); }
double ccn = Util.getCCN(new File(sourceDirectory, packageData .getSourceFileName()), false);
double ccn = Util.getCCN(finder.findFile(packageData.getSourceFileName()), false);
private void dumpPackage(PackageData packageData) { logger.debug("Dumping package " + packageData.getName()); double ccn = Util.getCCN(new File(sourceDirectory, packageData .getSourceFileName()), false); println("<package name=\"" + packageData.getName() + "\" line-rate=\"" + packageData.getLineCoverageRate() + "\" branch-rate=\"" + packageData.getBranchCoverageRate() + "\" complexity=\"" + ccn + "\"" + ">"); increaseIndentation(); dumpSourceFiles(packageData); decreaseIndentation(); println("</package>"); }
private void dumpSources(File sourceDirectory)
private void dumpSources()
private void dumpSources(File sourceDirectory) { if (sourceDirectory == null) return; println("<sources>"); increaseIndentation(); dumpSource(sourceDirectory); decreaseIndentation(); println("</sources>"); }
if (sourceDirectory == null) return;
private void dumpSources(File sourceDirectory) { if (sourceDirectory == null) return; println("<sources>"); increaseIndentation(); dumpSource(sourceDirectory); decreaseIndentation(); println("</sources>"); }
dumpSource(sourceDirectory);
for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File dir = (File) it.next(); dumpSource(dir); }
private void dumpSources(File sourceDirectory) { if (sourceDirectory == null) return; println("<sources>"); increaseIndentation(); dumpSource(sourceDirectory); decreaseIndentation(); println("</sources>"); }
FastWriter fw = new FastWriter(os, "UTF8");
FastWriter fw = new FastWriter(os, context.getEncoding());
public Object evaluate(Context context) throws ContextException { try { ByteArrayOutputStream os = new ByteArrayOutputStream(256); FastWriter fw = new FastWriter(os, "UTF8"); write(fw,context); fw.flush(); return os.toString("UTF8"); } catch (IOException e) { Engine.log.exception(e); Engine.log.error("evaluate got IO exception on write to StringWriter"); return ""; } }
return os.toString("UTF8");
return os.toString(context.getEncoding());
public Object evaluate(Context context) throws ContextException { try { ByteArrayOutputStream os = new ByteArrayOutputStream(256); FastWriter fw = new FastWriter(os, "UTF8"); write(fw,context); fw.flush(); return os.toString("UTF8"); } catch (IOException e) { Engine.log.exception(e); Engine.log.error("evaluate got IO exception on write to StringWriter"); return ""; } }
f.p(value.getName().replace('$', '.')); f.p(".class"); }
f.t(owner.ref(value.getDeclaringClass())).p('.').p(value.name()); }
public void generate(JFormatter f) { f.p(value.getName().replace('$', '.')); f.p(".class"); }
return PropertyOperator.setProperty(this,_bean,names,value);
return PropertyOperator.setProperty(this,_bean,names,value) || setTool(names, value);
final public boolean setProperty(final Object[] names, final Object value) throws PropertyException, ContextException { if (names.length == 0) { return false; } else if (_bean == null) { return setLocal(names, value) || setTool(names, value); } else { return PropertyOperator.setProperty(this,_bean,names,value); } }
LOGGER.debug("ProjectData.addClassData: " + classData.getName());
public void addClassData(ClassData classData) { LOGGER.debug("ProjectData.addClassData: " + classData.getName()); String packageName = classData.getPackageName(); PackageData packageData = (PackageData)children.get(packageName); if (packageData == null) { packageData = new PackageData(packageName); // Each key is a package name, stored as an String object. // Each value is information about the package, stored as a PackageData object. this.children.put(packageName, packageData); } packageData.addClassData(classData); }
this.classes.put(classData.getName(), classData);
public void addClassData(ClassData classData) { LOGGER.debug("ProjectData.addClassData: " + classData.getName()); String packageName = classData.getPackageName(); PackageData packageData = (PackageData)children.get(packageName); if (packageData == null) { packageData = new PackageData(packageName); // Each key is a package name, stored as an String object. // Each value is information about the package, stored as a PackageData object. this.children.put(packageName, packageData); } packageData.addClassData(classData); }
for (Iterator it = children.values().iterator(); it.hasNext(); ) { PackageData packageData = (PackageData) it.next(); ClassData classData = packageData.getClassData(name); if (classData != null) { return classData; } } return null;
return (ClassData)this.classes.get(name);
public ClassData getClassData(String name) { for (Iterator it = children.values().iterator(); it.hasNext(); ) { PackageData packageData = (PackageData) it.next(); ClassData classData = packageData.getClassData(name); if (classData != null) { return classData; } } return null; }
String offline = preferences.getOfflineSound(); File offlineFile = new File(offline); SparkManager.getSoundManager().playClip(offlineFile);
Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); presence = roster.getPresence(bareJID); if (presence == null) { String offline = preferences.getOfflineSound(); File offlineFile = new File(offline); SparkManager.getSoundManager().playClip(offlineFile); }
public void initialize() { soundPreference = new SoundPreference(); SparkManager.getPreferenceManager().addPreference(soundPreference); SparkManager.getChatManager().addChatRoomListener(this); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getType() == Presence.Type.unavailable) { SoundPreferences preferences = soundPreference.getPreferences(); if (preferences != null && preferences.isPlayOfflineSound()) { String offline = preferences.getOfflineSound(); File offlineFile = new File(offline); SparkManager.getSoundManager().playClip(offlineFile); } } } }, new PacketTypeFilter(Presence.class)); Thread thread = new Thread(new Runnable() { public void run() { soundPreference.loadFromFile(); } }); thread.start(); }
String offline = preferences.getOfflineSound(); File offlineFile = new File(offline); SparkManager.getSoundManager().playClip(offlineFile);
Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); presence = roster.getPresence(bareJID); if (presence == null) { String offline = preferences.getOfflineSound(); File offlineFile = new File(offline); SparkManager.getSoundManager().playClip(offlineFile); }
public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getType() == Presence.Type.unavailable) { SoundPreferences preferences = soundPreference.getPreferences(); if (preferences != null && preferences.isPlayOfflineSound()) { String offline = preferences.getOfflineSound(); File offlineFile = new File(offline); SparkManager.getSoundManager().playClip(offlineFile); } } }
BookmarkUI bookmarkUI = new BookmarkUI();
final Iterator bookmarkLinks = bookmarkedLinks.iterator(); while (bookmarkLinks.hasNext()) { final BookmarkedURL link = (BookmarkedURL)bookmarkLinks.next();
public void initialize() { final SwingWorker bookmarkThreadWorker = new SwingWorker() { public Object construct() { // Register own provider for simpler implementation. PrivateDataManager.addPrivateDataProvider("storage", "storage:bookmarks", new Bookmarks.Provider()); PrivateDataManager manager = new PrivateDataManager(SparkManager.getConnection()); Bookmarks bookmarks = null; try { bookmarks = (Bookmarks)manager.getPrivateData("storage", "storage:bookmarks"); } catch (XMPPException e) { Log.error(e); } return bookmarks; } public void finished() { final Bookmarks bookmarks = (Bookmarks)get(); if (bookmarks != null) { Collection bookmarkedConferences = bookmarks.getBookmarkedConferences(); final Collection bookmarkedLinks = bookmarks.getBookmarkedURLS(); BookmarkUI bookmarkUI = new BookmarkUI(); Iterator links = bookmarkedLinks.iterator(); while (links.hasNext()) { final BookmarkedURL bookmarkedLink = (BookmarkedURL)links.next(); bookmarkUI.addURL(bookmarkedLink); } ContactList contactList = SparkManager.getWorkspace().getContactList(); contactList.getMainPanel().add(bookmarkUI); Iterator conferences = bookmarkedConferences.iterator(); while (conferences.hasNext()) { final BookmarkedConference bookmarkedConference = (BookmarkedConference)conferences.next(); bookmarkUI.addConference(bookmarkedConference); } } } }; bookmarkThreadWorker.start(); }