Example usage for java.awt.event ItemListener ItemListener

List of usage examples for java.awt.event ItemListener ItemListener

Introduction

In this page you can find the example usage for java.awt.event ItemListener ItemListener.

Prototype

ItemListener

Source Link

Usage

From source file:richtercloud.document.scanner.gui.ScannerEditDialog.java

private void init(final SaneDevice device, Map<SaneDevice, Map<SaneOption, Object>> changedOptions)
        throws IOException, SaneException {
    initComponents();/*from  w  ww  . ja  v a  2 s  .  c o m*/
    if (!device.isOpen()) {
        device.open();
    }
    Triple<String, Integer, String> defaultValuePair = configureDefaultOptionValues(device, changedOptions,
            false);
    for (String mode : device.getOption("mode").getStringConstraints()) {
        modeComboBoxModel.addElement(mode);
    }
    this.modeComboBox.setSelectedItem(defaultValuePair.getLeft());
    for (SaneWord resolution : device.getOption("resolution").getWordConstraints()) {
        resolutionComboBoxModel.addElement(String.valueOf(resolution.integerValue()));
    }
    this.resolutionComboBox.setSelectedItem(String.valueOf(defaultValuePair.getMiddle()));
    List<String> documentSourceConstraints = device.getOption("source").getStringConstraints();
    for (String documentSource : documentSourceConstraints) {
        this.documentSourceComboBoxModel.addElement(documentSource);
    }
    if (documentSourceConstraints.contains("Automatic Document Feeder")) {
        this.documentSourceComboBox.setSelectedItem("Automatic Document Feeder");
    }
    //add ItemListener after setup
    this.modeComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                String mode = (String) ScannerEditDialog.this.modeComboBox.getSelectedItem();
                ScannerEditDialog.this.device.getOption("mode").setStringValue(mode);
            } catch (IOException | SaneException ex) {
                //not supposed to happen
                throw new RuntimeException(ex);
            }
        }
    });
    this.resolutionComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                int resolution = Integer
                        .valueOf((String) ScannerEditDialog.this.resolutionComboBox.getSelectedItem());
                ScannerEditDialog.this.device.getOption("resolution").setIntegerValue(resolution);
            } catch (IOException | SaneException ex) {
                //not supposed to happen
                throw new RuntimeException(ex);
            }
        }
    });
    this.documentSourceComboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                String documentSource = (String) ScannerEditDialog.this.documentSourceComboBox
                        .getSelectedItem();
                ScannerEditDialog.this.device.getOption("source").setStringValue(documentSource);
            } catch (IOException | SaneException ex) {
                throw new RuntimeException(ex);
            }
        }
    });
}

From source file:com.diversityarrays.dal.server.SqlDialog.java

SqlDialog(JFrame owner, SqlDalDatabase db) {
    super(owner, "SQL", ModalityType.MODELESS);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    this.database = db;

    runner = new DefaultBackgroundRunner("SQL Command", this);
    setGlassPane(runner.getBlockingPane());

    sqlCommands.setFont(GuiUtil.createMonospacedFont(12));

    includeHeadingsInCopy.addItemListener(new ItemListener() {
        @Override//from w  ww .  j  a v a  2 s  .  c  o  m
        public void itemStateChanged(ItemEvent e) {
            boolean b = includeHeadingsInCopy.isSelected();
            for (int n = tabbedPane.getTabCount(); --n >= 0;) {
                Component c = tabbedPane.getComponentAt(n);
                if (c instanceof SqlResultsPanel) {
                    ((SqlResultsPanel) c).setIncludeHeadings(b);
                }
            }
        }
    });

    tabbedPane.addContainerListener(new ContainerListener() {
        @Override
        public void componentRemoved(ContainerEvent e) {
            updateClosePanelAction();
        }

        @Override
        public void componentAdded(ContainerEvent e) {
            updateClosePanelAction();
        }
    });
    updateClosePanelAction();

    Box buttons = Box.createHorizontalBox();
    buttons.add(Box.createHorizontalStrut(10));
    buttons.add(new JButton(runAction));
    buttons.add(Box.createHorizontalStrut(20));
    buttons.add(new JButton(closePanelAction));

    buttons.add(Box.createHorizontalGlue());
    buttons.add(includeHeadingsInCopy);
    buttons.add(Box.createHorizontalStrut(10));
    buttons.add(new JButton(helpAction));
    buttons.add(Box.createHorizontalStrut(10));

    JPanel top = new JPanel(new BorderLayout());
    top.add(BorderLayout.CENTER, new JScrollPane(sqlCommands));
    top.add(BorderLayout.SOUTH, buttons);

    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, top, tabbedPane);
    splitPane.setResizeWeight(0.25);

    setContentPane(splitPane);

    pack();

    setSize(800, 600);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            splitPane.setDividerLocation(0.25);
            removeWindowListener(this);
        }

    });
}

