Example usage for java.awt Component getName

List of usage examples for java.awt Component getName

Introduction

In this page you can find the example usage for java.awt Component getName.

Prototype

public String getName() 

Source Link

Document

Gets the name of the component.

Usage

From source file:it.unibas.spicygui.controllo.mapping.ActionExportTranslatedInstancesSQL.java

private WizardDescriptor.Panel[] getPanels() {
    panels = new WizardDescriptor.Panel[] { new ExportDBWizardPanel() };
    String[] steps = new String[panels.length];
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        // Default step name to component name of panel. Mainly useful
        // for getting the name of the target chooser to appear in the
        // list of steps.
        steps[i] = c.getName();
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            // Sets step number of a component
            jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
            // Sets steps names for a panel
            jc.putClientProperty("WizardPanel_contentData", steps);
            // Turn on subtitle creation on each step
            jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
            // Show steps on the left side with the image on the background
            jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
            // Turn on numbering of all steps
            jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
        }//  w w  w.  j av a2 s  .c  o  m
    }
    return panels;
}

From source file:com.gdc.nms.web.mibquery.wizard.ciscavate.cjwizard.WizardPage.java

/**
 * Invoked immediately prior to rendering the wizard page on screen.
 * //from  w  w  w .j a  v  a  2  s.c o  m
 * This provides an opportunity to adjust the next/finish buttons and
 * customize the ui based on feedback.
 */
public void rendering(List<WizardPage> path, WizardSettings settings) {
    for (Component c : _namedComponents) {
        setValue(c, settings.get(c.getName()));
    }
}

From source file:es.emergya.ui.base.plugins.PluggableJTabbedPane.java

/**
 * Separa una pestaa en un nuevo jframe con el ttulo pasado como
 * parmetro./*w ww. j ava  2 s. com*/
 * 
 * @param index
 *            el indice de la pestaa.
 * @param title
 *            El ttulo de la ventana.
 * @return Un {@link DetachedTab} que representa la pestaa en un
 *         {@link JFrame}
 * @throws IndexOutOfBoundsException
 *             Si el indice de la pestaa no existe
 */
public DetachedTab detach(int index, String title) {
    log.trace("Detaching " + title);
    String tip = getToolTipTextAt(index);
    Icon icon = getIconAt(index);
    Component tab = getComponentAt(index);
    if (lastDetachablePane == null)
        lastDetachablePane = new DetachedTab(this, title, tip, index, tab, icon);
    else {
        lastDetachablePane.addTab(tab.getName(), icon, tab);
        detached_tabs.add(lastDetachablePane);
    }
    return lastDetachablePane;
}

From source file:it.unibas.spicygui.vista.listener.MyMouseEventListener.java

public void mousePressed(MouseEvent e) {
    e.consume();/*from   w  w  w  .  j av a 2s .c  o m*/
    Component comS = SwingUtilities.getDeepestComponentAt(pannelloPrincipale, e.getX(), e.getY());
    if ((comS instanceof JScrollBar || !((comS instanceof JPanel) || (comS instanceof JTree)))
            && comS != null) {
        if (tmp12 == null) {
            tmp12 = comS;
        }

    }
    if (!(Costanti.INTERMEDIE.equals(comS.getName()))) {
        dispacciaEvento(null, e, e.getPoint(), false);
    }
    jLayeredPane.moveToFront(component);
    component.updateUI();
}

From source file:org.alex73.skarynka.scan.ui.book.BooksController.java

