use of org.freeplane.features.icon.UIIcon in project freeplane by freeplane.
the class MainView method updateIcons.
void updateIcons(final NodeView node) {
// setHorizontalTextPosition(node.isLeft() ? SwingConstants.LEADING : SwingConstants.TRAILING);
final MultipleImage iconImages = new MultipleImage();
/* fc, 06.10.2003: images? */
final NodeModel model = node.getModel();
for (final UIIcon icon : IconController.getController().getStateIcons(model)) {
iconImages.addImage(icon.getIcon());
}
final ModeController modeController = getNodeView().getMap().getModeController();
final Collection<MindIcon> icons = IconController.getController(modeController).getIcons(model);
for (final MindIcon myIcon : icons) {
iconImages.addImage(myIcon.getIcon());
}
addOwnIcons(iconImages, model);
setIcon((iconImages.getImageCount() > 0 ? iconImages : null));
}
use of org.freeplane.features.icon.UIIcon in project freeplane by freeplane.
the class MainView method getUIIconAt.
public UIIcon getUIIconAt(Point coordinate) {
Icon icon = getIcon();
if (icon instanceof MultipleImage) {
Rectangle iconRectangle = getIconRectangle();
Point transformedToIconCoordinate = new Point(coordinate);
transformedToIconCoordinate.translate(-iconRectangle.x, -iconRectangle.y);
return ((MultipleImage) icon).getUIIconAt(transformedToIconCoordinate);
} else
return null;
}
use of org.freeplane.features.icon.UIIcon in project freeplane by freeplane.
the class ExportWithXSLT method copyIconsToDirectory.
/**
* @param map
*/
static void copyIconsToDirectory(final MapModel map, final String directoryName) {
final ListModel icons = map.getIconRegistry().getIconsAsListModel();
for (int i = 0; i < icons.getSize(); i++) {
final UIIcon icon = (UIIcon) icons.getElementAt(i);
final String iconName = icon.getName();
final StringBuilder sb = new StringBuilder(directoryName);
final int lastIndexOfSeparator = iconName.lastIndexOf('/');
if (lastIndexOfSeparator != -1) {
sb.append(File.separatorChar);
sb.append(iconName.substring(0, lastIndexOfSeparator));
}
final File destinationDirectory = new File(sb.toString());
destinationDirectory.mkdirs();
FileUtils.copyFromURL(icon.getUrl(), destinationDirectory);
}
}
use of org.freeplane.features.icon.UIIcon in project freeplane by freeplane.
the class DefaultConditionRenderer method getCellRendererComponent.
private Component getCellRendererComponent(final Object value, final boolean isSelected) {
final JComponent component;
if (value == null) {
component = new JLabel(noValueText);
} else if (value instanceof UIIcon) {
component = new JLabel(((UIIcon) value).getIcon());
} else if (value instanceof ASelectableCondition) {
final ASelectableCondition cond = (ASelectableCondition) value;
final String userName = cond.getUserName();
if (renderNamedConditions || userName == null)
component = cond.getListCellRendererComponent();
else {
component = new JLabel(userName);
component.setToolTipText(cond.createDescription());
}
} else
component = new JLabel(value.toString());
component.setOpaque(true);
component.setAlignmentX(Component.LEFT_ALIGNMENT);
return component;
}
use of org.freeplane.features.icon.UIIcon in project freeplane by freeplane.
the class IconStoreFactory method setIconGroups.
private static void setIconGroups(final IconStore iconStore) {
final String[] groupNames = RESOURCE_CONTROLLER.getProperty(GROUP_NAMES_KEY).split(SEPARATOR);
for (final String groupName : groupNames) {
final String description = TextUtils.getText(String.format(GROUP_DESC_KEY, groupName));
List<MindIcon> icons;
UIIcon groupIcon = null;
if ("user".equals(groupName)) {
icons = IconStoreFactory.getUserIcons();
groupIcon = MindIconFactory.create("user_icon");
} else {
final String groupIconName = RESOURCE_CONTROLLER.getProperty(String.format(GROUP_ICON_KEY, groupName));
final Map<String, MindIcon> iconMap = IconStoreFactory.getIcons(groupName);
groupIcon = iconMap.get(groupIconName);
icons = new ArrayList<MindIcon>(iconMap.values());
}
if (groupIcon == null) {
groupIcon = icons.size() > 0 ? icons.get(0) : IconNotFound.instance();
}
iconStore.addGroup(new IconGroup(groupName, groupIcon, description, icons));
}
}
Aggregations