From source file:bigdata.explorer.nutch.grapview.tests.WebGraphTreeLayout.java

public WebGraphTreeLayout() throws IOException {

    // create a simple graph for the demo
    graph = new DelegateForest<String, Number>();

    createTree();//from www.j av a2s. co m

    treeLayout = new TreeLayout<String, Number>(graph);
    radialLayout = new RadialTreeLayout<String, Number>(graph);
    radialLayout.setSize(new Dimension(600, 600));
    vv = new VisualizationViewer<String, Number>(treeLayout, new Dimension(600, 600));
    vv.setBackground(Color.white);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    rings = new Rings();

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<String, Number> lt = new LayoutTransition<String, Number>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<String, Number> lt = new LayoutTransition<String, Number>(vv, radialLayout,
                        treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.removePreRenderPaintable(rings);
            }
            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    controls.add(modeBox);

    content.add(controls, BorderLayout.SOUTH);
}

From source file:net.sf.jclal.gui.view.components.chart.ExternalBasicChart.java

/**
 *
 * @param windowsTitleParam The title of the window.
 * @param chartTitleParam The title of the chart panel.
 * @param xTitleParam The X-axis label./*from w  ww. java2s.com*/
 */
public ExternalBasicChart(String windowsTitleParam, String chartTitleParam, String xTitleParam) {

    reportFrecuency = 1;

    menubar = new JMenuBar();
    menubar.add(createMenu());

    max = -1;

    windowsTitle = windowsTitleParam;
    chartTitle = chartTitleParam;
    xTitle = xTitleParam;

    queryNames = new ArrayList<String>();
    evaluationsCollection = new ArrayList<List<AbstractEvaluation>>();
    controlCurveColor = new HashMap<String, Color>();
    set = new HashSet<Integer>();
    setSeries = new HashSet<String>();
    colors = new ArrayList<Color>();

    chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(640, 480));
    chartPanel.setFillZoomRectangle(true);
    chartPanel.setMouseWheelEnabled(true);

    slider = new JSlider(JSlider.HORIZONTAL);
    slider.setPaintTicks(true);
    slider.setPaintLabels(true);
    slider.setToolTipText("Changes the report frecuency");
    slider.setSnapToTicks(true);
    slider.setMinimum(1);
    slider.setMinorTickSpacing(1);

    slider.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(javax.swing.event.ChangeEvent evt) {

            reportFrecuency = ((JSlider) evt.getSource()).getValue();

            slider.setToolTipText(String.valueOf(reportFrecuency));

            jComboBoxItemStateChanged();
        }
    });

    comboBox = new JComboBox<String>();

    comboBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent evt) {

            jComboBoxItemStateChanged();
        }
    });

    content = new JPanel(new BorderLayout());
    content.add(comboBox, BorderLayout.NORTH);
    content.add(chartPanel, BorderLayout.CENTER);
    content.add(slider, BorderLayout.SOUTH);

    setJMenuBar(menubar);
    setTitle(windowsTitle);
    setContentPane(this.content);
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

}

From source file:L2RTreeLayoutDemo.java