public BooksController() {
    try {/*  ww  w.  j  a v a  2 s. c o m*/
        panel = new BooksPanel();
        ((AbstractDocument) panel.txtNewName.getDocument()).setDocumentFilter(bookNameFilter);

        listScanDirs();

        panel.table.setModel(model());
        panel.table.setRowSelectionAllowed(true);
        panel.table.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
                    BookRow b = books.get(panel.table.getSelectedRow());
                    DataStorage.openBook(b.bookName, true);
                }
            }

            @Override
            public void mousePressed(MouseEvent e) {
                if (SwingUtilities.isRightMouseButton(e)) {
                    for (int i = 0; i < panel.menuProcess.getComponentCount(); i++) {
                        Component item = panel.menuProcess.getComponent(i);
                        if ((item instanceof JMenuItem) && (item.getName() != null)) {
                            panel.menuProcess.remove(i);
                            i--;
                        }
                    }
                    if (Context.getPermissions().BookControl) {
                        for (int scale : new int[] { 25, 50, 75, 100, 200 }) {
                            JMenuItem item = new JMenuItem(scale + "%");
                            item.setName(scale + "%");
                            item.addActionListener(new ChangeScale(scale));
                            panel.menuProcess.add(item);
                        }
                    }

                    currentBooksNames.clear();
                    int[] selected = panel.table.getSelectedRows();
                    boolean allLocals = true;
                    boolean processAllowed = Context.getPermissions().BookControl;
                    for (int row : selected) {
                        BookRow b = books.get(panel.table.convertRowIndexToModel(row));
                        currentBooksNames.add(b.bookName);
                        if (!b.local) {
                            allLocals = false;
                        }
                    }
                    panel.itemFinish.setVisible(allLocals);
                    if (processAllowed) {
                        for (Map.Entry<String, String> en : Context.getProcessCommands().entrySet()) {
                            JMenuItem item = new JMenuItem(en.getValue());
                            item.setName(en.getKey());
                            item.addActionListener(commandListener);
                            panel.menuProcess.add(item);
                        }
                    }
                    panel.menuProcess.show(panel.table, e.getX(), e.getY());
                }
            }
        });

        panel.btnCreate.setEnabled(false);
        panel.btnCreate.addActionListener(
                new ActionErrorListener(panel, "ERROR_BOOK_CREATE", LOG, "Error create book") {
                    protected void action(ActionEvent e) throws Exception {
                        File bookDir = new File(Context.getBookDir(), panel.txtNewName.getText());
                        if (bookDir.exists()) {
                            JOptionPane.showMessageDialog(panel,
                                    Messages.getString("PANEL_BOOK_NEW_BOOK_EXIST"),
                                    Messages.getString("PANEL_BOOK_TITLE"), JOptionPane.WARNING_MESSAGE);
                            return;
                        }

                        DataStorage.openBook(panel.txtNewName.getText(), true);
                    }
                });

        setMenuListeners();
    } catch (Throwable ex) {
        LOG.error("Error list books", ex);
        JOptionPane.showMessageDialog(DataStorage.mainFrame,
                "Error: " + ex.getClass() + " / " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:it.unibas.spicygui.controllo.file.ActionNewMappingTask.java

/**
 * Initialize panels representing individual wizard's steps and sets
 * various properties for them influencing wizard appearance.
 *//*  w  ww .  j a v  a2 s. co  m*/
private WizardDescriptor.Panel[] getPanels() {
    //        if (panels == null) {
    panels = new WizardDescriptor.Panel[] { new NewMappingTaskWizardPanel1(),
            new NewMappingTaskWizardPanel2() };
    String[] steps = new String[panels.length];
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        // Default step name to component name of panel. Mainly useful
        // for getting the name of the target chooser to appear in the
        // list of steps.
        steps[i] = c.getName();
        if (c instanceof JComponent) { // assume Swing components
            JComponent jc = (JComponent) c;
            // Sets step number of a component
            jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
            // Sets steps names for a panel
            jc.putClientProperty("WizardPanel_contentData", steps);
            // Turn on subtitle creation on each step
            jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
            // Show steps on the left side with the image on the background
            jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
            // Turn on numbering of all steps
            jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
        }

    }
    //        }
    return panels;
}

From source file:org.freeplane.main.application.MapViewDockingWindows.java

private void viewSelectionChanged(final Component mapView) {
    if (!mPaneSelectionUpdate) {
        return;//from  w ww  . j  a v a2 s . c o m
    }
    Controller controller = Controller.getCurrentController();
    if (mapView != controller.getMapViewManager().getMapViewComponent()) {
        controller.getMapViewManager().changeToMapView(mapView.getName());
    }
}

From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrProjectWizardIterator.java

@Override
public void initialize(WizardDescriptor wiz) {
    this.wiz = wiz;
    wiz.putProperty("NewProjectWizard_Title",
            NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_WizardTitle")); //NOI18N
    index = 0;/*from w w w  .  j a  v  a  2s.c om*/
    // set other defaults
    this.wiz.putProperty(WIZ_USE_SB_MVN_PLUGIN, true);
    this.wiz.putProperty(WIZ_REMOVE_MVN_WRAPPER, true);
    // create the wizard panels
    panels = new WizardDescriptor.Panel[] { new InitializrProjectWizardPanel1(),
            new InitializrProjectWizardPanel2(), new InitializrProjectWizardPanel3() };
    // Make sure list of steps is accurate.
    String[] steps = new String[] {
            NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_BasePropsStep"),
            NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_DependenciesStep"),
            NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_CreateProjectStep") };
    // create wizard steps gui components
    for (int i = 0; i < panels.length; i++) {
        Component c = panels[i].getComponent();
        if (steps[i] == null) {
            // Default step name to component name of panel.
            // Mainly useful for getting the name of the target
            // chooser to appear in the list of steps.
            steps[i] = c.getName();
        }
        if (c instanceof JComponent) {
            // assume Swing components
            JComponent jc = (JComponent) c;
            // Step #.
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
            // Step name (actually the whole list for reference).
            jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
        }
    }
    // schedule async retrieval of initializr metadata in panel visual 1
    Utilities.attachInitJob(panels[0].getComponent(), (AsyncGUIJob) panels[0].getComponent());
}

From source file:org.spiderplan.tools.visulization.GraphFrame.java

@Override
public void actionPerformed(ActionEvent ae) {
    Component source = (Component) ae.getSource();

    if (source.getName().equals("SwitchMode")) {
        if (this.mode == Mode.Transformation) {
            switchMode.setText("Transformation");
            this.mode = Mode.Picking;
            graphMouse.setMode(ModalGraphMouse.Mode.PICKING);
        } else {//w  ww  .  j a va  2  s.c  o  m
            switchMode.setText("Picking");
            this.mode = Mode.Transformation;
            graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
        }
    } else if (source.getName().equals("Dump")) {
        this.writeJPEGImage("screenshot.png", "png");
    } else if (source.getName().equals("Subgraph")) {

        PickedState<V> selection = vv.getPickedVertexState();

        if (selection.getPicked().size() > 0) {
            int depth = Integer.valueOf(subGraphDepth.getText()).intValue();

            GraphTools<V, E> cG = new GraphTools<V, E>();

            Vector<V> connected = new Vector<V>();
            connected.addAll(selection.getPicked());
            Vector<V> checked = new Vector<V>();

            for (int i = 0; i < depth; i++) {
                Vector<V> addList = new Vector<V>();
                for (V v1 : connected) {
                    if (!checked.contains(v1)) {
                        checked.add(v1);
                        for (V v2 : g.getNeighbors(v1)) {
                            if (!connected.contains(v2)) {
                                addList.add(v2);
                            }
                        }
                    }
                }
                for (V v : addList) {
                    connected.add(v);
                }
            }

            AbstractTypedGraph<V, E> subGraph;
            if (this.defaultEdgeType == EdgeType.UNDIRECTED) {
                subGraph = cG.copyUndirSparseMultiGraph(g);
            } else {
                subGraph = cG.copyDirSparseMultiGraph(g);
            }

            Vector<V> removeList = new Vector<V>();
            for (V v : subGraph.getVertices()) {
                if (!connected.contains(v)) {
                    removeList.add(v);
                }
            }
            for (V v : removeList) {
                subGraph.removeVertex(v);
            }
            new GraphFrame<V, E>(subGraph, null, "Sub Graph " + subGraphCounter, this.layoutClass,
                    this.edgeLabels);

            subGraphCounter++;
        }
    } else if (source.getName().equals("SelectLayout")) {
        @SuppressWarnings("rawtypes")
        JComboBox box = (JComboBox) source;

        String selection = box.getSelectedItem().toString();

        if (selection.equals("FR")) {
            this.setLayout(LayoutClass.FR);
        } else if (selection.equals("FR2")) {
            this.setLayout(LayoutClass.FR2);
        } else if (selection.equals("Static")) {
            this.setLayout(LayoutClass.Static);
        } else if (selection.equals("Circle")) {
            this.setLayout(LayoutClass.Circle);
        } else if (selection.equals("DAG")) {
            this.setLayout(LayoutClass.DAG);
        } else if (selection.equals("Spring")) {
            this.setLayout(LayoutClass.Spring);
        } else if (selection.equals("Spring2")) {
            this.setLayout(LayoutClass.Spring2);
        } else if (selection.equals("ISOM")) {
            this.setLayout(LayoutClass.ISOM);
        } else if (selection.equals("PolarPoint")) {
            this.setLayout(LayoutClass.PolarPoint);
        } else if (selection.equals("KK")) {
            this.setLayout(LayoutClass.KK);
        }

        Dimension d = vv.getSize();//new Dimension(600,600);
        layout.setSize(d);

        try {
            Relaxer relaxer = new VisRunner((IterativeContext) layout);
            relaxer.stop();
            relaxer.prerelax();
        } catch (java.lang.ClassCastException e) {
        }

        StaticLayout<V, E> staticLayout = new StaticLayout<V, E>(g, layout);
        LayoutTransition<V, E> lt = new LayoutTransition<V, E>(vv, vv.getGraphLayout(), staticLayout);
        Animator animator = new Animator(lt);
        animator.start();
        vv.repaint();
    }
}

From source file:com.view.TradeWindow.java

private void TraderSelectAllBlocksActionPerformed(java.awt.event.ActionEvent evt) {

    for (JPanel j : cPanelList) {
        Component[] c = j.getComponents();
        for (Component singleC : c) {
            if (singleC.getName() == null) {
                continue;
            } else if (singleC.getName().equals("splitOpt")) {
                JPanel p = (JPanel) singleC;
                if (!TraderSelectAllBlocks.isSelected()) {
                    ((JCheckBox) p.getComponent(1)).setSelected(false);
                    int n = Integer.parseInt(((JCheckBox) p.getComponent(1)).getName());
                    PopulateBlocks(n);//from  w  w w  .  j av  a  2  s .  c o  m
                } else {
                    if (!((JCheckBox) p.getComponent(1)).isSelected()) {
                        ((JCheckBox) p.getComponent(1)).setSelected(true);
                        int n = Integer.parseInt(((JCheckBox) p.getComponent(1)).getName());
                        PopulateBlocks(n);
                    }
                }
            }

        }
    }
}