Search in sources :

Example 1 with IconGroup

use of org.freeplane.features.icon.IconGroup in project freeplane by freeplane.

the class MIconController method insertSubmenus.

private void insertSubmenus(final JToolBar iconToolBar) {
    final JMenuBar iconMenuBar = new JMenuBar() {

        private static final long serialVersionUID = 1L;

        @Override
        public Dimension getMaximumSize() {
            final Dimension preferredSize = getPreferredSize();
            return new Dimension(Short.MAX_VALUE, preferredSize.height);
        }
    };
    iconMenuBar.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    iconMenuBar.setLayout(new GridLayout(0, 1));
    for (final IconGroup iconGroup : STORE.getGroups()) {
        iconMenuBar.add(getSubmenu(iconGroup));
    }
    iconToolBar.add(iconMenuBar);
}
Also used : GridLayout(java.awt.GridLayout) IconGroup(org.freeplane.features.icon.IconGroup) Dimension(java.awt.Dimension) JMenuBar(javax.swing.JMenuBar)

Example 2 with IconGroup

use of org.freeplane.features.icon.IconGroup 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));
    }
}
Also used : IconGroup(org.freeplane.features.icon.IconGroup) MindIcon(org.freeplane.features.icon.MindIcon) UIIcon(org.freeplane.features.icon.UIIcon)

Aggregations

IconGroup (org.freeplane.features.icon.IconGroup)2 Dimension (java.awt.Dimension)1 GridLayout (java.awt.GridLayout)1 JMenuBar (javax.swing.JMenuBar)1 MindIcon (org.freeplane.features.icon.MindIcon)1 UIIcon (org.freeplane.features.icon.UIIcon)1