public L2RTreeLayoutDemo() {

    // create a simple graph for the demo
    graph = new DelegateForest<String, Integer>();

    createTree();/*from  ww w.  ja v  a  2 s  .c om*/

    treeLayout = new TreeLayout<String, Integer>(graph);
    radialLayout = new RadialTreeLayout<String, Integer>(graph);
    radialLayout.setSize(new Dimension(600, 600));
    vv = new VisualizationViewer<String, Integer>(treeLayout, new Dimension(600, 600));
    vv.setBackground(Color.white);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    rings = new Rings();

    setLtoR(vv);

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, radialLayout,
                        treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                setLtoR(vv);
                vv.removePreRenderPaintable(rings);
            }

            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    controls.add(modeBox);

    content.add(controls, BorderLayout.SOUTH);
}

From source file:by.bsuir.main.Graph.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public Graph() {/*w ww. j a v  a  2  s.  c o m*/

    // create a simple graph for the demo
    graph = new DelegateForest<String, Integer>();

    if (Edge.devEdges.size() > 0)
        ctreateTreeForDevices();
    else
        createTree();

    treeLayout = new TreeLayout<String, Integer>(graph);
    radialLayout = new RadialTreeLayout<String, Integer>(graph);
    radialLayout.setSize(new Dimension(500, 400));
    vv = new VisualizationViewer<String, Integer>(treeLayout, new Dimension(500, 400));
    vv.setBackground(Color.white);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    rings = new Rings();

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, radialLayout,
                        treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.removePreRenderPaintable(rings);
            }
            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    controls.add(modeBox);

    content.add(controls, BorderLayout.SOUTH);
}

From source file:ec.util.chart.swing.JTimeSeriesRendererSupportDemo.java

private Component createToolBar() {
    JToolBar result = new JToolBar();
    result.setFloatable(false);//from w w  w  .  j  av a 2 s . co  m

    result.add(RANDOM_DATA.toAction(chart)).setIcon(FontAwesome.FA_RANDOM.getIcon(getForeground(), 16f));

    JComboBox<RendererType> types = new JComboBox<>(
            support.getSupportedRendererTypes().toArray(new RendererType[0]));
    types.setMaximumSize(new Dimension(150, 100));
    types.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            RendererType type = (RendererType) e.getItem();
            chart.getXYPlot().setRenderer(support.createRenderer(type));
            chart.getXYPlot().setBackgroundPaint(support.getPlotColor());
            chart.setBackgroundPaint(colorSchemeSupport.getBackColor());
        }
    });
    types.setSelectedIndex(1);
    result.add(types);

    return result;
}

