JMenuItem heatItem = new JMenuItem("HeatMap"); heatItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { HeatMapManager manager = env.getHeatMapManager(); HeatMapUI ui = manager.getUI(); if(!ui.isShowing()) { tf.addToDesktop(ui,TopFrame.PALETTE_LAYER); ui.show(); ui.setClosable(true); ui.setIconifiable(true); ui.setResizable(false); ui.setMaximizable(false); } else { try { ui.setSelected(true); } catch(PropertyVetoException ex) {} } } }); tf.addToMenu(TopFrame.VIEW,heatItem); heatItem.setEnabled(true);
    public void setContext(Registry ctx)    {        this.registry = ctx;        this.eventBus = ctx.getEventBus();        this.tf = ctx.getTopFrame();                env.setIconManager(IconManager.getInstance(ctx));                Boolean extractionMode = (Boolean)registry.lookup(THUMBNAIL_MODE_KEY);        this.useServerThumbs = extractionMode.booleanValue();                Integer thumbWidth = (Integer)registry.lookup(THUMBNAIL_WIDTH_KEY);        Integer thumbHeight = (Integer)registry.lookup(THUMBNAIL_HEIGHT_KEY);                this.thumbnailWidth = 120;//thumbWidth.intValue();        this.thumbnailHeight = 120;//thumbHeight.intValue();                eventBus.register(this,LoadDataset.class);        eventBus.register(this,ImageAnnotated.class);                /*        JMenuItem testItem = new JMenuItem("Browser");        testItem.addActionListener(new ActionListener()        {            public void actionPerformed(ActionEvent ae)            {                Integer dummyID = (Integer)registry.lookup(DUMMY_DATASET_KEY);                loadDataset(dummyID.intValue());            }        });                tf.addToMenu(TopFrame.VIEW,testItem);        testItem.setEnabled(true);        */                JMenuItem heatItem = new JMenuItem("HeatMap");        heatItem.addActionListener(new ActionListener()        {            public void actionPerformed(ActionEvent ae)            {                HeatMapManager manager = env.getHeatMapManager();                HeatMapUI ui = manager.getUI();                if(!ui.isShowing())                {                    tf.addToDesktop(ui,TopFrame.PALETTE_LAYER);                    ui.show();                    ui.setClosable(true);                    ui.setIconifiable(true);                    ui.setResizable(false);                    ui.setMaximizable(false);                }                else                {                    try                    {                        ui.setSelected(true);                    }                    catch(PropertyVetoException ex) {}                }            }        });        tf.addToMenu(TopFrame.VIEW,heatItem);        heatItem.setEnabled(true);                // test code to check for image STs        SemanticTypesService sts = registry.getSemanticTypesService();        try        {            List typeList = sts.getAvailableImageTypes();            for(Iterator iter = typeList.iterator(); iter.hasNext();)            {                SemanticType st = (SemanticType)iter.next();                imageTypeList.add(st);            }        }        catch(DSOutOfServiceException dso)        {            dso.printStackTrace();            UserNotifier un = registry.getUserNotifier();            un.notifyError("Connection Error",dso.getMessage(),dso);        }        catch(DSAccessException dsa)        {            dsa.printStackTrace();            UserNotifier un = registry.getUserNotifier();            un.notifyError("Server Error",dsa.getMessage(),dsa);        }    }