bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public OptionalGroup(int argCount) { super(0, ArgType_GROUP); setOptional(subordinateArgs); }
|
public OptionalGroup(int argCount) { super(0, ArgType_GROUP); setOptional(argCount); }
| 1,124,253
|
public void loadPlugins() { // Add presence and message listeners // we listen for these to force open a 1-1 peer chat window from other operators if // one isn't already open PacketFilter workspaceMessageFilter = new PacketTypeFilter(Message.class); // Add the packetListener to this instance SparkManager.getSessionManager().getConnection().addPacketListener(this, workspaceMessageFilter); // Make presence available to anonymous requests, if from anonymous user in the system. PacketListener workspacePresenceListener = new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getProperty("anonymous") != null) { boolean isAvailable = statusBox.getPresence().getMode() == Presence.Mode.available; Presence reply = new Presence(Presence.Type.available); if (!isAvailable) { reply.setType(Presence.Type.unavailable); } reply.setTo(presence.getFrom()); SparkManager.getSessionManager().getConnection().sendPacket(reply); } } }; SparkManager.getSessionManager().getConnection().addPacketListener(workspacePresenceListener, new PacketTypeFilter(Presence.class)); // Send Available status final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence(); SparkManager.getSessionManager().changePresence(presence); // Load Plugins SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(5000); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; } public void finished() { final PluginManager pluginManager = PluginManager.getInstance(); pluginManager.loadPlugins(); pluginManager.initializePlugins(); } }; worker.start(); int numberOfMillisecondsInTheFuture = 10000; // 5 sec Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator offlineMessage = offlineMessages.iterator(); while (offlineMessage.hasNext()) { Message offline = (Message)offlineMessage.next(); handleOfflineMessage(offline); } } }); } }, timeToRun); }
|
public void loadPlugins() { // Add presence and message listeners // we listen for these to force open a 1-1 peer chat window from other operators if // one isn't already open PacketFilter workspaceMessageFilter = new PacketTypeFilter(Message.class); // Add the packetListener to this instance SparkManager.getSessionManager().getConnection().addPacketListener(this, workspaceMessageFilter); // Make presence available to anonymous requests, if from anonymous user in the system. PacketListener workspacePresenceListener = new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getProperty("anonymous") != null) { boolean isAvailable = statusBox.getPresence().getMode() == Presence.Mode.available; Presence reply = new Presence(Presence.Type.available); if (!isAvailable) { reply.setType(Presence.Type.unavailable); } reply.setTo(presence.getFrom()); SparkManager.getSessionManager().getConnection().sendPacket(reply); } } }; SparkManager.getSessionManager().getConnection().addPacketListener(workspacePresenceListener, new PacketTypeFilter(Presence.class)); // Send Available status final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence(); SparkManager.getSessionManager().changePresence(presence); // Load Plugins SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(2000); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; } public void finished() { final PluginManager pluginManager = PluginManager.getInstance(); pluginManager.loadPlugins(); pluginManager.initializePlugins(); } }; worker.start(); int numberOfMillisecondsInTheFuture = 10000; // 5 sec Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator offlineMessage = offlineMessages.iterator(); while (offlineMessage.hasNext()) { Message offline = (Message)offlineMessage.next(); handleOfflineMessage(offline); } } }); } }, timeToRun); }
| 1,124,254
|
public Object construct() { try { Thread.sleep(5000); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; }
|
public Object construct() { try { Thread.sleep(2000); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; }
| 1,124,255
|
public LogManager(Properties config) { String fileName = config.getProperty("LogFile", null); if ( ("System.error").equalsIgnoreCase(fileName) || ("stderr").equalsIgnoreCase(fileName) || ("none").equalsIgnoreCase(fileName)) { fileName = null; } String format = config.getProperty("LogFormat", "{0,time,medium} {1}:{2} {3}"); String strace = config.getProperty("LogExceptions", null); if (strace == null) { strace = config.getProperty("LogTraceExceptions", "false"); } boolean trace = (strace.equalsIgnoreCase("true") || strace.equalsIgnoreCase("yes")); Enumeration e = config.propertyNames(); Properties levels = new Properties(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (key.startsWith("LogLevel.")) { String type = key.substring(9); String level = config.getProperty(key); levels.setProperty(type, level); } } LogFile lf; try { lf = new LogFile(fileName, format, levels, trace); } catch (IOException ioe) { lf = new LogFile(System.err, format, levels, trace); lf.log("LOG", "ERROR", "Unable to write to logfile: " + format, ioe); } addTarget(lf); }
|
public LogManager(Properties config) { String fileName = config.getProperty("LogFile", null); if ( ("System.error").equalsIgnoreCase(fileName) || ("stderr").equalsIgnoreCase(fileName) || ("none").equalsIgnoreCase(fileName)) { fileName = null; } String format = config.getProperty("LogFormat", "{0,time,medium} {1}:{2} {3}"); String strace = config.getProperty("LogExceptions", null); if (strace == null) { strace = config.getProperty("LogTraceExceptions", "false"); } boolean trace = ("true".equalsIgnoreCase(strace) || "yes".equalsIgnoreCase(strace)); Enumeration e = config.propertyNames(); Properties levels = new Properties(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (key.startsWith("LogLevel.")) { String type = key.substring(9); String level = config.getProperty(key); levels.setProperty(type, level); } } LogFile lf; try { lf = new LogFile(fileName, format, levels, trace); } catch (IOException ioe) { lf = new LogFile(System.err, format, levels, trace); lf.log("LOG", "ERROR", "Unable to write to logfile: " + format, ioe); } addTarget(lf); }
| 1,124,258
|
public LogManager(Properties config) { String fileName = config.getProperty("LogFile", null); if ( ("System.error").equalsIgnoreCase(fileName) || ("stderr").equalsIgnoreCase(fileName) || ("none").equalsIgnoreCase(fileName)) { fileName = null; } String format = config.getProperty("LogFormat", "{0,time,medium} {1}:{2} {3}"); String strace = config.getProperty("LogExceptions", null); if (strace == null) { strace = config.getProperty("LogTraceExceptions", "false"); } boolean trace = (strace.equalsIgnoreCase("true") || strace.equalsIgnoreCase("yes")); Enumeration e = config.propertyNames(); Properties levels = new Properties(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (key.startsWith("LogLevel.")) { String type = key.substring(9); String level = config.getProperty(key); levels.setProperty(type, level); } } LogFile lf; try { lf = new LogFile(fileName, format, levels, trace); } catch (IOException ioe) { lf = new LogFile(System.err, format, levels, trace); lf.log("LOG", "ERROR", "Unable to write to logfile: " + format, ioe); } addTarget(lf); }
|
public LogManager(Properties config) { String fileName = config.getProperty("LogFile", null); if ( ("System.error").equalsIgnoreCase(fileName) || ("stderr").equalsIgnoreCase(fileName) || ("none").equalsIgnoreCase(fileName)) { fileName = null; } String format = config.getProperty("LogFormat", "{0,time,medium} {1}:{2} {3}"); String strace = config.getProperty("LogExceptions", null); if (strace == null) { strace = config.getProperty("LogTraceExceptions", "false"); } boolean trace = (strace.equalsIgnoreCase("true") || strace.equalsIgnoreCase("yes")); Enumeration e = config.propertyNames(); Properties levels = new Properties(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (key.startsWith("LogLevel.")) { String type = key.substring(9); String level = config.getProperty(key); levels.setProperty(type, level); } } LogFile lf; try { lf = new LogFile(fileName, format, logLevel, levels, trace); } catch (IOException ioe) { lf = new LogFile(System.err, format, levels, trace); lf.log("LOG", "ERROR", "Unable to write to logfile: " + format, ioe); } addTarget(lf); }
| 1,124,259
|
public LogManager(Properties config) { String fileName = config.getProperty("LogFile", null); if ( ("System.error").equalsIgnoreCase(fileName) || ("stderr").equalsIgnoreCase(fileName) || ("none").equalsIgnoreCase(fileName)) { fileName = null; } String format = config.getProperty("LogFormat", "{0,time,medium} {1}:{2} {3}"); String strace = config.getProperty("LogExceptions", null); if (strace == null) { strace = config.getProperty("LogTraceExceptions", "false"); } boolean trace = (strace.equalsIgnoreCase("true") || strace.equalsIgnoreCase("yes")); Enumeration e = config.propertyNames(); Properties levels = new Properties(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (key.startsWith("LogLevel.")) { String type = key.substring(9); String level = config.getProperty(key); levels.setProperty(type, level); } } LogFile lf; try { lf = new LogFile(fileName, format, levels, trace); } catch (IOException ioe) { lf = new LogFile(System.err, format, levels, trace); lf.log("LOG", "ERROR", "Unable to write to logfile: " + format, ioe); } addTarget(lf); }
|
public LogManager(Properties config) { String fileName = config.getProperty("LogFile", null); if ( ("System.error").equalsIgnoreCase(fileName) || ("stderr").equalsIgnoreCase(fileName) || ("none").equalsIgnoreCase(fileName)) { fileName = null; } String format = config.getProperty("LogFormat", "{0,time,medium} {1}:{2} {3}"); String strace = config.getProperty("LogExceptions", null); if (strace == null) { strace = config.getProperty("LogTraceExceptions", "false"); } boolean trace = (strace.equalsIgnoreCase("true") || strace.equalsIgnoreCase("yes")); Enumeration e = config.propertyNames(); Properties levels = new Properties(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (key.startsWith("LogLevel.")) { String type = key.substring(9); String level = config.getProperty(key); levels.setProperty(type, level); } } LogFile lf; try { lf = new LogFile(fileName, format, levels, trace); } catch (IOException ioe) { lf = new LogFile("System.err", System.err, format, logLevel, levels, trace); lf.log("LOG", "ERROR", "Unable to write to logfile: " + format, ioe); } addTarget(lf); }
| 1,124,260
|
final public int rewind(int i) { if ((i < 0) || (i >= MAX_MARKS)) { return DUMMY_MARK; } Mark m = _marks[i]; if (m.isSet == false) { return DUMMY_MARK; } _buf = m.buf.toString();System.out.println("2--- _buf now equal: " + _buf); _pos = 0; _len = _buf.length(); _last = -1; _cur = m.last; _escaped = false; _marks[i].isSet = false; _marked--; read(); // recompute escaped, _pos, _cur, _last, etc. return DUMMY_MARK; }
|
final public int rewind(int i) { if ((i < 0) || (i >= MAX_MARKS)) { return DUMMY_MARK; } Mark m = _marks[i]; if (m.isSet == false) { return DUMMY_MARK; } _buf = m.buf.toString(); _pos = 0; _len = _buf.length(); _last = -1; _cur = m.last; _escaped = false; _marks[i].isSet = false; _marked--; read(); // recompute escaped, _pos, _cur, _last, etc. return DUMMY_MARK; }
| 1,124,262
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
| 1,124,263
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
| 1,124,264
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
| 1,124,265
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
|
public void processAction(ActionEvent event) { if (event.getComponent().getId().equals(LIST_BUTTON_ID)) { WFUtil.invoke(LIST_ARTICLES_BEAN_ID, "list"); return; } else if (event.getComponent().getId().equals(VIEW_ARTICLE_BACK_BUTTON_ID)) { WFComponentSelector cs = (WFComponentSelector) event.getComponent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, true); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, false); return; } UIComponent link = event.getComponent(); String id = WFUtil.getParameter(link, "id"); ArticleItemBean articleItem = new ArticleItemBean(); try { articleItem.load(id); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "en"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setComment", notNull(articleItem.getComment())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setDescription", notNull(articleItem.getDescription())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setStatus", // articleItem.getStatus() ContentItemCase.STATUS_PUBLISHED );// WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setMainCategoryId", new Integer(3)); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLocaleId", "sv"); //And one more time since it won't work after just setting the params once... WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setHeadline", notNull(articleItem.getHeadline())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setTeaser", notNull(articleItem.getTeaser())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setBody", notNull(articleItem.getBody())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setAuthor", notNull(articleItem.getAuthor())); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setFolderLocation", notNull(articleItem.getFolderLocation())); WFComponentSelector cs = (WFComponentSelector) event.getComponent().getParent().getParent().getParent().findComponent(DISPLAY_SELECTOR_ID); cs.setSelectedId(LIST_PANEL_ID, false); cs.setSelectedId(VIEW_ARTICLE_PANEL_ID, true); } catch (XmlException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
| 1,124,266
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,124,267
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,124,268
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,124,269
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,124,270
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,124,271
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; // TODO: Allow for multiple destination and multiple source directories longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("datafile", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[2] = new LongOpt("destination", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:d:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = g.getOptarg(); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { System.err .println("Error: format \"" + format + "\" is invalid. Must be either html or xml"); System.exit(1); } break; case 'd': dataFile = new File(g.getOptarg()); if (!dataFile.exists()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " does not exist"); System.exit(1); } if (!dataFile.isFile()) { System.err.println("Error: data file " + dataFile.getAbsolutePath() + " must be a regular file"); System.exit(1); } break; case 'o': destinationDir = new File(g.getOptarg()); if (destinationDir.exists() && !destinationDir.isDirectory()) { System.err.println("Error: destination directory " + destinationDir + " already exists but is not a directory"); System.exit(1); } destinationDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { System.err.println("Error: source directory " + sourceDir + " does not exist"); System.exit(1); } if (!sourceDir.isDirectory()) { System.err.println("Error: source directory " + sourceDir + " must be a directory"); System.exit(1); } break; } } if (dataFile == null) dataFile = CoverageDataFileHandler.getDefaultDataFile(); if (destinationDir == null) { System.err.println("Error: destination directory must be set"); System.exit(1); } if (sourceDir == null) { System.err.println("Error: source directory 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()); logger.debug("sourceDir is " + sourceDir.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, sourceDir); } else if (format.equalsIgnoreCase("xml")) { new XMLReport(projectData, destinationDir, sourceDir); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,124,272
|
public final void setValue (Context context, Object newValue) throws PropertyException { if (!context.setProperty(_names[0], newValue)) { throw new PropertyException("No method to set \"" + _vname + "\" to type " + ((newValue == null) ? "null" : newValue.getClass().toString()) + " in supplied context (" + context.getClass() + ")"); } }
|
public final void setValue (Context context, Object newValue) throws PropertyException { if (!context.setProperty(_names[0], newValue)) { throw new PropertyException("No method to set \"" + getVariableName() + "\" to type " + ((newValue == null) ? "null" : newValue.getClass().toString()) + " in supplied context (" + context.getClass() + ")"); } }
| 1,124,273
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
|
public final void addArgument(String name, Object value) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
| 1,124,276
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
| 1,124,277
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(name)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
| 1,124,278
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(name + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
| 1,124,279
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } _arguments.addElement(p); }
|
public final void addArgument(Argument p) throws IllegalStateException { if (! hasArguments()) { throw new IllegalStateException("Does not take arguments"); } boolean match = false; String argument = p.getName(); for (int i = 0; i < _argNames.length; i++) { if (_argNames[i].equals(argument)) { match = true; } } if (!match) { throw new IllegalStateException(argument + " is not recognized as an argument for " + toString()); } if (_arguments == null) { _arguments = new Vector(); } Argument ag = new Argument(name,value); _arguments.addElement(ag); }
| 1,124,280
|
public final Object build(BuildContext rc) throws BuildException { // collect the arguments Object args[] = new Object[_buildArgs]; { int i = 0; args[i++] = rc; if ( hasCondition() ) { Object cond = (_condition instanceof Builder) ? ((Builder) _condition).build(rc) : _condition; if (cond instanceof Condition) { args[i++] = cond; } else { args[i++] = new ConstantCondition(cond); } } if ( hasTarget() ) { args[i++] = _target; } if ( hasArguments() ) { args[i++] = getArguments(); } if ( isContainer() ) { args[i++] = _contents; } if ( isParser() ) { args[i++] = _text; } if ( isMulti() ) { args[i++] = _dependent; } } // build the arguments for (int i = 0; i < args.length; i++) { Object arg = args[i]; if ((arg != null) && (arg instanceof Builder)) { args[i] = ((Builder) arg).build(rc); } } // build the directive Object self; try { self = _build.invoke(null,args); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof BuildException) { throw (BuildException) t; } else { throw new BuildException("dependent: " + e); } } catch (Exception e) { throw new BuildException("dependent: " + e); } return self; }
|
public final Object build(BuildContext rc) throws BuildException { // collect the arguments Object args[] = new Object[_buildArgs]; { int i = 0; args[i++] = rc; if ( hasCondition() ) { Object cond = (_condition instanceof Builder) ? ((Builder) _condition).build(rc) : _condition; if (cond instanceof Condition) { args[i++] = cond; } else { args[i++] = new ConstantCondition(cond); } } if ( hasTarget() ) { args[i++] = _target; } if ( hasArguments() ) { args[i++] = getArguments(rc); } if ( isContainer() ) { args[i++] = _contents; } if ( isParser() ) { args[i++] = _text; } if ( isMulti() ) { args[i++] = _dependent; } } // build the arguments for (int i = 0; i < args.length; i++) { Object arg = args[i]; if ((arg != null) && (arg instanceof Builder)) { args[i] = ((Builder) arg).build(rc); } } // build the directive Object self; try { self = _build.invoke(null,args); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof BuildException) { throw (BuildException) t; } else { throw new BuildException("dependent: " + e); } } catch (Exception e) { throw new BuildException("dependent: " + e); } return self; }
| 1,124,281
|
private final Argument[] getArguments() { if (!hasArguments()) { return null; } if (_arguments == null) { _arguments = new Vector(); } Argument[] args = new Argument[_arguments.size()]; _arguments.copyInto(args); return args; }
|
private final Argument[] getArguments(BuildContext bc) throws BuildException { if (!hasArguments()) { return null; } if (_arguments == null) { _arguments = new Vector(); } Argument[] args = new Argument[_arguments.size()]; _arguments.copyInto(args); return args; }
| 1,124,282
|
OrCondition(Condition l, Condition r) { _l = l; _r = r; }
|
OrCondition(Condition l, Condition r) { _l = l; _r = r; System.out.println("Condition: " + l + " || + " + r); }
| 1,124,284
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _l.build(pc); return ((l instanceof Condition) && (r instanceof Condition)) ? (Object) new OrCondition((Condition) l, (Condition) r) : (l instanceof Condition) ? (Object) (Condition.isTrue(r) ? Boolean.TRUE : l) : (Object) (Condition.isTrue(l) ? Boolean.TRUE : r); }
|
public final Object build(BuildContext pc) throws BuildException { Object l, r; l = _l.build(pc); r = _r.build(pc); return ((l instanceof Condition) && (r instanceof Condition)) ? (Object) new OrCondition((Condition) l, (Condition) r) : (l instanceof Condition) ? (Object) (Condition.isTrue(r) ? Boolean.TRUE : l) : (Object) (Condition.isTrue(l) ? Boolean.TRUE : r); }
| 1,124,286
|
public SoundPanel() { setLayout(new GridBagLayout()); // Add ResourceUtils ResourceUtils.resButton(incomingMessageBox, "&Play sound when new message arrives"); ResourceUtils.resButton(outgoingMessageBox, "&Play sound when a message is sent"); ResourceUtils.resButton(userOfflineCheckbox, "&Play sound when user goes offline"); ResourceUtils.resButton(incomingBrowseButton, "&Browse"); ResourceUtils.resButton(outgoingBrowseButton, "B&rowse"); ResourceUtils.resButton(offlineBrowseButton, "Br&owse"); // Handle incoming sounds add(incomingMessageBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(incomingMessageSound, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(incomingBrowseButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // Handle sending sounds add(outgoingMessageBox, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(outgoingMessageSound, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(outgoingBrowseButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // Handle User Online Sound add(userOfflineCheckbox, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(userOfflineField, new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(offlineBrowseButton, new GridBagConstraints(1, 5, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); incomingBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFile("Choose Incoming Sound File", incomingMessageSound); } }); outgoingBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFile("Choose Outgoing Sound File", outgoingMessageSound); } }); offlineBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFile("Choose Offline Sound File", userOfflineField); } }); if (Spark.isWindows()) { fc.setFileSystemView(new WindowsFileSystemView()); } }
|
public SoundPanel() { setLayout(new GridBagLayout()); // Add ResourceUtils ResourceUtils.resButton(incomingMessageBox, "&Play sound when new message arrives"); ResourceUtils.resButton(outgoingMessageBox, "&Play sound when a message is sent"); ResourceUtils.resButton(userOfflineCheckbox, "&Play sound when user goes offline"); ResourceUtils.resButton(incomingBrowseButton, "&Browse"); ResourceUtils.resButton(outgoingBrowseButton, "B&rowse"); ResourceUtils.resButton(offlineBrowseButton, "Br&owse"); // Handle incoming sounds add(incomingMessageBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(incomingMessageSound, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(incomingBrowseButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // Handle sending sounds add(outgoingMessageBox, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(outgoingMessageSound, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(outgoingBrowseButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); // Handle User Online Sound add(userOfflineCheckbox, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(userOfflineField, new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(offlineBrowseButton, new GridBagConstraints(1, 5, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); incomingBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFile("Choose Incoming Sound File", incomingMessageSound); } }); outgoingBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFile("Choose Outgoing Sound File", outgoingMessageSound); } }); offlineBrowseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFile("Choose Offline Sound File", userOfflineField); } }); if (Spark.isWindows()) { fc.setFileSystemView(new WindowsFileSystemView()); } }
| 1,124,287
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
| 1,124,289
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
| 1,124,290
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
| 1,124,291
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } dn.setSelected(false); newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
|
public void ok(Event e) { DisplayedNote dn = dd.getTree().getSelectedNote(); Note note = dn.getNote(); DisplayedNote newDn; if (after) { Note newNote = new Note(addNoteDialog.getName(), note.getHolder(), note.getIndex() + 1, ""); newDn = new DisplayedNote(dn.getHolder(), dd.getTree(), newNote); } else { Note newNote = new Note(addNoteDialog.getName(), note, 0, ""); newDn = new DisplayedNote(dn, dd.getTree(), newNote); } newDn.setSelected(true); newDn.displayTab(dd.getTabFolder(), d); addNoteDialog.dispose(); deregister(); }
| 1,124,292
|
public void loadTree(Note root) { tree.removeAll(); new NoteTreeNode(tree, root); init(); }
|
public void loadTree(Note root) { tree.removeAll(); new DisplayedNote(tree, root); init(); }
| 1,124,293
|
public void showUsersFound(ReportedData data) { List columnList = new ArrayList(); Iterator columns = data.getColumns(); while (columns.hasNext()) { ReportedData.Column column = (ReportedData.Column)columns.next(); String label = column.getLabel(); columnList.add(label); } if (resultsTable == null) { resultsTable = new UsersInfoTable((String[])columnList.toArray(new String[columnList.size()])); final JScrollPane scrollPane = new JScrollPane(resultsTable); scrollPane.getViewport().setBackground(Color.white); add(scrollPane, BorderLayout.CENTER); resultsTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int row = resultsTable.getSelectedRow(); openChatRoom(row); } } public void mouseReleased(MouseEvent e) { if (!e.isPopupTrigger()) { return; } // Get agent final int row = resultsTable.rowAtPoint(e.getPoint()); final JPopupMenu menu = new JPopupMenu(); Action addContactAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { RosterDialog dialog = new RosterDialog(); String jid = (String)resultsTable.getValueAt(row, 0); TableColumn column = null; try { column = resultsTable.getColumn("Username"); } catch (Exception ex) { try { column = resultsTable.getColumn("nick"); } catch (Exception e1) { } } if (column != null) { int col = column.getModelIndex(); String nickname = (String)resultsTable.getValueAt(row, col); if (!ModelUtil.hasLength(nickname)) { nickname = StringUtils.parseName(jid); } dialog.setDefaultNickname(nickname); } dialog.setDefaultJID(jid); dialog.showRosterDialog(); } }; Action chatAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { openChatRoom(row); } }; Action profileAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = (String)resultsTable.getValueAt(row, 0); vcardSupport.viewProfile(jid, resultsTable); } }; final JMenuItem addAsContact = new JMenuItem(addContactAction); addContactAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE)); addContactAction.putValue(Action.NAME, "Add as Contact"); menu.add(addAsContact); final JMenuItem chatMenu = new JMenuItem(chatAction); chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); chatAction.putValue(Action.NAME, "Chat"); menu.add(chatMenu); final JMenuItem viewProfileMenu = new JMenuItem(profileAction); profileAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_PROFILE_IMAGE)); profileAction.putValue(Action.NAME, "View Profile"); menu.add(viewProfileMenu); menu.show(resultsTable, e.getX(), e.getY()); } public void mousePressed(MouseEvent e) { } }); } else { resultsTable.clearTable(); } // Populate with answers Iterator rows = data.getRows(); List modelList; while (rows.hasNext()) { modelList = new ArrayList(); ReportedData.Row row = (ReportedData.Row)rows.next(); for (int i = 0; i < resultsTable.getColumnCount(); i++) { String tableValue = (String)resultsTable.getTableHeader().getColumnModel().getColumn(i).getHeaderValue(); Iterator columnIterator = data.getColumns(); while (columnIterator.hasNext()) { ReportedData.Column column = (ReportedData.Column)columnIterator.next(); if (column.getLabel().equals(tableValue)) { tableValue = column.getVariable(); break; } } String modelValue = getFirstValue(row, tableValue); modelList.add(modelValue); } resultsTable.getTableModel().addRow(modelList.toArray()); } }
|
public void showUsersFound(ReportedData data) { List columnList = new ArrayList(); Iterator columns = data.getColumns(); while (columns.hasNext()) { ReportedData.Column column = (ReportedData.Column)columns.next(); String label = column.getLabel(); columnList.add(label); } if (resultsTable == null) { resultsTable = new UsersInfoTable((String[])columnList.toArray(new String[columnList.size()])); final JScrollPane scrollPane = new JScrollPane(resultsTable); scrollPane.getViewport().setBackground(Color.white); add(scrollPane, BorderLayout.CENTER); resultsTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int row = resultsTable.getSelectedRow(); openChatRoom(row); } } public void mouseReleased(MouseEvent e) { if (!e.isPopupTrigger()) { return; } // Get agent final int row = resultsTable.rowAtPoint(e.getPoint()); final JPopupMenu menu = new JPopupMenu(); Action addContactAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { RosterDialog dialog = new RosterDialog(); String jid = (String)resultsTable.getValueAt(row, 0); TableColumn column = null; try { column = resultsTable.getColumn("Username"); } catch (Exception ex) { try { column = resultsTable.getColumn("nick"); } catch (Exception e1) { } } if (column != null) { int col = column.getModelIndex(); String nickname = (String)resultsTable.getValueAt(row, col); if (!ModelUtil.hasLength(nickname)) { nickname = StringUtils.parseName(jid); } dialog.setDefaultNickname(nickname); } dialog.setDefaultJID(jid); dialog.showRosterDialog(); } }; Action chatAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { openChatRoom(row); } }; Action profileAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = (String)resultsTable.getValueAt(row, 0); vcardSupport.viewProfile(jid, resultsTable); } }; final JMenuItem addAsContact = new JMenuItem(addContactAction); addContactAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE)); addContactAction.putValue(Action.NAME, "Add as Contact"); menu.add(addAsContact); final JMenuItem chatMenu = new JMenuItem(chatAction); chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); chatAction.putValue(Action.NAME, "Chat"); menu.add(chatMenu); final JMenuItem viewProfileMenu = new JMenuItem(profileAction); profileAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_PROFILE_IMAGE)); profileAction.putValue(Action.NAME, "View Profile"); menu.add(viewProfileMenu); menu.show(resultsTable, e.getX(), e.getY()); } public void mousePressed(MouseEvent e) { } }); } else { resultsTable.clearTable(); } // Populate with answers Iterator rows = data.getRows(); List modelList; while (rows.hasNext()) { modelList = new ArrayList(); ReportedData.Row row = (ReportedData.Row)rows.next(); for (int i = 0; i < resultsTable.getColumnCount(); i++) { String tableValue = (String)resultsTable.getTableHeader().getColumnModel().getColumn(i).getHeaderValue(); Iterator columnIterator = data.getColumns(); while (columnIterator.hasNext()) { ReportedData.Column column = (ReportedData.Column)columnIterator.next(); if (column.getLabel().equals(tableValue)) { tableValue = column.getVariable(); break; } } String modelValue = getFirstValue(row, tableValue); modelList.add(modelValue); } resultsTable.getTableModel().addRow(modelList.toArray()); } }
| 1,124,294
|
public void mouseReleased(MouseEvent e) { if (!e.isPopupTrigger()) { return; } // Get agent final int row = resultsTable.rowAtPoint(e.getPoint()); final JPopupMenu menu = new JPopupMenu(); Action addContactAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { RosterDialog dialog = new RosterDialog(); String jid = (String)resultsTable.getValueAt(row, 0); TableColumn column = null; try { column = resultsTable.getColumn("Username"); } catch (Exception ex) { try { column = resultsTable.getColumn("nick"); } catch (Exception e1) { } } if (column != null) { int col = column.getModelIndex(); String nickname = (String)resultsTable.getValueAt(row, col); if (!ModelUtil.hasLength(nickname)) { nickname = StringUtils.parseName(jid); } dialog.setDefaultNickname(nickname); } dialog.setDefaultJID(jid); dialog.showRosterDialog(); } }; Action chatAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { openChatRoom(row); } }; Action profileAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = (String)resultsTable.getValueAt(row, 0); vcardSupport.viewProfile(jid, resultsTable); } }; final JMenuItem addAsContact = new JMenuItem(addContactAction); addContactAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE)); addContactAction.putValue(Action.NAME, "Add as Contact"); menu.add(addAsContact); final JMenuItem chatMenu = new JMenuItem(chatAction); chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); chatAction.putValue(Action.NAME, "Chat"); menu.add(chatMenu); final JMenuItem viewProfileMenu = new JMenuItem(profileAction); profileAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_PROFILE_IMAGE)); profileAction.putValue(Action.NAME, "View Profile"); menu.add(viewProfileMenu); menu.show(resultsTable, e.getX(), e.getY()); }
|
public void mouseReleased(MouseEvent e) { if (!e.isPopupTrigger()) { return; } // Get agent final int row = resultsTable.rowAtPoint(e.getPoint()); final JPopupMenu menu = new JPopupMenu(); Action addContactAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { RosterDialog dialog = new RosterDialog(); String jid = (String)resultsTable.getValueAt(row, 0); TableColumn column = null; try { column = resultsTable.getColumn("Username"); } catch (Exception ex) { try { column = resultsTable.getColumn("nick"); } catch (Exception e1) { } } if (column != null) { int col = column.getModelIndex(); String nickname = (String)resultsTable.getValueAt(row, col); if (!ModelUtil.hasLength(nickname)) { nickname = StringUtils.parseName(jid); } dialog.setDefaultNickname(nickname); } dialog.setDefaultJID(jid); dialog.showRosterDialog(); } }; Action chatAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { openChatRoom(row); } }; Action profileAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { VCardManager vcardSupport = SparkManager.getVCardManager(); String jid = (String)resultsTable.getValueAt(row, 0); vcardSupport.viewProfile(jid, resultsTable); } }; final JMenuItem addAsContact = new JMenuItem(addContactAction); addContactAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_ADD_IMAGE)); addContactAction.putValue(Action.NAME, "Add as Contact"); menu.add(addAsContact); final JMenuItem chatMenu = new JMenuItem(chatAction); chatAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_MESSAGE_IMAGE)); chatAction.putValue(Action.NAME, "Chat"); menu.add(chatMenu); final JMenuItem viewProfileMenu = new JMenuItem(profileAction); profileAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.SMALL_PROFILE_IMAGE)); profileAction.putValue(Action.NAME, "View Profile"); menu.add(viewProfileMenu); menu.show(resultsTable, e.getX(), e.getY()); }
| 1,124,297
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; ; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; ; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
| 1,124,298
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; ; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; start<=end; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
| 1,124,299
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; ; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; ; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
| 1,124,300
|
public final Template handle(WebContext wc) throws HandlerException { String pageName = null; WikiPage wikiPage = null; // who is trying to do something? WikiUser user = getUser (wc); // which action wants to respond to this request? PageAction action = _actionManager.getAction (wc, user); // use the action to determine which WikiPage // we should be dealing with if (action != null) pageName = action.getWikiPageName (_wiki, wc); if (pageName != null) wikiPage = _wiki.getPage (pageName); // stuff the webcontext with useful stuff stuffContext (wc, wikiPage, user, pageName); if (action == null) throw new HandlerException ("Unable to find a PageAction to handle" + " this request."); try { // attempt to perform the action against the page action.perform (_wiki, wc, user, wikiPage); } catch (PageAction.RedirectException re) { // action wants us to redirect somewhere else try { wc.getResponse().sendRedirect (re.getURL()); } catch (IOException ioe) { throw new HandlerException ("Cannot redirect to " + re.getURL(), ioe); } return null; } catch (Exception e) { // something bad happened while performing the action // TODO: Handle error and error template ourselves e.printStackTrace(); throw new HandlerException (e.toString()); } finally { if (user != null) _wiki.updateUser(user); } // the action performed successfully, so now return // the template it wants us to use try { // determine the template name and return String templateName = action.getTemplateName(_wiki, wikiPage); return getTemplate (templateName); } catch (ResourceException re) { throw new HandlerException ("Could not get template", re); } }
|
public final Template handle(WebContext wc) throws HandlerException { String pageName = null; WikiPage wikiPage = null; // who is trying to do something? WikiUser user = getUser (wc); // which action wants to respond to this request? PageAction action = _actionManager.getAction (wc, user); // use the action to determine which WikiPage // we should be dealing with if (action != null) pageName = action.getWikiPageName (_wiki, wc); if (pageName != null) wikiPage = _wiki.getPage (pageName); // stuff the webcontext with useful stuff stuffContext (wc, wikiPage, user, pageName); if (action == null) throw new HandlerException ("Unable to find a PageAction to handle" + " this request."); try { // attempt to perform the action against the page action.perform (_wiki, wc, user, wikiPage); } catch (PageAction.RedirectException re) { // action wants us to redirect somewhere else try { wc.getResponse().sendRedirect (re.getURL()); } catch (IOException ioe) { throw new HandlerException ("Cannot redirect to " + re.getURL(), ioe); } return null; } catch (Exception e) { // something bad happened while performing the action // TODO: Handle error and error template ourselves log("Error handling request", e); throw new HandlerException (e.toString()); } finally { if (user != null) _wiki.updateUser(user); } // the action performed successfully, so now return // the template it wants us to use try { // determine the template name and return String templateName = action.getTemplateName(_wiki, wikiPage); return getTemplate (templateName); } catch (ResourceException re) { throw new HandlerException ("Could not get template", re); } }
| 1,124,301
|
private void generateClassList(PackageData packageData) throws IOException { String filename; Collection classes; if (packageData == null) { filename = "frame-classes.html"; classes = projectData.getClasses(); } else { filename = "frame-classes-" + packageData.getName() + ".html"; classes = packageData.getChildren(); } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report Classes</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h5>"); out.println(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<h5>Classes</h5>"); out.println("<table width=\"100%\">"); Map sortedClassList = new TreeMap(); for (Iterator iter = classes.iterator(); iter.hasNext();) { ClassData classData = (ClassData)iter.next(); sortedClassList.put(classData.getBaseName(), classData); } for (Iterator iter = sortedClassList.values().iterator(); iter .hasNext();) { ClassData classData = (ClassData)iter.next(); out.println("<tr>"); String percentCovered; if (classData.getNumberOfValidLines() > 0) percentCovered = getPercentValue(classData .getLineCoverageRate()); else percentCovered = "N/A"; out .println("<td nowrap=\"nowrap\"><a target=\"summary\" href=\"" + classData.getName() + ".html\">" + classData.getBaseName() + "</a> <i>(" + percentCovered + ")</i></td>"); out.println("</tr>"); } out.println("</td>"); out.println("</tr>"); out.println("</table>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
|
private void generateClassList(PackageData packageData) throws IOException { String filename; Collection classes; if (packageData == null) { filename = "frame-classes.html"; classes = projectData.getClasses(); } else { filename = "frame-classes-" + packageData.getName() + ".html"; classes = packageData.getClasses(); } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report Classes</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h5>"); out.println(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<h5>Classes</h5>"); out.println("<table width=\"100%\">"); Map sortedClassList = new TreeMap(); for (Iterator iter = classes.iterator(); iter.hasNext();) { ClassData classData = (ClassData)iter.next(); sortedClassList.put(classData.getBaseName(), classData); } for (Iterator iter = sortedClassList.values().iterator(); iter .hasNext();) { ClassData classData = (ClassData)iter.next(); out.println("<tr>"); String percentCovered; if (classData.getNumberOfValidLines() > 0) percentCovered = getPercentValue(classData .getLineCoverageRate()); else percentCovered = "N/A"; out .println("<td nowrap=\"nowrap\"><a target=\"summary\" href=\"" + classData.getName() + ".html\">" + classData.getBaseName() + "</a> <i>(" + percentCovered + ")</i></td>"); out.println("</tr>"); } out.println("</td>"); out.println("</tr>"); out.println("</table>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
| 1,124,303
|
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getChildren(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
|
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
| 1,124,304
|
static private String makeName(Object[] names) { StringBuffer buf = new StringBuffer(); buf.append("$("); for (int i = 0; i < names.length; i++) { if (i != 0) buf.append("."); buf.append((names[i] != null) ? names[i] : "NULL"); } buf.append(")"); return buf.toString(); }
|
static protected String makeName(Object[] names) { StringBuffer buf = new StringBuffer(); buf.append("$("); for (int i = 0; i < names.length; i++) { if (i != 0) buf.append("."); buf.append((names[i] != null) ? names[i] : "NULL"); } buf.append(")"); return buf.toString(); }
| 1,124,308
|
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy, Throwable[] futureThrowable) { this.serviceManager = serviceManager; this.stopStrategy = stopStrategy; this.futureThrowable = futureThrowable; }
|
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy) { this.serviceManager = serviceManager; this.stopStrategy = stopStrategy; this.futureThrowable = futureThrowable; }
| 1,124,310
|
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy, Throwable[] futureThrowable) { this.serviceManager = serviceManager; this.stopStrategy = stopStrategy; this.futureThrowable = futureThrowable; }
|
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy, Throwable[] futureThrowable) { this.serviceManager = serviceManager; this.stopStrategy = stopStrategy; }
| 1,124,311
|
public Object call() { try { serviceManager.destroy(stopStrategy); synchronized (serviceManagers) { serviceManagers.remove(serviceManager.getServiceName()); } return null; } catch (Throwable e) { // we did not destroy the service... save the exception and return the service manager // so it remains registered with the kernel synchronized (futureThrowable) { futureThrowable[0] = e; } return serviceManager; } }
|
public Object call() { try { serviceManager.destroy(stopStrategy); synchronized (serviceManagers) { serviceManagers.remove(serviceManager.getServiceName()); } return null; } catch (Throwable e) { // we did not destroy the service... save the exception and return the service manager // so it remains registered with the kernel synchronized (futureThrowable) { futureThrowable[0] = e; } return serviceManager; } }
| 1,124,312
|
public DisplayedNote(NoteTreeNode treeNode, Note note) { this.treeNode = treeNode; this.note = note; }
|
public DisplayedNote(NoteTreeNode treeNode, Note note) { this.treeNode = treeNode; this.note = note; }
| 1,124,314
|
private ConstructorMetadata getConstructor(RootBeanDefinition rootBeanDefinition) { Class beanType = rootBeanDefinition.getBeanClass(); // try to get the class metadata ClassMetadata classMetadata = metadataManager.getClassMetadata(beanType); // get a set containing the names of the defined properties Set propertyNames = new HashSet(); PropertyValue[] values = rootBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < values.length; i++) { propertyNames.add(values[i].getName()); } // get the constructors sorted by longest arg length first List constructors = new ArrayList(classMetadata.getConstructors()); Collections.sort(constructors, new ArgLengthComparator()); // try to find a constructor for which we have all of the properties defined for (Iterator iterator = constructors.iterator(); iterator.hasNext();) { ConstructorMetadata constructorMetadata = (ConstructorMetadata) iterator.next(); if (constructorMetadata.getProperties().containsKey("always-use")) { return constructorMetadata; } List constructorArgNames = getConstructorArgNames(constructorMetadata); if (constructorArgNames != null && propertyNames.containsAll(constructorArgNames)) { return constructorMetadata; } } return null; }
|
private ConstructorMetadata getConstructor(RootBeanDefinition rootBeanDefinition) { Class beanType = rootBeanDefinition.getBeanClass(); // try to get the class metadata ClassMetadata classMetadata = metadataManager.getClassMetadata(beanType); // get a set containing the names of the defined properties Set propertyNames = new HashSet(); PropertyValue[] values = rootBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < values.length; i++) { propertyNames.add(values[i].getName()); } // get the constructors sorted by longest arg length first List constructors = new ArrayList(classMetadata.getConstructors()); Collections.sort(constructors, new ArgLengthComparator()); // try to find a constructor for which we have all of the properties defined for (Iterator iterator = constructors.iterator(); iterator.hasNext();) { ConstructorMetadata constructorMetadata = (ConstructorMetadata) iterator.next(); if (constructorMetadata.getProperties().containsKey("always-use")) { return constructorMetadata; } List constructorArgNames = getConstructorArgNames(constructorMetadata); if (constructorArgNames != null && propertyNames.containsAll(constructorArgNames)) { return constructorMetadata; } } return null; }
| 1,124,316
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); parametersToConstructorArgs(rootBeanDefinition); }
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); parametersToConstructorArgs(rootBeanDefinition); }
| 1,124,317
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); parametersToConstructorArgs(rootBeanDefinition); }
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); processParameters(rootBeanDefinition); }
| 1,124,318
|
final public void resourceRequest(RequestResourceEvent evt) throws NotFoundException { try { URL u = new URL(evt.getName()); Reader in = new InputStreamReader(u.openStream()); char buf[] = new char[512]; StringWriter sw = new StringWriter(); int num; while ( (num = in.read(buf)) != -1 ) { sw.write(buf, 0, num); } evt.set(sw.toString()); in.close(); } catch (Exception e) { _log.exception(e); throw new NotFoundException( "Reactor: Unable to load URL " + evt.getName() + ":" + e); } }
|
final public void resourceRequest(RequestResourceEvent evt) throws NotFoundException { try { String name = evt.getName(); URL u; if (name.indexOf(":") < 3) { u = new URL("file",null,-1,name); } else { u = new URL(name); } Reader in = new InputStreamReader(u.openStream()); char buf[] = new char[512]; StringWriter sw = new StringWriter(); int num; while ( (num = in.read(buf)) != -1 ) { sw.write(buf, 0, num); } evt.set(sw.toString()); in.close(); } catch (Exception e) { _log.exception(e); throw new NotFoundException( "Reactor: Unable to load URL " + evt.getName() + ":" + e); } }
| 1,124,320
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
| 1,124,321
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
| 1,124,322
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
| 1,124,323
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (totalBranchCoverageRate != null) { throw new BuildException(); } }
| 1,124,324
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
|
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { getJava().createArg().setValue("--totalbranch"); getJava().createArg().setValue(totalBranchCoverageRate); } }
| 1,124,325
|
static public Object parseQuotedString(ParseTool in) throws ParseException, IOException { int quoteChar = in.getChar(); boolean isMacro = false; if ((quoteChar != '\'') && (quoteChar != '\"')) { return null; // undefined quote char } StringBuffer str = new StringBuffer(96); QuotedStringBuilder qString = new QuotedStringBuilder(); int c = in.nextChar(); while ((c != quoteChar) && (c != in.EOF)) { if (c == '$') { Object child = parseVariable(in); // may return a string c = in.getChar(); if (child instanceof String) { str.append(child); } else { qString.addElement(str.toString()); qString.addElement(child); str.setLength(0); } } else { str.append((char) c); c = in.nextChar(); } } if (str.length() != 0) { qString.addElement(str.toString()); } str = null; if (c == quoteChar) { in.nextChar(); } else { throw new ParseException(in, "Expected closing quote: " + (char) quoteChar); } if ((qString.size() == 1) && !(qString.elementAt(0) instanceof Builder)) { // XXX: #use directive fails without this, because it needs to // access target and source during the parse phase, before the // build has been completed. return qString.elementAt(0); } else { return qString; } }
|
static public Object parseQuotedString(ParseTool in) throws ParseException, IOException { int quoteChar = in.getChar(); boolean isMacro = false; if ((quoteChar != '\'') && (quoteChar != '\"')) { return null; // undefined quote char } StringBuffer str = new StringBuffer(96); QuotedStringBuilder qString = new QuotedStringBuilder(); int c = in.nextChar(); while ((c != quoteChar) && (c != in.EOF)) { if ((c == '$') && !in.isEscaped()) { Object child = parseVariable(in); // may return a string c = in.getChar(); if (child instanceof String) { str.append(child); } else { qString.addElement(str.toString()); qString.addElement(child); str.setLength(0); } } else { str.append((char) c); c = in.nextChar(); } } if (str.length() != 0) { qString.addElement(str.toString()); } str = null; if (c == quoteChar) { in.nextChar(); } else { throw new ParseException(in, "Expected closing quote: " + (char) quoteChar); } if ((qString.size() == 1) && !(qString.elementAt(0) instanceof Builder)) { // XXX: #use directive fails without this, because it needs to // access target and source during the parse phase, before the // build has been completed. return qString.elementAt(0); } else { return qString; } }
| 1,124,329
|
ParseTool(String name, Reader inputStream) { _escaped = false; _name = name; LineNumberReader in = new LineNumberReader(inputStream); _cur = _last = _len = _pos = EOF; _buf = ""; // must be non-null or we will abort before we start _in = in; for (int i = 0; i < MAX_MARKS; i++) { _marks[i] = new Mark(); } read(); // get it started (read the extra newline) }
|
ParseTool(String name, Reader inputStream) { _escaped = false; _name = name; LineNumberReader in = new LineNumberReader(inputStream); _cur = _last = _len = _pos = EOF; _buf = ""; // must be non-null or we will abort before we start _in = in; for (int i = 0; i < MAX_MARKS; i++) { _marks[i] = new Mark(); } read(); // get it started (read the extra newline) }
| 1,124,330
|
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
|
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
| 1,124,331
|
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
|
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
| 1,124,332
|
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
|
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
| 1,124,333
|
public final boolean isNameStartChar() { return isNameStartChar(_cur); }
|
public final boolean isNameStartChar() { return isNameStartChar(_cur); }
| 1,124,334
|
public MockServiceFactory() throws NullPointerException { super(SERVICE); }
|
private MockServiceFactory() throws NullPointerException { super(SERVICE); }
| 1,124,336
|
public Object getData() { LocalPreferences pref = SettingsManager.getLocalPreferences(); String nickname = pref.getDefaultNickname(); if (nickname == null) { nickname = SparkManager.getSessionManager().getUsername(); } boolean showTime = pref.isTimeDisplayedInChat(); preferences.showDatesInChat(showTime); return preferences; }
|
public Object getData() { LocalPreferences pref = SettingsManager.getLocalPreferences(); String nickname = pref.getDefaultNickname(); if (nickname == null) { nickname = SparkManager.getSessionManager().getUsername(); } boolean showTime = pref.isTimeDisplayedInChat(); preferences.showDatesInChat(showTime); return preferences; }
| 1,124,337
|
final public Object next () throws NoSuchElementException { if (!hasNext) { throw new NoSuchElementException("advanced past end of list"); } Object o = enum.nextElement(); hasNext = enum.hasMoreElements(); return o; }
|
final public Object next () throws NoSuchElementException { if (!hasNext) { throw new NoSuchElementException("advanced past end of list"); } Object o = enum.nextElement(); hasNext = enum.hasMoreElements(); return o; }
| 1,124,338
|
public void removeNotes(Event e) { for (DisplayedNote removeMe : dd.getTree().getSelectedNotes()) { removeMe.deleteSelfAndChildren(); } }
|
public void removeNotes(Event e) { while (dd.getTree().getSelectedNotes().size() > 0) { DisplayedNote removeMe = dd.getTree().getSelectedNotes().get(0); removeMe.deleteSelfAndChildren(); } }
| 1,124,339
|
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
|
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
| 1,124,341
|
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
|
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) { u = _servletClassLoader.getResource(name); if (u == null) { u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
| 1,124,342
|
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
|
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } } if (u == null) u = _servletClassLoader.getResource(name); } if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
| 1,124,343
|
public void closeChatRoom() { super.closeChatRoom(); SparkManager.getMessageEventManager().removeMessageEventRequestListener(messageEventRequestListener); SparkManager.getChatManager().removeChat(this); SparkManager.getConnection().removePacketListener(this); }
|
public void closeChatRoom() { super.closeChatRoom(); SparkManager.getChatManager().removeChat(this); SparkManager.getConnection().removePacketListener(this); }
| 1,124,344
|
public void insertUpdate(DocumentEvent e) { checkForText(e); lastTypedCharTime = System.currentTimeMillis(); // If the user pauses for more than two seconds, send out a new notice. if (sendNotification) { try { if (sendTypingNotification) { SparkManager.getMessageEventManager().sendComposingNotification(getParticipantJID(), threadID); } sendNotification = false; } catch (Exception exception) { Log.error("Error updating", exception); } } }
|
public void insertUpdate(DocumentEvent e) { checkForText(e); lastTypedCharTime = System.currentTimeMillis(); // If the user pauses for more than two seconds, send out a new notice. if (sendNotification) { try { if (sendTypingNotification) { SparkManager.getMessageEventManager().sendComposingNotification(getParticipantJID(), threadID); } sendNotification = false; } catch (Exception exception) { Log.error("Error updating", exception); } } }
| 1,124,346
|
public TransportRegistrationDialog(String serviceName) { setLayout(new GridBagLayout()); this.serviceName = serviceName; ResourceUtils.resButton(registerButton, Res.getString("button.register")); ResourceUtils.resButton(cancelButton, Res.getString("button.cancel")); final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.add(registerButton); registerButton.requestFocus(); buttonPanel.add(cancelButton); transport = TransportManager.getTransport(serviceName); final TitlePanel titlePanel = new TitlePanel(transport.getTitle(), transport.getInstructions(), 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, Res.getString("label.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, Res.getString("label.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)); add(buttonPanel, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
|
public TransportRegistrationDialog(String serviceName) { setLayout(new GridBagLayout()); this.serviceName = serviceName; ResourceUtils.resButton(registerButton, Res.getString("button.register")); ResourceUtils.resButton(cancelButton, Res.getString("button.cancel")); final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.add(registerButton); registerButton.requestFocus(); buttonPanel.add(cancelButton); transport = TransportUtils.getTransport(serviceName); final TitlePanel titlePanel = new TitlePanel(transport.getTitle(), transport.getInstructions(), 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, Res.getString("label.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, Res.getString("label.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)); add(buttonPanel, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
| 1,124,347
|
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();) { String key = (String) enum.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
|
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enumeration = _request.getParameterNames(); enumeration.hasMoreElements();) { String key = (String) enum.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
| 1,124,348
|
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();) { String key = (String) enum.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
|
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();) { String key = (String) enumeration.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
| 1,124,349
|
public void loadPlugins() { // Add presence and message listeners // we listen for these to force open a 1-1 peer chat window from other operators if // one isn't already open PacketFilter workspaceMessageFilter = new PacketTypeFilter(Message.class); // Add the packetListener to this instance SparkManager.getSessionManager().getConnection().addPacketListener(this, workspaceMessageFilter); // Make presence available to anonymous requests, if from anonymous user in the system. PacketListener workspacePresenceListener = new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getProperty("anonymous") != null) { boolean isAvailable = statusBox.getPresence().getMode() == Presence.Mode.available; Presence reply = new Presence(Presence.Type.available); if (!isAvailable) { reply.setType(Presence.Type.unavailable); } reply.setTo(presence.getFrom()); SparkManager.getSessionManager().getConnection().sendPacket(reply); } } }; SparkManager.getSessionManager().getConnection().addPacketListener(workspacePresenceListener, new PacketTypeFilter(Presence.class)); // Send Available status final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence(); SparkManager.getSessionManager().changePresence(presence); // Load Plugins SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(100); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; } public void finished() { final PluginManager pluginManager = PluginManager.getInstance(); pluginManager.loadPlugins(); pluginManager.initializePlugins(); } }; worker.start(); int numberOfMillisecondsInTheFuture = 5000; // 5 sec Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator offlineMessage = offlineMessages.iterator(); while (offlineMessage.hasNext()) { Message offline = (Message)offlineMessage.next(); handleOfflineMessage(offline); } } }); } }, timeToRun); }
|
public void loadPlugins() { // Add presence and message listeners // we listen for these to force open a 1-1 peer chat window from other operators if // one isn't already open PacketFilter workspaceMessageFilter = new PacketTypeFilter(Message.class); // Add the packetListener to this instance SparkManager.getSessionManager().getConnection().addPacketListener(this, workspaceMessageFilter); // Make presence available to anonymous requests, if from anonymous user in the system. PacketListener workspacePresenceListener = new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getProperty("anonymous") != null) { boolean isAvailable = statusBox.getPresence().getMode() == Presence.Mode.available; Presence reply = new Presence(Presence.Type.available); if (!isAvailable) { reply.setType(Presence.Type.unavailable); } reply.setTo(presence.getFrom()); SparkManager.getSessionManager().getConnection().sendPacket(reply); } } }; SparkManager.getSessionManager().getConnection().addPacketListener(workspacePresenceListener, new PacketTypeFilter(Presence.class)); // Send Available status final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence(); SparkManager.getSessionManager().changePresence(presence); // Load Plugins SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(100); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; } public void finished() { final PluginManager pluginManager = PluginManager.getInstance(); pluginManager.loadPlugins(); pluginManager.initializePlugins(); } }; worker.start(); int numberOfMillisecondsInTheFuture = 10000; // 5 sec Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator offlineMessage = offlineMessages.iterator(); while (offlineMessage.hasNext()) { Message offline = (Message)offlineMessage.next(); handleOfflineMessage(offline); } } }); } }, timeToRun); }
| 1,124,351
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { Broker broker = context.getBroker(); // the filename arg passed to us was a Macro, so // evaluate and check it now if (_macFilename != null) { _strFilename = _macFilename.evaluate(context).toString(); if (_strFilename == null || _strFilename.length() == 0) { throw makePropertyException("Filename cannot be null or empty"); } } if (_log.loggingDebug() && context.getCurrentLocation().indexOf(_strFilename) > -1) { // when in debug mode, output a warning if a template tries to include itself // there are situtations where this is desired, but it's good to make // the user aware of what they're doing _log.warning(context.getCurrentLocation() + " includes itself."); } // this should only be true if StrictCompatibility is set to false // and "as <something>" wasn't specified in the arg list if (_type == TYPE_DYNAMIC) _type = guessType(broker, _strFilename); if (_log.loggingDebug()) { _log.debug("Including '" + _strFilename + "' as " + ((_type == TYPE_MACRO) ? "MACRO" : (_type == TYPE_TEMPLATE) ? "TEMPLATE" : (_type == TYPE_TEXT) ? "TEXT" : "UNKNOWN. Throwing exceptin")); } Object toInclude = getThingToInclude(broker, _type, _strFilename); switch (_type) { case TYPE_MACRO: // during runtime evaluation of a template, // a TYPE_MACRO doesn't really work as expected. // we logged a warning above in build(), but // we still need to write it out as a template // so just fall through case TYPE_TEMPLATE: ((Template) toInclude).write(out, context); break; case TYPE_TEXT: // static types are strings out.write(toInclude.toString()); break; default: // should never happen throw makePropertyException("Unrecognized file type: " + _type); } }
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { Broker broker = context.getBroker(); // the filename arg passed to us was a Macro, so // evaluate and check it now if (_macFilename != null) { _strFilename = _macFilename.evaluate(context).toString(); if (_strFilename == null || _strFilename.length() == 0) { throw makePropertyException("Filename cannot be null or empty"); } } if (_log.loggingDebug() && context.getCurrentLocation().indexOf(_strFilename) > -1) { // when in debug mode, output a warning if a template tries to include itself // there are situtations where this is desired, but it's good to make // the user aware of what they're doing _log.warning(context.getCurrentLocation() + " includes itself."); } // this should only be true if StrictCompatibility is set to false // and "as <something>" wasn't specified in the arg list if (_type == TYPE_DYNAMIC) _type = guessType(broker, _strFilename); if (_log.loggingDebug()) { _log.debug("Including '" + _strFilename + "' as " + ((_type == TYPE_MACRO) ? "MACRO" : (_type == TYPE_TEMPLATE) ? "TEMPLATE" : (_type == TYPE_TEXT) ? "TEXT" : "UNKNOWN. Throwing exception")); } Object toInclude = getThingToInclude(broker, _type, _strFilename); switch (_type) { case TYPE_MACRO: // during runtime evaluation of a template, // a TYPE_MACRO doesn't really work as expected. // we logged a warning above in build(), but // we still need to write it out as a template // so just fall through case TYPE_TEMPLATE: ((Template) toInclude).write(out, context); break; case TYPE_TEXT: // static types are strings out.write(toInclude.toString()); break; default: // should never happen throw makePropertyException("Unrecognized file type: " + _type); } }
| 1,124,353
|
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 = wm.getContext(); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { 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 = new FastWriter(System.out, "UTF8"); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
|
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 = wm.getContext(); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { 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 = new FastWriter(System.out, context.getEncoding()); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
| 1,124,354
|
protected static Method findMethod(String name) { Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper"); if (type != null) { Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals(name)) { return method; } } } return null; }
|
protected static Method findMethod(String name) { Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper"); if (type != null) { Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals(name)) { return method; } } } return null; }
| 1,124,355
|
public void run() { Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); removeContactItem(jid); } }
|
public void run() { Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; if (getContactGroup(group.getName()) == null) { 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); } 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(); } } else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } 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()) { offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
| 1,124,357
|
public void entriesUpdated(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 = 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(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); 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. Set groupSet = new HashSet(); 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 entriesUpdated(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 = 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(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); 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. Set groupSet = new HashSet(); 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); } } } } } } }); }
| 1,124,358
|
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 = 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(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); 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. Set groupSet = new HashSet(); 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() { 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 = 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(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); 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. Set groupSet = new HashSet(); 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); } } } } } }
| 1,124,359
|
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 = 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(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); 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. Set groupSet = new HashSet(); 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 = 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(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); 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. Set groupSet = new HashSet(); 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); } } } } } }
| 1,124,360
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
| 1,124,361
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
| 1,124,362
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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); SparkManager.getWorkspace().removeAlert(layoutPanel); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
| 1,124,363
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
| 1,124,364
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
|
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 = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); 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)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("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) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); 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, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
| 1,124,365
|
public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(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(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } }
| 1,124,366
|
public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); }
|
public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); }
| 1,124,367
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { Map globalBeans = BeanConf.globalBeans; Map appBeans = beanConf.appBeans; boolean isNew = false; try { while (initArgObj instanceof Macro) initArgObj = ((Macro) initArgObj).evaluate(context); // store init args in array if (initArgObj == null || initArgObj.getClass().isArray()){ initArgs = (Object[])initArgObj; } else { initArgs = new Object[1]; initArgs[0] = initArgObj; } Object o = null; Class c = null; switch (scope){ case BEAN_SCOPE_GLOBAL: synchronized (globalBeans){ o = globalBeans.get(targetName); if (o == null){ if (isStaticClass){ c = context.getBroker().classForName(_className); o = new org.webmacro.engine.StaticClassWrapper(c); } else { //c = Class.forName(_className); //o = c.newInstance(); o = instantiate(_className, initArgs); } isNew = true; globalBeans.put(targetName,o); } } break; case BEAN_SCOPE_APPLICATION: synchronized (appBeans){ o = appBeans.get(targetName); if (o == null){ o = instantiate(_className, initArgs); isNew = true; appBeans.put(targetName, o); } } break; case BEAN_SCOPE_SESSION: javax.servlet.http.HttpSession session = (javax.servlet.http.HttpSession)context.getProperty("Session"); //if (context instanceof WebContext){ if (session != null){ synchronized(session){ o = session.getAttribute(targetName); if (o == null){ o = instantiate(_className, initArgs); isNew = true; session.setAttribute(targetName, o); } } } else { PropertyException e = new PropertyException( "#bean usage error: session scope is only valid with servlets!"); _broker.getEvaluationExceptionHandler().evaluate( target, context, e); } break; default: // make "page" the default scope //case BEAN_SCOPE_PAGE: // NOTE: page beans always overwrite anything in the context // with the same name o = instantiate(_className, initArgs); isNew = true; if (o != null){ Class[] paramTypes = { Context.class }; try { java.lang.reflect.Method m = o.getClass().getMethod("init", paramTypes); if (m != null){ Object[] args = { context }; m.invoke(o, args); } } catch (Exception e){ // ignore } } break; } _log.debug("BeanDirective: Class " + _className + " loaded."); target.setValue(context, o); } catch (PropertyException e) { this._broker.getEvaluationExceptionHandler().evaluate(target, context, e); } catch (Exception e) { String errorText = "BeanDirective: Unable to load bean " + target + " of type " + _className; _log.error(errorText, e); writeWarning(errorText, context, out); } if (isNew && onNewBlock != null) onNewBlock.write(out, context); }
|
public void write(FastWriter out, Context context) throws PropertyException, IOException { Map globalBeans = BeanConf.globalBeans; Map appBeans = beanConf.appBeans; boolean isNew = false; try { while (initArgObj instanceof Macro && initArgObj != UNDEF) initArgObj = ((Macro) initArgObj).evaluate(context); // store init args in array if (initArgObj == null || initArgObj.getClass().isArray()){ initArgs = (Object[])initArgObj; } else { initArgs = new Object[1]; initArgs[0] = initArgObj; } Object o = null; Class c = null; switch (scope){ case BEAN_SCOPE_GLOBAL: synchronized (globalBeans){ o = globalBeans.get(targetName); if (o == null){ if (isStaticClass){ c = context.getBroker().classForName(_className); o = new org.webmacro.engine.StaticClassWrapper(c); } else { //c = Class.forName(_className); //o = c.newInstance(); o = instantiate(_className, initArgs); } isNew = true; globalBeans.put(targetName,o); } } break; case BEAN_SCOPE_APPLICATION: synchronized (appBeans){ o = appBeans.get(targetName); if (o == null){ o = instantiate(_className, initArgs); isNew = true; appBeans.put(targetName, o); } } break; case BEAN_SCOPE_SESSION: javax.servlet.http.HttpSession session = (javax.servlet.http.HttpSession)context.getProperty("Session"); //if (context instanceof WebContext){ if (session != null){ synchronized(session){ o = session.getAttribute(targetName); if (o == null){ o = instantiate(_className, initArgs); isNew = true; session.setAttribute(targetName, o); } } } else { PropertyException e = new PropertyException( "#bean usage error: session scope is only valid with servlets!"); _broker.getEvaluationExceptionHandler().evaluate( target, context, e); } break; default: // make "page" the default scope //case BEAN_SCOPE_PAGE: // NOTE: page beans always overwrite anything in the context // with the same name o = instantiate(_className, initArgs); isNew = true; if (o != null){ Class[] paramTypes = { Context.class }; try { java.lang.reflect.Method m = o.getClass().getMethod("init", paramTypes); if (m != null){ Object[] args = { context }; m.invoke(o, args); } } catch (Exception e){ // ignore } } break; } _log.debug("BeanDirective: Class " + _className + " loaded."); target.setValue(context, o); } catch (PropertyException e) { this._broker.getEvaluationExceptionHandler().evaluate(target, context, e); } catch (Exception e) { String errorText = "BeanDirective: Unable to load bean " + target + " of type " + _className; _log.error(errorText, e); writeWarning(errorText, context, out); } if (isNew && onNewBlock != null) onNewBlock.write(out, context); }
| 1,124,368
|
public Dispatcher(DisplayedDocument dd) { controllers = new LinkedList<Controller>(); controllers.add(new MainController(dd)); controllers.add(new MainMenuController(dd)); controllers.add(new TreeContextMenuController(dd)); controllers.add(new TreeController(dd)); }
|
public Dispatcher(DisplayedDocument dd) { controllers = new LinkedList<Controller>(); controllers.add(new MainController(dd)); controllers.add(new MainMenuController(dd)); controllers.add(new TreeContextMenuController(dd)); controllers.add(new TreeController(dd)); }
| 1,124,369
|
public void invokeControllerMethod(String methodDescriptor, Event e) { // Get the controller and method. Controller controller = null; Method method = null; Iterator<Controller> iter = controllers.iterator(); while (iter.hasNext() && (method == null)) { controller = iter.next(); method = controller.getMethod(methodDescriptor); } if (method == null) { throw new KoalaException("Koala Notes could not find method '" + methodDescriptor + "'."); } // Invoke the method. try { method.invoke(controller, new Object[] {e}); } catch (IllegalAccessException iaex) { throw new KoalaException("Koala Notes could not access method '" + methodDescriptor + "'.", iaex); } catch (InvocationTargetException itex) { if (itex.getCause() instanceof RuntimeException) { throw (RuntimeException) itex.getCause(); } else throw new KoalaException(itex.getCause()); } }
|
public void invokeControllerMethod(String methodDescriptor, Event e) { // Get the controller and method. Controller controller = null; Method method = null; Iterator<Controller> iter = controllers.iterator(); while (iter.hasNext() && (method == null)) { controller = iter.next(); method = controller.getMethod(methodDescriptor); } if (method == null) { throw new KoalaException("Koala Notes could not find method '" + methodDescriptor + "'."); } // Invoke the method. try { method.invoke(controller, new Object[] {e}); } catch (IllegalAccessException iaex) { throw new KoalaException("Koala Notes could not access method '" + methodDescriptor + "'.", iaex); } catch (InvocationTargetException itex) { if (itex.getCause() instanceof RuntimeException) { throw (RuntimeException) itex.getCause(); } else throw new KoalaException(itex.getCause()); } }
| 1,124,370
|
final protected void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doRequest (req,resp); }
|
protected void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doRequest (req,resp); }
| 1,124,372
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
| 1,124,373
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
| 1,124,374
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
| 1,124,375
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
|
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
| 1,124,376
|
public void initialize() { SwingWorker thread = new SwingWorker() { public Object construct() { try { Thread.sleep(10000); populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } } catch (Exception e) { Log.error(e); return false; } return true; } public void finished() { Boolean transportExists = (Boolean)get(); if (!transportExists) { return; } // Register presences. registerPresences(); } }; thread.start(); }
|
public void initialize() { SwingWorker thread = new SwingWorker() { public Object construct() { try { populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } } catch (Exception e) { Log.error(e); return false; } return true; } public void finished() { Boolean transportExists = (Boolean)get(); if (!transportExists) { return; } // Register presences. registerPresences(); } }; thread.start(); }
| 1,124,378
|
public Object construct() { try { Thread.sleep(10000); populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } } catch (Exception e) { Log.error(e); return false; } return true; }
|
public Object construct() { try { populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } } catch (Exception e) { Log.error(e); return false; } return true; }
| 1,124,379
|
private void registerPresences() { SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.unavailable) { registered = false; } RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, 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(); boolean handle = handlePresence(contactItem, presence); if(handle){ contactGroup.fireContactGroupUpdated(); } } } }
|
private void registerPresences() { SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.unavailable) { registered = false; } RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, 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(); boolean handle = handlePresence(contactItem, presence); if(handle){ contactGroup.fireContactGroupUpdated(); } } } }
| 1,124,380
|
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_7: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
|
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_8: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
| 1,124,381
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.