From source file:edu.uci.ics.jung.samples.L2RTreeLayoutDemo.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public L2RTreeLayoutDemo() {

    // create a simple graph for the demo
    graph = new DelegateForest<String, Integer>();

    createTree();//from   w  w  w  .  j a  v  a  2 s.  c om

    treeLayout = new TreeLayout<String, Integer>(graph);
    radialLayout = new RadialTreeLayout<String, Integer>(graph);
    radialLayout.setSize(new Dimension(600, 600));
    vv = new VisualizationViewer<String, Integer>(treeLayout, new Dimension(600, 600));
    vv.setBackground(Color.white);
    vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());
    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());
    vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray));
    rings = new Rings();

    setLtoR(vv);

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);

    JComboBox modeBox = graphMouse.getModeComboBox();
    modeBox.addItemListener(graphMouse.getModeListener());
    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JToggleButton radial = new JToggleButton("Radial");
    radial.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {

                LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, treeLayout,
                        radialLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                vv.addPreRenderPaintable(rings);
            } else {
                LayoutTransition<String, Integer> lt = new LayoutTransition<String, Integer>(vv, radialLayout,
                        treeLayout);
                Animator animator = new Animator(lt);
                animator.start();
                vv.getRenderContext().getMultiLayerTransformer().setToIdentity();
                setLtoR(vv);
                vv.removePreRenderPaintable(rings);
            }

            vv.repaint();
        }
    });

    JPanel scaleGrid = new JPanel(new GridLayout(1, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel controls = new JPanel();
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(radial);
    controls.add(scaleGrid);
    controls.add(modeBox);

    content.add(controls, BorderLayout.SOUTH);
}

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.PopupMenu.java

/**
 * Initializes the menu items with the given actions.
 *//*from  w w  w  .  j  a v  a 2s  . c  o m*/
private void initComponents() {
    IconManager icons = IconManager.getInstance();
    resetPassword = new JMenuItem(controller.getAction(DataBrowserControl.RESET_PASSWORD));
    ActivatedUserAction a = (ActivatedUserAction) controller.getAction(DataBrowserControl.USER_ACTIVATED);
    activatedUser = new JCheckBoxMenuItem();
    ImageDisplay node = model.getBrowser().getLastSelectedDisplay();
    boolean value = false;
    if (node != null) {
        Object o = node.getHierarchyObject();
        if (o instanceof ExperimenterData) {
            ExperimenterData exp = (ExperimenterData) o;
            ExperimenterData loggedIn = model.getCurrentUser();
            value = exp.getId() == loggedIn.getId();
            activatedUser.setSelected(exp.isActive());
            if (exp.isActive()) {
                activatedUser.setIcon(ActivatedUserAction.ACTIVATED_ICON);
            } else {
                activatedUser.setIcon(ActivatedUserAction.NOT_ACTIVATED_ICON);
            }
            activatedUser.setEnabled(!value && !model.isSystemUser(exp.getId()));
        }
        if (!value)
            activatedUser.addItemListener(new ItemListener() {

                public void itemStateChanged(ItemEvent e) {
                    controller.activateUser();
                }
            });
    } else
        activatedUser.setEnabled(false);
    activatedUser.setAction(a);
    tagElement = new JMenuItem(controller.getAction(DataBrowserControl.TAG));
    newExperimentElement = new JMenuItem(controller.getAction(DataBrowserControl.NEW_EXPERIMENT));

    view = new JMenuItem(controller.getAction(DataBrowserControl.VIEW));
    copyElement = new JMenuItem(controller.getAction(DataBrowserControl.COPY_OBJECT));
    cutElement = new JMenuItem(controller.getAction(DataBrowserControl.CUT_OBJECT));
    pasteElement = new JMenuItem(controller.getAction(DataBrowserControl.PASTE_OBJECT));
    removeElement = new JMenuItem(controller.getAction(DataBrowserControl.REMOVE_OBJECT));
    pasteRndSettings = new JMenuItem(controller.getAction(DataBrowserControl.PASTE_RND_SETTINGS));
    resetRndSettings = new JMenuItem(controller.getAction(DataBrowserControl.RESET_RND_SETTINGS));
    copyRndSettings = new JMenuItem(controller.getAction(DataBrowserControl.COPY_RND_SETTINGS));
    setMinMaxSettings = new JMenuItem(controller.getAction(DataBrowserControl.SET_MIN_MAX_SETTINGS));
    setOwnerRndSettings = new JMenuItem(controller.getAction(DataBrowserControl.SET_OWNER_RND_SETTINGS));
    openWithMenu = new JMenu("Open with");
    openWithMenu.setIcon(icons.getIcon(IconManager.VIEWER));
    if (model.getType() == DataBrowserModel.SEARCH) {
        copyElement.setEnabled(false);
        pasteElement.setEnabled(false);
        cutElement.setEnabled(false);
    }
}

From source file:se.streamsource.streamflow.client.ui.workspace.cases.general.forms.geo.GeoLocationFieldPanel.java

private JComboBox<MapType> createMapTypeSelector() {
    final JComboBox<MapType> mapTypeSelector = new JComboBox<MapType>(MapType.values());
    mapTypeSelector.addItemListener(new ItemListener() {
        @Override/* www. ja  v  a 2 s.  c  om*/
        public void itemStateChanged(ItemEvent e) {
            setMapType((MapType) mapTypeSelector.getSelectedItem());
        }
    });
    return mapTypeSelector;
}