Hello,
Two weeks ago Chris offered me to think about possible ways and
interfaces, how images could be embedded in the mind maps so that
copy-and-paste of them is possible. I have promised to work on some
suggestions until today. It is clear that such plans are not intended
for the coming release but for the time afterwards. Anyway I would like
to commit some thoughts about this challenging topic.
Generally I see two ways to insert images into the map. We can either
embed them into the maps. If we did so, the JLabels could not show them,
and there were a need in a new components to show them. I do not know
any free available HTML capable components which could be used for such
purpose. We could certainly use components for displaying only the
images without text. But I see another way which does not has such
difficulties.
I have already written that images available as resources can be
displayed by all HTML components used by the FreeMind:
I have found that all graphical components we use can draw images
directly from archive files created as java archives(jars). The magic
word is
<html><img src = "jar:file:javaarchive.jar!/content/images/image.gif">
So if the map were saved in the jar formatted file (with any
extension), all rendered images identified by HTML tag <img> could be
written into the same jar file and the sources given in the HTML
could be substituted by the new paths.
This brings me to the attached proposal.
Once it is implemented, the rest functionality can be added relatively easy.
Best regards, Dimitry
package freemind.main;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.io.Writer;
import java.net.URL;
import freemind.modes.MindMapNode;
/**
* managing of the map contents.
*
* @author Dimitry Polivaev
*
*/
public interface FreeMindArchive {
/**
* @param mmar - archive file or directory
* e.g. File("C:/MindMap.mmar") or File("C:/MindMap/")
* Every loaded archive is copied into a temporary directory
*/
void load(File mmar) throws IOException;
/**
* save loaded archive
*/
void save() throws IOException;
/**
* save loaded archive in a new file ( directory)
* @param newFile
*/
void saveAs(File newFile) throws IOException;
/**
* @return e.g. URL("jar:file:C:/MindMap.mmar!/content/")
*/
URL getBase();
/**
* returns URL for loading the map
* @return e.g. URL("jar:file:C:/MindMap.mmar!/content/map.mm")
*/
URL getMindMapURL();
/**
* @return a writer for saving of the mind map content in the archive
*/
Writer createMapWriter() throws IOException;
/**
* creates new image URL in the temporary archive using random number
generator
* @param img
* @return
*/
URL addImage(Image img);
/**
* Marks ULR internally as removed. It should not be saved when save or
saveAs is called
* @param imageURL : URL returned by addImage
*/
void deleteImage(URL imageURL);
/**
* Removes flag "deleted" set by call of deleteImage
* @param imageURL : URL returned by addImage
*/
void undeleteImage(URL imageURL);
}
/**
* Observes changes in the map, adds and removes images as nodes are changed,
inserted or removed.
* Therefore image counters should be maintained and actualized.
*
* @author Dimitry Polivaev
*
*/
interface FreemindArchiveController{
void setArchive(FreeMindArchive archive);
FreeMindArchive getArchive();
/**
* inserts all found images into the archive ,
* if the images paths do not point into the archive
* and marks them as deleted.
*
* @param html
* @return html with changed image paths
*/
String addImagesFromHtml(String html);
// Listener methods:
void nodeContentChanged(MindMapNode node, String oldContent);
void nodeRemoved(MindMapNode node);
void nodeInserted(MindMapNode node);
}-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freemind-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemind-developer