Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example Context Menu on OS X 10.9

IGB Context Menu

Context Menu Sections

Image Removed

Design

Interface

Code Block
themeMidnight
package org.lorainelab.igb.context.menu;
import java.util.Optional;
import org.lorainelab.igb.context.menu.model.AnnotationContextEvent;
import org.lorainelab.igb.context.menu.model.ContextMenuItem;

/**
 *
 * @author dcnorris
 */
public interface AnnotationContextMenuProvider {
    public Optional<ContextMenuItem> buildMenuItem(AnnotationContextEvent event);
    public MenuSection getMenuSection();
}

...

Code Block
themeMidnight
package org.lorainelab.igb.context.menu.model;
import com.google.common.io.BaseEncoding;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 *
 * @author dcnorris
 */
public class MenuIcon {
    private String encodedImage;
    private static final Logger logger = LoggerFactory.getLogger(MenuIcon.class);
    public MenuIcon(InputStream resourceAsStream) {
        try {
            encodedImage = BaseEncoding.base64().encode(IOUtils.toByteArray(resourceAsStream));
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        }
    }
    public byte[] getEncodedImage() {
        return BaseEncoding.base64().decode(encodedImage);
    }
}

MenuSection

Code Block
themeMidnight
package org.lorainelab.igb.context.menu;
/**
 *
 * @author dcnorris
 */
public enum MenuSection {
    INFORMATION, SEQUENCE, APP, UI_ACTION;
}

Context Menu Sections

Image Added