当前位置: 首页>>代码示例>>Java>>正文


Java Spark.getSparkUserHome方法代码示例

本文整理汇总了Java中org.jivesoftware.Spark.getSparkUserHome方法的典型用法代码示例。如果您正苦于以下问题:Java Spark.getSparkUserHome方法的具体用法?Java Spark.getSparkUserHome怎么用?Java Spark.getSparkUserHome使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.Spark的用法示例。


在下文中一共展示了Spark.getSparkUserHome方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWorkgroupProperties

import org.jivesoftware.Spark; //导入方法依赖的package包/类
public Properties getWorkgroupProperties() {
    String workgroupName = StringUtils.parseName(FastpathPlugin.getWorkgroup().getWorkgroupJID());

    File workgroupDir = new File(Spark.getSparkUserHome(), "workgroups/" + workgroupName);
    workgroupDir.mkdirs();

    File propertiesFile = new File(workgroupDir, "workgroup.properties");
    Properties props = new Properties();
    try {
        props.load(new FileInputStream(propertiesFile));
    }
    catch (IOException e) {
        // File does not exist.
    }
    return props;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:17,代码来源:Workpane.java

示例2: sendImage

import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
 * Send an image to a user.
 *
 * @param image the image to send.
 * @param room  the ChatRoom of the user you wish to send the image to.
 */
public void sendImage(final BufferedImage image, final ChatRoom room) {
    File tmpDirectory = new File(Spark.getSparkUserHome(), "/tempImages");
    tmpDirectory.mkdirs();

    String imageName = "image_" + StringUtils.randomString(2) + ".png";
    final File imageFile = new File(tmpDirectory, imageName);

    // Write image to system.
    room.setCursor(new Cursor(Cursor.WAIT_CURSOR));

    SwingWorker writeImageThread = new SwingWorker() {
        public Object construct() {
            try {
                // Write out file in separate thread.
                ImageIO.write(image, "png", imageFile);
            }
            catch (IOException e) {
                Log.error(e);
            }
            return true;
        }

        public void finished() {
            ChatRoomImpl roomImpl = (ChatRoomImpl)room;
            sendFile(imageFile, roomImpl.getParticipantJID());
            SparkManager.getChatManager().getChatContainer().activateChatRoom(room);
            room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        }
    };
    writeImageThread.start();
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:38,代码来源:SparkTransferManager.java

示例3: getSettingsFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
    * Returns the file or creates it
    * 
    * @return
    */
   public static File getSettingsFile() {
File path = new File(Spark.getSparkUserHome());
if (!path.exists()) {
    path.mkdirs();
}
File f = new File(path, "color.settings");
if (!f.exists())
    try {
	f.createNewFile();
    } catch (IOException e) {
	Log.error("Error saving settings.", e);
    }
return f;
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:20,代码来源:ColorSettingManager.java

示例4: getUserDirectory

import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
 * Returns the User Directory to used by individual users. This allows for
 * Multi-User Support.
 *
 * @return the UserDirectory for Spark.
 */
public static File getUserDirectory() {
    final String bareJID = sessionManager.getBareAddress();
    File userDirectory = new File(Spark.getSparkUserHome(), "/user/" + bareJID);
    if (!userDirectory.exists()) {
        userDirectory.mkdirs();
    }
    return userDirectory;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:15,代码来源:SparkManager.java

示例5: getSettingsFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
 * Returns the settings file.
 *
 * @return the settings file.
 */
public static File getSettingsFile() {
    File file = new File(Spark.getSparkUserHome());
    if (!file.exists()) {
        file.mkdirs();
    }
    return new File(file, "layout.settings");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:13,代码来源:LayoutSettingsManager.java

示例6: getSettingsFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
 * Returns the settings file.
 *
 * @return the settings file.
 */
public static File getSettingsFile() {
    File file = new File(Spark.getSparkUserHome());
    if (!file.exists()) {
        file.mkdirs();
    }
    return new File(file, "spark.properties");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:13,代码来源:SettingsManager.java

示例7: getSoundSettingsFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
private File getSoundSettingsFile() {
    File file = new File(Spark.getSparkUserHome());
    if (!file.exists()) {
        file.mkdirs();
    }
    return new File(file, "sound-settings.xml");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:SoundPreference.java

示例8: getConfigFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
public File getConfigFile() {
	if (configFile == null)
		configFile = new File(Spark.getSparkUserHome(),
				"flashing.properties");

	return configFile;
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:FlashingPreferences.java

示例9: saveProperties

import org.jivesoftware.Spark; //导入方法依赖的package包/类
public void saveProperties(Properties props) {
    String workgroupName = StringUtils.parseName(FastpathPlugin.getWorkgroup().getWorkgroupJID());

    File propertiesFile = new File(new File(Spark.getSparkUserHome(), "workgroups/" + workgroupName), "workgroup.properties");

    try {
        props.store(new FileOutputStream(propertiesFile), "Workgroup Properties");
    }
    catch (IOException e) {
        Log.error("Unable to save group properties.", e);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:13,代码来源:Workpane.java

示例10: getPhonebookFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
private File getPhonebookFile() {
    File file = new File(Spark.getSparkUserHome());
    if (!file.exists()) {
        file.mkdirs();
    }
    return new File(file, "spark-phonebook.xml");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:PhonebookManager.java

示例11: getSipSettingsFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
private File getSipSettingsFile() {
    File file = new File(Spark.getSparkUserHome());
    if (!file.exists()) {
        file.mkdirs();
    }
    return new File(file, "sip-settings.xml");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:SipPreference.java

示例12: getHistoryFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
private File getHistoryFile() {
    File file = new File(Spark.getSparkUserHome());
    if (!file.exists()) {
        file.mkdirs();
    }
    return new File(file, "spark-phone-history.xml");
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:LogManagerImpl.java

示例13: getConfigFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
public File getConfigFile() {
if (configFile == null)
    configFile = new File(Spark.getSparkUserHome(),
	    "spellchecking.properties");

return configFile;
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:8,代码来源:SpellcheckerPreferences.java

示例14: saveTranscript

import org.jivesoftware.Spark; //导入方法依赖的package包/类
/**
 * Persist a current transcript.
 *
 * @param fileName   the name of the file to save the transcript as. Note: This can be modified by the user.
 * @param transcript the collection of transcript.
 * @param headerData the string to prepend to the transcript.
 * @see ChatRoom#getTranscripts()
 */
public void saveTranscript(String fileName, List<Message> transcript, String headerData) {
    final LocalPreferences pref = SettingsManager.getLocalPreferences();

    try {
        SimpleDateFormat formatter;

        File defaultSaveFile = new File(Spark.getSparkUserHome() + "/" + fileName);
        final JFileChooser fileChooser = new JFileChooser(defaultSaveFile);
        fileChooser.setSelectedFile(defaultSaveFile);

        // Show save dialog; this method does not return until the dialog is closed
        int result = fileChooser.showSaveDialog(this);
        final File selFile = fileChooser.getSelectedFile();

        if (selFile != null && result == JFileChooser.APPROVE_OPTION) {
            final StringBuffer buf = new StringBuffer();
            final Iterator<Message> transcripts = transcript.iterator();
            buf.append("<html><body>");
            if (headerData != null) {
                buf.append(headerData);
            }

            buf.append("<table width=600>");
            while (transcripts.hasNext()) {
                final Message message = transcripts.next();
                String from = message.getFrom();
                if (from == null) {
                    from = pref.getNickname();
                }

                if (Message.Type.groupchat == message.getType()) {
                    if (ModelUtil.hasLength(StringUtils.parseResource(from))) {
                        from = StringUtils.parseResource(from);
                    }
                }

                final String body = message.getBody();
                final Date insertionDate = (Date)message.getProperty("insertionDate");
                formatter = new SimpleDateFormat("hh:mm:ss");

                String value = "";
                if (insertionDate != null) {
                    value = "(" + formatter.format(insertionDate) + ") ";
                }
                buf.append("<tr><td nowrap><font size=2>").append(value).append("<strong>").append(from).append(":</strong>&nbsp;").append(body).append("</font></td></tr>");

            }
            buf.append("</table></body></html>");
            final BufferedWriter writer = new BufferedWriter(new FileWriter(selFile));
            writer.write(buf.toString());
            writer.close();
            JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Chat transcript has been saved.",
                    "Chat Transcript Saved", JOptionPane.INFORMATION_MESSAGE);
        }
    }
    catch (Exception ex) {
        Log.error("Unable to save chat transcript.", ex);
        JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Could not save transcript.", "Error", JOptionPane.ERROR_MESSAGE);
    }

}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:70,代码来源:TranscriptWindow.java

示例15: getConfigFile

import org.jivesoftware.Spark; //导入方法依赖的package包/类
private File getConfigFile() {
if (configFile == null)
    configFile = new File(Spark.getSparkUserHome(), "roar.properties");

return configFile;
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:7,代码来源:RoarProperties.java


注:本文中的org.jivesoftware.Spark.getSparkUserHome方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。