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


Java Spark类代码示例

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


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

示例1: ChatAreaSendField

import org.jivesoftware.Spark; //导入依赖的package包/类
/**
 * Creates a new IconTextField with Icon.
 *
 * @param text the text to use on the button.
 */
public ChatAreaSendField(String text) {
    setLayout(new GridBagLayout());
    setBackground((Color)UIManager.get("TextPane.background"));
    textField = new ChatInputEditor();
    textField.setBorder(null);
    setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.lightGray));
    button = new JButton();
    
    if (Spark.isMac()) {
        button.setContentAreaFilled(false);
    }

    ResourceUtils.resButton(button, text);

    add(button, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(2, 2, 2, 2), 0, 0));

    button.setVisible(false);
    
    final JScrollPane pane = new JScrollPane(textField);
    pane.setBorder(null);
    add(pane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0));
    button.setEnabled(false);
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:29,代码来源:ChatAreaSendField.java

示例2: pickFile

import org.jivesoftware.Spark; //导入依赖的package包/类
private void pickFile(String title, JTextField field) {
    if (fc == null) {
        fc = new JFileChooser();
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        if (Spark.isWindows()) {
            fc.setFileSystemView(new WindowsFileSystemView());
        }
    }
    fc.setDialogTitle(title);
    int returnVal = fc.showOpenDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        field.setText(file.getAbsolutePath());
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:17,代码来源:FileTransferPreferencePanel.java

示例3: blinkFrameIfNecessary

import org.jivesoftware.Spark; //导入依赖的package包/类
public void blinkFrameIfNecessary(final JFrame frame) {

        final MainWindow mainWindow = SparkManager.getMainWindow();

        if (mainWindow.isFocusOwner()) {
            frame.setVisible(true);
        }
        else {
            // Set to new tab.
            if (Spark.isWindows()) {
                frame.setState(Frame.ICONIFIED);
                SparkManager.getNativeManager().flashWindow(frame);

                frame.setVisible(true);
                frame.addWindowListener(new WindowAdapter() {
                    public void windowActivated(WindowEvent e) {
                        SparkManager.getNativeManager().stopFlashing(frame);
                    }
                });
            }
        }
    }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:23,代码来源:ChatContainer.java

示例4: PluginManager

import org.jivesoftware.Spark; //导入依赖的package包/类
private PluginManager() {
    try {
        PLUGINS_DIRECTORY = new File(Spark.getBinDirectory().getParentFile(), "plugins").getCanonicalFile();
    }
    catch (IOException e) {
        Log.error(e);
    }

    // Do not use deployable plugins if not installed.
    if (System.getProperty("plugin") == null) {
        movePlugins();
    }


    // Create the extension directory if one does not exist.
    if (!PLUGINS_DIRECTORY.exists()) {
        PLUGINS_DIRECTORY.mkdirs();
    }

    _blacklistPlugins = Default.getPluginBlacklist();
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:22,代码来源:PluginManager.java

示例5: EmoticonManager

import org.jivesoftware.Spark; //导入依赖的package包/类
/**
 * Initialize the EmoticonManager
 */
private EmoticonManager() {
	EMOTICON_DIRECTORY = new File(Spark.getBinDirectory().getParent(),
			"xtra/emoticons").getAbsoluteFile();

	File[] files = null;
	files = EMOTICON_DIRECTORY.listFiles();

	// If files in this directory, copy this files into the Spark User Home
	// Directory
	if (files != null) {
		// Copy over to allow for non-admins to extract.
		copyFiles();

		final LocalPreferences pref = SettingsManager.getLocalPreferences();
		String emoticonPack = pref.getEmoticonPack();

		try {
			addEmoticonPack(emoticonPack);
		} catch (Exception e) {
			Log.error(e);
		}
	}
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:27,代码来源:EmoticonManager.java

示例6: getChildElementXML

import org.jivesoftware.Spark; //导入依赖的package包/类
public String getChildElementXML() {
    StringBuffer buf = new StringBuffer();
    buf.append("<query xmlns=\"jabber:iq:spark\">");

    // Add os specific information

    if (Spark.isWindows()) {
        buf.append("<os>windows</os>");
    }
    else if (Spark.isMac()) {
        buf.append("<os>mac</os>");
    }
    else {
        buf.append("<os>linux</os>");
    }

    buf.append("</query>");
    return buf.toString();
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:20,代码来源:SparkVersion.java

示例7: newBuildAvailable

import org.jivesoftware.Spark; //导入依赖的package包/类
public SparkVersion newBuildAvailable() {
    if (!sparkPluginInstalled && !Spark.disableUpdatesOnCustom()) {
        // Handle Jivesoftware.org update
        return isNewBuildAvailableFromJivesoftware();
    }
    else if (sparkPluginInstalled) {
        try {
            SparkVersion serverVersion = getLatestVersion(SparkManager.getConnection());
            if (isGreater(serverVersion.getVersion(), JiveInfo.getVersion())) {
                return serverVersion;
            }
        }
        catch (XMPPException e) {
            // Nothing to do
        }

    }

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

示例8: getDownloadDir

import org.jivesoftware.Spark; //导入依赖的package包/类
/**
 * Returns the Download Directory, doesnt return <code>null</code>
 * @return {@link String}
 */
public String getDownloadDir() {

	File downloadedDir = null;
	if (Spark.isLinux() || Spark.isMac()) {
		downloadedDir = new File(System.getProperty("user.home") + "/Downloads/");
           Log.error(downloadedDir.getAbsolutePath());
	} else if (Spark.isWindows()) {

		String regpath = WinRegistryReader.getMyDocumentsFromWinRegistry();
		if (regpath != null) {
			downloadedDir = new File(regpath + "\\Downloads");
			if (!downloadedDir.exists()) {
				downloadedDir.mkdir();
			}
		}
		else
		{
		    // if for some Reason there is no "My Documents" Folder we should select the Desktop
			downloadedDir = new File(System.getProperty("user.home") + "\\Desktop\\");
		}
	}

	return props.getProperty("downloadDirectory", downloadedDir.getAbsolutePath());
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:29,代码来源:LocalPreferences.java

示例9: pickFile

import org.jivesoftware.Spark; //导入依赖的package包/类
private void pickFile(String title, JTextField field) {
    if (fc == null) {
        fc = new JFileChooser();
        if (Spark.isWindows()) {
            fc.setFileSystemView(new WindowsFileSystemView());
        }
    }
    fc.setDialogTitle(title);
    int returnVal = fc.showOpenDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        try {
            field.setText(file.getCanonicalPath());
        }
        catch (IOException e) {
            Log.error(e);
        }
    }
    else {

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

示例10: changePresence

import org.jivesoftware.Spark; //导入依赖的package包/类
/**
 * Change the presence of the tray.
 *
 * @param presence the new presence.
 */
public void changePresence(Presence presence) {
    if (Spark.isMac()) {
        return;
    }

    if (presence.getMode() == Presence.Mode.available || presence.getMode() == Presence.Mode.chat) {
        setTrayIcon(availableIcon);
    }
    else if (presence.getMode() == Presence.Mode.away || presence.getMode() == Presence.Mode.xa) {
        setTrayIcon(awayIcon);
    }
    else {
        setTrayIcon(dndIcon);
    }

    // Get Status Text
    if (presence.isAvailable()) {
        String status = presence.getStatus();
        trayIcon.setToolTip(Default.getString(Default.APPLICATION_NAME) + "\n" + status);
    }
}
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:27,代码来源:SparkSystemTray.java

示例11: 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

示例12: 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

示例13: 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

示例14: CommandPanel

import org.jivesoftware.Spark; //导入依赖的package包/类
public CommandPanel(boolean doLayout) {
if (doLayout) {
	if (Spark.isWindows()) {
		setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
	}
	else {
		setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
	}

     setOpaque(false);
     
      // backgroundImage = Default.getImageIcon(Default.TOP_BOTTOM_BACKGROUND_IMAGE).getImage();
}
    //   setBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, new Color(197, 213, 230)));
   }
 
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:16,代码来源:CommandPanel.java

示例15: 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


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