Package nu.fw.jeti.plugins.buddyspacemaps.xml

Examples of nu.fw.jeti.plugins.buddyspacemaps.xml.MapTag


       
        String mapID = ((BSMapWindow)win).getMapID();
        String originID = ((BSMapWindow)win).getOriginID();
        String completeMapID = new String(originID + "/" + mapID);
        boolean dock = win.isDocked();
        MapTag map = mapBean.getMap(originID, mapID);
       
        closeWindow(win);
        BSMapEditWindow newWin = new BSMapEditWindow(this, completeMapID, mapImage,
                                map, mapID, originID, mapPath,dock);
       // newWin.setPresenceBean(presenceBean);
View Full Code Here


        // for all extensions
        while (extensions.hasNext()) {
            Extension ext = (Extension) extensions.next();
            // if map extension
            if (ext instanceof MapTag) {
                MapTag map = (MapTag) ext;
               // logMap(map);
                // adds map into temporary hashtable
                curMaps.add(map);
                JID jid = msg.getFrom();
                String completeID = new String(jid.getUser() + "@" +
                                               jid.getDomain() + "/" + map.getID());
                maps.put(completeID, map);
            }
        }
       
        // if that was not map message ends
        if (curMaps.isEmpty())
            return;
       
        // if it was map message, looks for included map images
        extensions = msg.getExtensions();
        while (extensions.hasNext()) {
            Extension ext = (Extension) extensions.next();
            // for all included files
            if (ext instanceof IQXOOB) {
              IQXOOB oob = (IQXOOB) ext;
                JID jid = msg.getFrom();
                try {
                    handleMapOOB(oob, jid);
                } catch (IOException e) {}
            }
        }
       
        // for all just received maps
        Enumeration mapEnum = curMaps.elements();
        while (mapEnum.hasMoreElements()) {
            JID jid = msg.getFrom();
            String originID = new String(jid.getUser() + "@" + jid.getDomain());
            MapTag map = (MapTag) mapEnum.nextElement();
            // add references to referenced maps
            processMap(map, originID);
            // saves map into local cache
            saveMap(map, originID);
            fireMapReceived(map, originID);
View Full Code Here

        if (mapID == null || originID == null || newMapID == null)
            return false;
       
        // gets the map tag
        String completeID = new String(originID + "/" + mapID);
        MapTag map = (MapTag) maps.get(completeID);
        if (map == null) return false;
       
        // gets the filename and creates path for it
        String newCompleteID = new String(newOriginID + "/" + newMapID);
        String filename = new String(mapPath + "/" + newCompleteID);
        File parentFile = new File(filename).getAbsoluteFile().getParentFile();
        if (parentFile != null)
            parentFile.mkdirs();
       
        // sets new ID and origin and re-inserts the map under the new IDs
        map.setID(newMapID);
        maps.remove(completeID);
        maps.put(newCompleteID, map);
       
        try {
            XMLFileIO.saveTag(map, filename);
View Full Code Here

            LayerTag layer = (LayerTag) layers.nextElement();
            String src = layer.getSrc();
           
            // loads all referenced maps
            if (src != null) {
                MapTag refdMap = (MapTag) maps.get(src);
               
                // if map not in memory
                if (refdMap == null) {
                    refdMap = loadMapTag(src, originID);
                }
View Full Code Here

                                      String originID, boolean mainMap) {
                                         
        String completeMapPath = new String(mapPath + "/" + originID);
        String completeID = new String(originID + "/" + mapID);
       
        MapTag map = (MapTag) maps.get(completeID);
        if (map == null) return false;
               
        // first goes through the mapTag and looks for map images
        // all images are uploaded and OOB is added
        Enumeration layers = map.layers();
        while (layers.hasMoreElements()) {
            LayerTag l = (LayerTag) layers.nextElement();
            ImgTag img = l.getImg();
            if (img != null) {
                File imgFile = new File(completeMapPath + "/" + img.getSrc());
                String urlStr = new String("http://" + fileServer + ":" +
                                fileServerPort + fileServerPath + "/" + img.getSrc());
                URL url;
                try {
                    url = new URL(urlStr);
                    URLFileTransfer.uploadURL(imgFile, url, proxy, proxyPort);
                    msgBuilder.addExtension(new IQXOOB(url,img.getSrc()));
                } catch (MalformedURLException e) {
                    break;
                } catch (IOException e) {
                    break;
                }
            }
            MapTag insetMap = l.getSrcMap();
            if (insetMap != null && recursiveMapsSend) {
                addMapIntoMessage(msgBuilder, insetMap.getID(), originID, false);
            }
        }
       
        msgBuilder.addExtension(map);
       
View Full Code Here

                if (!FileCopier.copyFile(new File(sourcePath + "/" + img.getSrc()),
                                         new File(destPath + "/" + img.getSrc())))
                    return false;
            }
            // for nested maps
            MapTag insetMap = l.getSrcMap();
            if (insetMap != null) {
                // copies map files
                if (!FileCopier.copyFile(new File(sourcePath + "/" + insetMap.getID()),
                                         new File(destPath + "/" + insetMap.getID())))
                    return false;
                // and all necessary files referenced
                if (!copyFilesForMap(insetMap, sourceOriginID, destOriginID))
                    return false;
            }
View Full Code Here

        return true;
    }
   
    /** Loads map */
    public void loadMap(String mapID, String originID) {
        MapTag newMap = loadMapTag(mapID, originID);
        if (newMap == null) return;
        // pridat do hashtable
        String completeID = originID + "/" + mapID;
        maps.put(completeID, newMap);
        processMap(newMap, originID);
View Full Code Here

        fireMapReceived(newMap, originID);
    }
   
    /** Load map tag from disk */
    private MapTag loadMapTag(String mapID, String originID) {
        MapTag result = loadMapImpl(mapID,  originID);
        if (result == null)
            JOptionPane.showMessageDialog(null, "Cannot load map " + mapID,
                                      "Error", JOptionPane.ERROR_MESSAGE);
        return result;
    }
View Full Code Here

   
    /** Returns <code>MapTag</code> either from cache or loaded from disk */
    public MapTag getMap(String originID, String mapID) {
        String completeID = new String(originID + "/" + mapID);
       
        MapTag map = (MapTag) maps.get(completeID);
        if (map != null) return map;
       
        map = loadMapImpl(mapID, originID);
        if (map != null) processMap(map, originID);
        return map;
View Full Code Here

                return;
            }
           
            // reads the inserted map
            String mapOrigin = mapFile.getParentFile().getName();
            MapTag newMap = ((BSMapWinManager)winMan).getMap(mapOrigin, mapName);
            if (newMap == null) {
                JOptionPane.showMessageDialog(docked? mainFrame : frame,
                    "Specified file is not valid map",
                    "Add map error",
                    JOptionPane.ERROR_MESSAGE);
View Full Code Here

TOP

Related Classes of nu.fw.jeti.plugins.buddyspacemaps.xml.MapTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.