List of usage examples for javax.swing DefaultComboBoxModel addElement
public void addElement(E anObject)
From source file:net.sf.jasperreports.swing.JRViewerToolbar.java
private void initComponents() { btnSave = new javax.swing.JButton(); btnPrint = new javax.swing.JButton(); btnReload = new javax.swing.JButton(); pnlSep01 = new javax.swing.JPanel(); btnFirst = new javax.swing.JButton(); btnPrevious = new javax.swing.JButton(); btnNext = new javax.swing.JButton(); btnLast = new javax.swing.JButton(); txtGoTo = new javax.swing.JTextField(); pnlSep02 = new javax.swing.JPanel(); btnActualSize = new javax.swing.JToggleButton(); btnFitPage = new javax.swing.JToggleButton(); btnFitWidth = new javax.swing.JToggleButton(); pnlSep03 = new javax.swing.JPanel(); btnZoomIn = new javax.swing.JButton(); btnZoomOut = new javax.swing.JButton(); cmbZoom = new javax.swing.JComboBox(); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (int i = 0; i < zooms.length; i++) { model.addElement("" + zooms[i] + "%"); }//from w ww . j a v a 2s.com cmbZoom.setModel(model); setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 2)); btnSave.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/save.GIF"))); btnSave.setToolTipText(viewerContext.getBundleString("save")); btnSave.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnSave.setMaximumSize(new java.awt.Dimension(23, 23)); btnSave.setMinimumSize(new java.awt.Dimension(23, 23)); btnSave.setPreferredSize(new java.awt.Dimension(23, 23)); btnSave.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnSaveActionPerformed(evt); } }); add(btnSave); btnPrint.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/print.GIF"))); btnPrint.setToolTipText(viewerContext.getBundleString("print")); btnPrint.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrint.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrint.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrint.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrint.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnPrintActionPerformed(evt); } }); add(btnPrint); btnReload.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/reload.GIF"))); btnReload.setToolTipText(viewerContext.getBundleString("reload")); btnReload.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnReload.setMaximumSize(new java.awt.Dimension(23, 23)); btnReload.setMinimumSize(new java.awt.Dimension(23, 23)); btnReload.setPreferredSize(new java.awt.Dimension(23, 23)); btnReload.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnReloadActionPerformed(evt); } }); add(btnReload); pnlSep01.setMaximumSize(new java.awt.Dimension(10, 10)); add(pnlSep01); btnFirst.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/first.GIF"))); btnFirst.setToolTipText(viewerContext.getBundleString("first.page")); btnFirst.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFirst.setMaximumSize(new java.awt.Dimension(23, 23)); btnFirst.setMinimumSize(new java.awt.Dimension(23, 23)); btnFirst.setPreferredSize(new java.awt.Dimension(23, 23)); btnFirst.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnFirstActionPerformed(evt); } }); add(btnFirst); btnPrevious.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/previous.GIF"))); btnPrevious.setToolTipText(viewerContext.getBundleString("previous.page")); btnPrevious.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnPrevious.setMaximumSize(new java.awt.Dimension(23, 23)); btnPrevious.setMinimumSize(new java.awt.Dimension(23, 23)); btnPrevious.setPreferredSize(new java.awt.Dimension(23, 23)); btnPrevious.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnPreviousActionPerformed(evt); } }); add(btnPrevious); btnNext.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/next.GIF"))); btnNext.setToolTipText(viewerContext.getBundleString("next.page")); btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnNext.setMaximumSize(new java.awt.Dimension(23, 23)); btnNext.setMinimumSize(new java.awt.Dimension(23, 23)); btnNext.setPreferredSize(new java.awt.Dimension(23, 23)); btnNext.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnNextActionPerformed(evt); } }); add(btnNext); btnLast.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/last.GIF"))); btnLast.setToolTipText(viewerContext.getBundleString("last.page")); btnLast.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnLast.setMaximumSize(new java.awt.Dimension(23, 23)); btnLast.setMinimumSize(new java.awt.Dimension(23, 23)); btnLast.setPreferredSize(new java.awt.Dimension(23, 23)); btnLast.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnLastActionPerformed(evt); } }); add(btnLast); txtGoTo.setToolTipText(viewerContext.getBundleString("go.to.page")); txtGoTo.setMaximumSize(new java.awt.Dimension(40, 23)); txtGoTo.setMinimumSize(new java.awt.Dimension(40, 23)); txtGoTo.setPreferredSize(new java.awt.Dimension(40, 23)); txtGoTo.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { txtGoToActionPerformed(evt); } }); add(txtGoTo); pnlSep02.setMaximumSize(new java.awt.Dimension(10, 10)); add(pnlSep02); btnActualSize.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF"))); btnActualSize.setToolTipText(viewerContext.getBundleString("actual.size")); btnActualSize.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnActualSize.setMaximumSize(new java.awt.Dimension(23, 23)); btnActualSize.setMinimumSize(new java.awt.Dimension(23, 23)); btnActualSize.setPreferredSize(new java.awt.Dimension(23, 23)); btnActualSize.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnActualSizeActionPerformed(evt); } }); add(btnActualSize); btnFitPage.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF"))); btnFitPage.setToolTipText(viewerContext.getBundleString("fit.page")); btnFitPage.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitPage.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitPage.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitPage.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitPage.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitPageActionPerformed(evt); } }); add(btnFitPage); btnFitWidth.setIcon(new javax.swing.ImageIcon( getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF"))); btnFitWidth.setToolTipText(viewerContext.getBundleString("fit.width")); btnFitWidth.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnFitWidth.setMaximumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setMinimumSize(new java.awt.Dimension(23, 23)); btnFitWidth.setPreferredSize(new java.awt.Dimension(23, 23)); btnFitWidth.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnFitWidthActionPerformed(evt); } }); add(btnFitWidth); pnlSep03.setMaximumSize(new java.awt.Dimension(10, 10)); add(pnlSep03); btnZoomIn.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomin.GIF"))); btnZoomIn.setToolTipText(viewerContext.getBundleString("zoom.in")); btnZoomIn.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomIn.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomIn.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomIn.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomInActionPerformed(evt); } }); add(btnZoomIn); btnZoomOut.setIcon( new javax.swing.ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/zoomout.GIF"))); btnZoomOut.setToolTipText(viewerContext.getBundleString("zoom.out")); btnZoomOut.setMargin(new java.awt.Insets(2, 2, 2, 2)); btnZoomOut.setMaximumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setMinimumSize(new java.awt.Dimension(23, 23)); btnZoomOut.setPreferredSize(new java.awt.Dimension(23, 23)); btnZoomOut.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { btnZoomOutActionPerformed(evt); } }); add(btnZoomOut); cmbZoom.setEditable(true); cmbZoom.setToolTipText(viewerContext.getBundleString("zoom.ratio")); cmbZoom.setMaximumSize(new java.awt.Dimension(80, 23)); cmbZoom.setMinimumSize(new java.awt.Dimension(80, 23)); cmbZoom.setPreferredSize(new java.awt.Dimension(80, 23)); cmbZoom.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { cmbZoomActionPerformed(evt); } }); cmbZoom.addItemListener(new java.awt.event.ItemListener() { @Override public void itemStateChanged(java.awt.event.ItemEvent evt) { cmbZoomItemStateChanged(evt); } }); add(cmbZoom); }
From source file:com.xue777hua.emails.frames.EmailCrawlerJFrame.java
/** * Creates new form EmailCrawlerJFrame//from ww w . j a v a 2s. c o m */ public EmailCrawlerJFrame() { initComponents(); DefaultComboBoxModel year1Model = new DefaultComboBoxModel(); DefaultComboBoxModel year2Model = new DefaultComboBoxModel(); int currentYear = Calendar.getInstance().get(Calendar.YEAR); for (int i = currentYear; i >= 1823; i--) { year1Model.addElement(String.valueOf(i)); } year1Model.setSelectedItem(String.valueOf(currentYear - 10)); year2Model.addElement("Present"); for (int i = currentYear - 1; i >= 1823; i--) { year2Model.addElement(String.valueOf(i)); } fromDate.setModel(year1Model); toDate.setModel(year2Model); }
From source file:com.qspin.qtaste.ui.ConfigInfoPanel.java
public void init() { setLayout(new GridBagLayout()); GridBagLineAdder adder = new GridBagLineAdder(this); adder.setWeight(1.0f, 0.0f);/*from ww w . j a v a2 s. c o m*/ adder.setLength(6); //1st column - 1st row adder.setWeight(0.0, 0.0); adder.add(new JLabel("Test suite:")); adder.setWeight(1.0, 0.0); adder.add(mTestSuiteLabel); adder.setWeight(0.0, 0.0); //2d column - 1st row adder.add(new JLabel("Testbed config:")); // set the combobox as read only (not possible to modify the testbed from GUI at this time UIManager.put("ComboBox.disabledForeground", Color.BLACK); mTestbedList.setEnabled(true); adder.add(mTestbedList); // add testbed mouse listener, for the "Edit File" action TestbedMouseListener testbedMouseListener = new TestbedMouseListener(); java.awt.Component[] mTestbedListComponents = mTestbedList.getComponents(); for (int i = 0; i < mTestbedListComponents.length; i++) { mTestbedListComponents[i].addMouseListener(testbedMouseListener); } // go to second row adder.addSeparator(); //1st column - 2d row adder.add(new JLabel("Test results directory:")); adder.add(mTestResultsLabel); //2d column - 2d row m_ignoreControlScript.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { TestEngine.setIgnoreControlScript(ignoreControlScript()); setControlTestbedButtonsEnabled(); GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); guiConfiguration.setProperty(StaticConfiguration.IGNORE_CONTROL_SCRIPT_PROPERTY, m_ignoreControlScript.isSelected()); try { guiConfiguration.save(); } catch (ConfigurationException ex) { logger.error("Error while saving GUI configuration: " + ex.getMessage()); } } }); adder.add(m_ignoreControlScript); JPanel sutPanel = new JPanel(); JLabel sutVersion = new JLabel("SUT version: "); sutPanel.add(sutVersion); m_SUTVersion.setHorizontalAlignment(JTextField.RIGHT); m_SUTVersion.setPreferredSize(new Dimension(150, m_SUTVersion.getPreferredSize().height)); sutPanel.add(m_SUTVersion); adder.add(sutPanel); m_SUTVersion.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { TestBedConfiguration.setSUTVersion(m_SUTVersion.getText()); } }); //create a 3d row adder.addSeparator(); //1st column - 3d row adder.add(new JLabel("Reporting Format:")); adder.add(mTestReportingFormat); //2d column - 3d row // add a button to manually start the testbed m_startTestbed.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { isStartingOrStoppingTestbed = true; setControlTestbedButtonsEnabled(); parent.getTestCasePanel().setStopButtonEnabled(true, true); parent.getTestCasePanel().showTestcaseResultsTab(); TestBedConfiguration.setSUTVersion(getSUTVersion()); new SUTStartStopThread("start").start(); } }); m_startTestbed.setEnabled(false); adder.add(m_startTestbed); // add a button to manually stop the testbed m_stopTestbed.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { isStartingOrStoppingTestbed = true; setControlTestbedButtonsEnabled(); parent.getTestCasePanel().showTestcaseResultsTab(); TestBedConfiguration.setSUTVersion(getSUTVersion()); new SUTStartStopThread("stop").start(); } }); m_stopTestbed.setEnabled(false); adder.add(m_stopTestbed); DefaultComboBoxModel model = (DefaultComboBoxModel) mTestbedList.getModel(); model.removeAllElements(); String testbedDir = testbedConfig.getFile().getParent(); File fTestbedDir = new File(testbedDir); FileMask fileMask = new FileMask(); fileMask.addExtension("xml"); File[] fTestbedList = FileUtilities.listSortedFiles(fTestbedDir, fileMask); for (int i = 0; i < fTestbedList.length; i++) { // remove the extension String testbedName = fTestbedList[i].getName().substring(0, fTestbedList[i].getName().lastIndexOf('.')); model.addElement(testbedName); } mTestbedList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (mTestbedList.getSelectedItem() != null) { String selectedTestbed = (String) mTestbedList.getSelectedItem(); String configFile = StaticConfiguration.TESTBED_CONFIG_DIRECTORY + "/" + selectedTestbed + "." + StaticConfiguration.TESTBED_CONFIG_FILE_EXTENSION; TestBedConfiguration.setConfigFile(configFile); GUIConfiguration guiConfiguration = GUIConfiguration.getInstance(); guiConfiguration.setProperty(StaticConfiguration.LAST_SELECTED_TESTBED_PROPERTY, selectedTestbed); try { guiConfiguration.save(); } catch (ConfigurationException ex) { logger.error("Error while saving GUI configuration: " + ex.getMessage()); } } refreshData(); } }); refreshTestBed(); refreshData(); if (GUIConfiguration.getInstance().getBoolean(StaticConfiguration.IGNORE_CONTROL_SCRIPT_PROPERTY, false)) m_ignoreControlScript.doClick(); TestBedConfiguration .registerConfigurationChangeHandler(new TestBedConfiguration.ConfigurationChangeHandler() { public void onConfigurationChange() { testbedConfig = TestBedConfiguration.getInstance(); String configFileName = testbedConfig.getFile().getName(); mTestbedList.getModel() .setSelectedItem(configFileName.substring(0, configFileName.lastIndexOf('.'))); } }); }
From source file:de.tor.tribes.ui.views.DSWorkbenchDoItYourselfAttackPlaner.java
@Override public void resetView() { AttackManager.getSingleton().addManagerListener(this); //setup renderer and general view // ((DoItYourselfAttackTableModel) jAttackTable.getModel()).clear(); HighlightPredicate.ColumnHighlightPredicate colu = new HighlightPredicate.ColumnHighlightPredicate(0, 1, 2, 3, 6);/*from w w w . j a v a 2 s. co m*/ jAttackTable.setRowHeight(24); jAttackTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); jAttackTable.setHighlighters(new CompoundHighlighter(colu, HighlighterFactory.createAlternateStriping(Constants.DS_ROW_A, Constants.DS_ROW_B))); jAttackTable.setColumnControlVisible(true); jAttackTable.setDefaultEditor(UnitHolder.class, new UnitCellEditor()); jAttackTable.setDefaultEditor(Village.class, new VillageCellEditor()); jAttackTable.setDefaultRenderer(UnitHolder.class, new UnitCellRenderer()); jAttackTable.setDefaultRenderer(Integer.class, new NoteIconCellRenderer(NoteIconCellRenderer.ICON_TYPE.NOTE)); jAttackTable.setDefaultRenderer(Date.class, new ColoredDateCellRenderer()); jAttackTable.setDefaultRenderer(Long.class, new ColoredCoutdownCellRenderer()); jAttackTable.setDefaultEditor(Date.class, new DateSpinEditor()); jAttackTable.setDefaultEditor(Integer.class, new NoteIconCellEditor(NoteIconCellEditor.ICON_TYPE.NOTE)); BufferedImage back = ImageUtils.createCompatibleBufferedImage(5, 5, BufferedImage.BITMASK); Graphics2D g = back.createGraphics(); GeneralPath p = new GeneralPath(); p.moveTo(0, 0); p.lineTo(5, 0); p.lineTo(5, 5); p.closePath(); g.setColor(Color.GREEN.darker()); g.fill(p); g.dispose(); jAttackTable.addHighlighter(new PainterHighlighter(HighlightPredicate.EDITABLE, new ImagePainter(back, HorizontalAlignment.RIGHT, VerticalAlignment.TOP))); DefaultComboBoxModel model = new DefaultComboBoxModel(); DefaultComboBoxModel model2 = new DefaultComboBoxModel(); for (UnitHolder unit : DataHolder.getSingleton().getUnits()) { model.addElement(unit); model2.addElement(unit); } jUnitBox.setModel(model); jUnitComboBox.setModel(model2); jUnitBox.setSelectedItem(DataHolder.getSingleton().getUnitByPlainName("ram")); jUnitComboBox.setSelectedItem(DataHolder.getSingleton().getUnitByPlainName("ram")); jUnitBox.setRenderer(new UnitListCellRenderer()); jAttackTypeComboBox.setRenderer(new StandardAttackListCellRenderer()); DefaultComboBoxModel typeModel = new DefaultComboBoxModel(); for (ManageableType t : StandardAttackManager.getSingleton().getAllElements()) { StandardAttack a = (StandardAttack) t; typeModel.addElement(a); } jAttackTypeComboBox.setModel(typeModel); jUnitComboBox.setRenderer(new UnitListCellRenderer()); jSourceVillage.setValue(new Point(500, 500)); jTargetVillage.setValue(new Point(500, 500)); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jSourceVillage.updateUI(); jTargetVillage.updateUI(); } }); }
From source file:com.declarativa.interprolog.gui.Ini2.java
private void graphComponents() throws IOException { Forest<String, Integer> forest = new DelegateForest<>(); ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); Layout layout = new BalloonLayout(forest); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene = new SceneImpl(g, layout); jLayeredPane1.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); JToolBar bar = new JToolBar(); bar.setMargin(new Insets(5, 5, 5, 5)); bar.setLayout(new FlowLayout(5)); DefaultComboBoxModel<Layout> mdl = new DefaultComboBoxModel<>(); mdl.addElement(new KKLayout(g)); mdl.addElement(layout);//from w w w . j a va 2 s . c o m mdl.addElement(new BalloonLayout(forest)); mdl.addElement(new RadialTreeLayout(forest)); mdl.addElement(new CircleLayout(g)); mdl.addElement(new FRLayout(g)); mdl.addElement(new FRLayout2(g)); mdl.addElement(new ISOMLayout(g)); mdl.addElement(new SpringLayout(g)); mdl.addElement(new SpringLayout2(g)); mdl.addElement(new DAGLayout(g)); mdl.addElement(new XLayout(g)); mdl.setSelectedItem(layout); final JCheckBox checkbox = new JCheckBox("Animate iterative layouts"); scene.setLayoutAnimationFramesPerSecond(48); final JComboBox<Layout> layouts = new JComboBox(mdl); layouts.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); bar.add(new JLabel(" Layout Type")); bar.add(layouts); layouts.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Layout layout = (Layout) layouts.getSelectedItem(); // These two layouts implement IterativeContext, but they do // not evolve toward anything, they just randomly rearrange // themselves. So disable animation for these. if (layout instanceof ISOMLayout || layout instanceof DAGLayout) { checkbox.setSelected(false); } scene.setGraphLayout(layout, true); } }); bar.add(new JLabel(" Connection Shape")); DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>(); shapes.addElement(new EdgeShape.QuadCurve<String, Number>()); shapes.addElement(new EdgeShape.BentLine<String, Number>()); shapes.addElement(new EdgeShape.CubicCurve<String, Number>()); shapes.addElement(new EdgeShape.Line<String, Number>()); shapes.addElement(new EdgeShape.Box<String, Number>()); shapes.addElement(new EdgeShape.Orthogonal<String, Number>()); shapes.addElement(new EdgeShape.Wedge<String, Number>(10)); final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>( shapes); shapesBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox .getSelectedItem(); scene.setConnectionEdgeShape(xform); } }); shapesBox.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>()); bar.add(shapesBox); //jf.add(bar, BorderLayout.NORTH); bar.add(new MinSizePanel(scene.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene.getLookup()); Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class); LookupListener listener = new LookupListener() { @Override public void resultChanged(LookupEvent le) { System.out.println("RES CHANGED"); Lookup.Result<String> res = (Lookup.Result<String>) le.getSource(); StringBuilder sb = new StringBuilder("<html>"); List<String> l = new ArrayList<>(res.allInstances()); Collections.sort(l); for (String s : l) { if (sb.length() != 0) { sb.append(", "); } sb.append(s); } sb.append("</html>"); selectionLabel.setText(sb.toString()); System.out.println("LOOKUP EVENT " + sb); } }; selectedNodes.addLookupListener(listener); selectedNodes.allInstances(); bar.add(selectionLabel); checkbox.setSelected(true); checkbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { scene.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane3.setLayout(new BorderLayout()); jLayeredPane3.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene.relayout(true); scene.validate(); } }); }
From source file:com.declarativa.interprolog.gui.Ini3.java
private void graphComponents() throws IOException { Forest<String, Integer> forest = new DelegateForest<>(); ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); Layout layout = new BalloonLayout(forest); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene = new SceneImpl(g, layout); jLayeredPane1.setLayout(new BorderLayout()); //jf.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); //jf.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); JToolBar bar = new JToolBar(); bar.setMargin(new Insets(5, 5, 5, 5)); bar.setLayout(new FlowLayout(5)); DefaultComboBoxModel<Layout> mdl = new DefaultComboBoxModel<>(); mdl.addElement(new KKLayout(g)); mdl.addElement(layout);//from ww w . j av a 2 s . c o m mdl.addElement(new BalloonLayout(forest)); mdl.addElement(new RadialTreeLayout(forest)); mdl.addElement(new CircleLayout(g)); mdl.addElement(new FRLayout(g)); mdl.addElement(new FRLayout2(g)); mdl.addElement(new ISOMLayout(g)); mdl.addElement(new SpringLayout(g)); mdl.addElement(new SpringLayout2(g)); mdl.addElement(new DAGLayout(g)); mdl.addElement(new XLayout(g)); mdl.setSelectedItem(layout); final JCheckBox checkbox = new JCheckBox("Animate iterative layouts"); scene.setLayoutAnimationFramesPerSecond(48); final JComboBox<Layout> layouts = new JComboBox(mdl); layouts.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); bar.add(new JLabel(" Layout Type")); bar.add(layouts); layouts.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Layout layout = (Layout) layouts.getSelectedItem(); // These two layouts implement IterativeContext, but they do // not evolve toward anything, they just randomly rearrange // themselves. So disable animation for these. if (layout instanceof ISOMLayout || layout instanceof DAGLayout) { checkbox.setSelected(false); } scene.setGraphLayout(layout, true); } }); bar.add(new JLabel(" Connection Shape")); DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>(); shapes.addElement(new EdgeShape.QuadCurve<String, Number>()); shapes.addElement(new EdgeShape.BentLine<String, Number>()); shapes.addElement(new EdgeShape.CubicCurve<String, Number>()); shapes.addElement(new EdgeShape.Line<String, Number>()); shapes.addElement(new EdgeShape.Box<String, Number>()); shapes.addElement(new EdgeShape.Orthogonal<String, Number>()); shapes.addElement(new EdgeShape.Wedge<String, Number>(10)); final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>( shapes); shapesBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox .getSelectedItem(); scene.setConnectionEdgeShape(xform); } }); shapesBox.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>()); bar.add(shapesBox); //jf.add(bar, BorderLayout.NORTH); bar.add(new MinSizePanel(scene.createSatelliteView())); bar.setFloatable(false); bar.setRollover(true); final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene.getLookup()); Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class); LookupListener listener = new LookupListener() { @Override public void resultChanged(LookupEvent le) { System.out.println("RES CHANGED"); Lookup.Result<String> res = (Lookup.Result<String>) le.getSource(); StringBuilder sb = new StringBuilder("<html>"); List<String> l = new ArrayList<>(res.allInstances()); Collections.sort(l); for (String s : l) { if (sb.length() != 0) { sb.append(", "); } sb.append(s); } sb.append("</html>"); selectionLabel.setText(sb.toString()); System.out.println("LOOKUP EVENT " + sb); } }; selectedNodes.addLookupListener(listener); selectedNodes.allInstances(); bar.add(selectionLabel); checkbox.setSelected(true); checkbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { scene.setAnimateIterativeLayouts(checkbox.isSelected()); } }); bar.add(checkbox); jLayeredPane3.setLayout(new BorderLayout()); jLayeredPane3.add(bar); // jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); // jf.setSize(new Dimension(1280, 720)); // jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene.relayout(true); scene.validate(); } }); }
From source file:gdt.jgui.entity.query.JQueryPanel.java
private void initItemNameFieldSelector() { DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>(); model.addElement("name"); model.addElement("type"); itemNameFieldComboBox.setModel(model); }
From source file:edu.ku.brc.specify.utilapps.sp5utils.Sp5Forms.java
/** * /*from w ww . j a v a 2 s .c o m*/ */ protected void formSelected() { selectedForm = forms.get(formsTable.getSelectedRow()); // Missing Fields List DefaultListModel model = (DefaultListModel) missingFieldsList.getModel(); model.clear(); for (FormFieldInfo fi : selectedForm.getFields()) { if (fi.getSp6FieldName() == null) { model.addElement(fi.getSp5FieldName()); } } DefaultComboBoxModel cbxModel = (DefaultComboBoxModel) ((JComboBox) sp6FieldEditor.getComponent()) .getModel(); cbxModel.removeAllElements(); cbxModel.addElement(""); // Setup Sp6 Fields DBTableInfo tblInfo = selectedForm.getTblInfo(); if (tblInfo != null) { for (DBFieldInfo fldInfo : tblInfo.getFields()) { if (StringUtils.isNotEmpty(fldInfo.getColumn())) { cbxModel.addElement(fldInfo.getColumn()); } } for (DBRelationshipInfo relInfo : tblInfo.getRelationships()) { if (StringUtils.isNotEmpty(relInfo.getColName())) { cbxModel.addElement(relInfo.getColName()); } } } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { fieldsTableModel.setSelectedForm(selectedForm); fieldsTableModel.fireTableDataChanged(); } }); }
From source file:org.pentaho.reporting.designer.extensions.legacycharts.LegacyChartEditModel.java
private void populateExpressionSelectorModel(final DefaultComboBoxModel model, final Class resultType) { model.removeAllElements();//from w ww. jav a 2s . co m if (resultType == null) { model.setSelectedItem(null); return; } final ExpressionMetaData[] allExpressionMetaDatas = ExpressionRegistry.getInstance() .getAllExpressionMetaDatas(); Arrays.sort(allExpressionMetaDatas, new GroupedMetaDataComparator()); for (int i = 0; i < allExpressionMetaDatas.length; i++) { final ExpressionMetaData data = allExpressionMetaDatas[i]; if (data.isHidden()) { continue; } if (!WorkspaceSettings.getInstance().isVisible(data)) { continue; } if (StructureFunction.class.isAssignableFrom(data.getExpressionType())) { continue; } if (resultType.isAssignableFrom(data.getResultType())) { model.addElement(data); } } model.setSelectedItem(null); }
From source file:gtu._work.ui.ExportSVNModificationFilesUI.java
private void initGUI() { try {// w ww.jav a2s . co m final SwingActionUtil swingUtil = SwingActionUtil.newInstance(this); BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("SVN BACKUP"); this.setPreferredSize(new java.awt.Dimension(734, 442)); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { swingUtil.invokeAction("jTabbedPane1_changeEvent", evt); } }); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("src text", null, jPanel1, null); { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { srcArea = new JTextArea(); jScrollPane1.setViewportView(srcArea); } } { loadSrcTextarea = new JButton(); jPanel1.add(loadSrcTextarea, BorderLayout.SOUTH); loadSrcTextarea.setText("load src textarea"); loadSrcTextarea.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("loadSrcTextarea.actionPerformed", evt); } }); } { srcBaseDir = new JButton(); jPanel1.add(srcBaseDir, BorderLayout.NORTH); srcBaseDir.setText("set src base dir"); srcBaseDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("srcBaseDir.actionPerformed", evt); } }); } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("src list", null, jPanel2, null); { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(531, 317)); { ListModel srcListModel = new DefaultListModel(); srcList = new JList(); jScrollPane2.setViewportView(srcList); srcList.setModel(srcListModel); srcList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("srcList.mouseClicked", evt); } }); srcList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("srcList.keyPressed", evt); } }); } } { srcListQuery = new JTextField(); srcListQuery.getDocument() .addDocumentListener(JCommonUtil.getDocumentListener(new HandleDocumentEvent() { public void process(DocumentEvent event) { String scan = JCommonUtil.getDocumentText(event); DefaultListModel model = new DefaultListModel(); Pattern pat = Pattern.compile(scan); for (LineParser line : copySrcListForQuerySet) { if (!line.file.exists()) { continue; } if (line.file.getAbsolutePath().contains(scan)) { model.addElement(line); continue; } try { if (pat.matcher(line.file.getAbsolutePath()).find()) { model.addElement(line); continue; } } catch (Exception ex) { } } srcList.setModel(model); } })); jPanel2.add(srcListQuery, BorderLayout.NORTH); } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("out list", null, jPanel3, null); { jScrollPane3 = new JScrollPane(); jPanel3.add(jScrollPane3, BorderLayout.CENTER); { ListModel outPutListModel = new DefaultListModel(); outPutList = new JList(); jScrollPane3.setViewportView(outPutList); outPutList.setModel(outPutListModel); outPutList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("outPutList.mouseClicked", evt); } }); outPutList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { swingUtil.invokeAction("outPutList.keyPressed", evt); } }); } } { outPutDir = new JButton(); jPanel3.add(outPutDir, BorderLayout.NORTH); outPutDir.setText("set output dir"); outPutDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("outPutDir.actionPerformed", evt); } }); } { execute = new JButton(); jPanel3.add(execute, BorderLayout.SOUTH); execute.setText("execute backup"); execute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("execute.actionPerformed", evt); } }); } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("compre", null, jPanel4, null); { jScrollPane4 = new JScrollPane(); jPanel4.add(jScrollPane4, BorderLayout.CENTER); jScrollPane4.setPreferredSize(new java.awt.Dimension(713, 339)); { TableModel compareTableModel = new DefaultTableModel(); compareTable = new JTable(); jScrollPane4.setViewportView(compareTable); compareTable.setModel(compareTableModel); JTableUtil.defaultSetting(compareTable); compareTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { swingUtil.invokeAction("compareTable.mouseClicked", evt); } }); } } { jPanel5 = new JPanel(); jPanel4.add(jPanel5, BorderLayout.NORTH); jPanel5.setPreferredSize(new java.awt.Dimension(713, 42)); { openExternalSrcFolder = new JButton(); jPanel5.add(openExternalSrcFolder); openExternalSrcFolder.setText("open external src folder"); openExternalSrcFolder.setPreferredSize(new java.awt.Dimension(280, 29)); openExternalSrcFolder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("openExternalSrcFolder.actionPerformed", evt); } }); } { startCompareMatch = new JButton(); jPanel5.add(startCompareMatch); startCompareMatch.setText("start compare source"); startCompareMatch.setPreferredSize(new java.awt.Dimension(280, 29)); startCompareMatch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { swingUtil.invokeAction("startCompareMatch.actionPerformed", evt); } }); } } } { jPanel6 = new JPanel(); GroupLayout jPanel6Layout = new GroupLayout((JComponent) jPanel6); jPanel6.setLayout(jPanel6Layout); jTabbedPane1.addTab("configuration", null, jPanel6, null); { DefaultComboBoxModel exportModeComboModel = new DefaultComboBoxModel(); for (ParseMode mode : ParseMode.values()) { exportModeComboModel.addElement(mode); } exportModeCombo = new JComboBox(); exportModeCombo.setModel(exportModeComboModel); } jPanel6Layout.setHorizontalGroup(jPanel6Layout .createSequentialGroup().addContainerGap(41, 41).addComponent(exportModeCombo, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE) .addContainerGap(505, Short.MAX_VALUE)); jPanel6Layout .setVerticalGroup(jPanel6Layout.createSequentialGroup().addContainerGap(30, 30) .addComponent(exportModeCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(321, Short.MAX_VALUE)); } { jPanel7 = new JPanel(); BorderLayout jPanel7Layout = new BorderLayout(); jPanel7.setLayout(jPanel7Layout); jTabbedPane1.addTab("error log", null, jPanel7, null); { jScrollPane5 = new JScrollPane(); jPanel7.add(jScrollPane5, BorderLayout.CENTER); { DefaultListModel errorLogListModel = new DefaultListModel(); errorLogList = new JList(); jScrollPane5.setViewportView(errorLogList); errorLogList.setModel(errorLogListModel); } } } } this.setSize(734, 442); swingUtil.addAction("openExternalSrcFolder.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (dir == null) { JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog("file is not correct!", "ERROR"); return; } externalDir = dir; } }); swingUtil.addAction("startCompareMatch.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { Validate.notNull(manualBaseDir, "source folder not set!!"); Validate.notNull(externalDir, "external folder not set!!"); Validate.isTrue(!manualBaseDir.equals(externalDir), "source dir : " + manualBaseDir + "\nexternal dir : " + externalDir + "\n cant be the same!!"); List<File> externalSrcFolderList = new ArrayList<File>(); FileUtil.searchFileMatchs(externalDir, ".*", externalSrcFolderList); System.out.println("externalSrcFolderList = " + externalSrcFolderList.size()); List<File> manualBaseSourceList = new ArrayList<File>(); FileUtil.searchFileMatchs(manualBaseDir, ".*", manualBaseSourceList); System.out.println("manualBaseSourceList = " + manualBaseSourceList.size()); String cutExternalPath = FileUtil.exportReceiveBaseDir(externalSrcFolderList).getAbsolutePath(); System.out.println("cutExternalPath = " + cutExternalPath); int cutExternalLength = cutExternalPath.length(); List<CompareFile> _compareList = new ArrayList<CompareFile>(); CompareFile compare = null; File mostCloseFile = null; List<File> searchMatchSrcList = new ArrayList<File>(); for (File external : externalSrcFolderList) { compare = new CompareFile(); compare.external = external; searchMatchSrcList.clear(); mostCloseFile = new File(manualBaseDir, external.getAbsolutePath().substring(cutExternalLength)); System.out.println(mostCloseFile.exists() + " == close file : " + mostCloseFile); if (mostCloseFile.exists()) { searchMatchSrcList.add(mostCloseFile); } else { for (File src : manualBaseSourceList) { if (src.getName().equalsIgnoreCase(external.getName())) { searchMatchSrcList.add(src); } } } System.out.println(external.getName() + " => match source : " + searchMatchSrcList.size()); compare.srcSet = new HashSet<File>(searchMatchSrcList); _compareList.add(compare); } compareList = _compareList; reloadCompareTable(); } }); swingUtil.addAction("compareTable.mouseClicked", new Action() { String tortoiseMergeFormat = "cmd /c call TortoiseMerge /base:\"%s\" /theirs:\"%s\""; String openFileFormat = "cmd /c call \"%s\""; void openFile(File file) { String command = String.format(openFileFormat, file); System.out.println(command); try { ProcessWatcher.newInstance(Runtime.getRuntime().exec(command)).getStreamSync(); System.out.println("do reload..."); reloadCompareTable(); } catch (IOException e1) { JCommonUtil.handleException(e1); } } public void action(EventObject evt) throws Exception { MouseEvent event = (MouseEvent) evt; int rowPos = JTableUtil.newInstance(compareTable).getSelectedRow(); final File external = (File) JTableUtil.newInstance(compareTable).getModel().getValueAt(rowPos, CompareTableIndex.EXTERNAL_FILE.pos); final File srcFile = (File) JTableUtil.newInstance(compareTable).getModel().getValueAt(rowPos, CompareTableIndex.SOURCE_FILE.pos); System.out.println("external : " + external); System.out.println("srcFile : " + srcFile); if (JMouseEventUtil.buttonLeftClick(2, event)) { String command = String.format(tortoiseMergeFormat, external, srcFile); System.out.println(command); Runtime.getRuntime().exec(command); } if (JMouseEventUtil.buttonRightClick(1, event)) { JMenuItem showInfoMenu = new JMenuItem(); showInfoMenu.setText("information"); showInfoMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog(// "source file : \n" + srcFile + "\n" + DateFormatUtils.format(srcFile.lastModified(), "yyyy/MM/dd HH:mm:ss") + "\n" + "size : " + srcFile.length() / 1024 + "\n\n" + "external file : \n" + external + "\n" + DateFormatUtils.format(external.lastModified(), "yyyy/MM/dd HH:mm:ss") + "\n" + "size : " + external.length() / 1024, "INFORMATION"); } }); JMenuItem openFileMenu = new JMenuItem(); openFileMenu.setText("OPEN : source"); openFileMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(srcFile); } }); JMenuItem openExternalMenu = new JMenuItem(); openExternalMenu.setText("OPEN : external"); openExternalMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(external); } }); JMenuItem openPairlMenu = new JMenuItem(); openPairlMenu.setText("OPEN : all"); openPairlMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(srcFile); openFile(external); } }); JPopupMenuUtil.newInstance(compareTable).applyEvent(event) .addJMenuItem(showInfoMenu, openFileMenu, openExternalMenu, openPairlMenu).show(); } } }); swingUtil.addAction("loadSrcTextarea.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { loadSrcTextarea(); } }); swingUtil.addAction("srcList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (JMouseEventUtil.buttonRightClick(1, evt)) { JPopupMenuUtil.newInstance(srcList).applyEvent(evt) .addJMenuItem("mark svn delete", new ActionListener() { public void actionPerformed(ActionEvent e) { if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil .newInstance().confirmButtonYesNo().showConfirmDialog( "are you sure, mark delete file : " + srcList.getSelectedValues().length, "SVN DELETE")) { return; } StringBuilder sb = new StringBuilder(); Process process = null; InputStream in = null; for (Object obj : srcList.getSelectedValues()) { LineParser l = (LineParser) obj; String command = String.format("svn delete \"%s\"", l.file); System.out.println(command); try { process = Runtime.getRuntime().exec(command); in = process.getInputStream(); for (; in.read() != -1;) ; if (l.file.exists()) { sb.append(l.file.getName() + "\n"); } } catch (IOException e1) { e1.printStackTrace(); sb.append(l.file.getName() + "\n"); } } if (sb.length() > 0) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("error : \n" + sb, "ERROR"); } else { JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("mark delete completed!!", "SUCCESS"); } DefaultListModel model = (DefaultListModel) srcList.getModel(); for (int ii = 0; ii < model.getSize(); ii++) { LineParser l = (LineParser) model.getElementAt(ii); if (!l.file.exists()) { model.remove(ii); ii--; } } } }).show(); } if (!JListUtil.newInstance(srcList).isCorrectMouseClick(evt)) { return; } LineParser lineParser = (LineParser) JListUtil.getLeadSelectionObject(srcList); if (lineParser == null) { return; } Runtime.getRuntime().exec("cmd /c call \"" + lineParser.file + "\""); } }); swingUtil.addAction("srcList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(srcList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("outPutList.mouseClicked", new Action() { public void action(EventObject evt) throws Exception { if (!JListUtil.newInstance(outPutList).isCorrectMouseClick(evt)) { return; } } }); swingUtil.addAction("outPutList.keyPressed", new Action() { public void action(EventObject evt) throws Exception { JListUtil.newInstance(outPutList).defaultJListKeyPressed(evt); } }); swingUtil.addAction("outPutDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (dir == null) { outputDir = DEFAULT_OUTPUT_DIR; } else { outputDir = dir; } reflushOutputList(); } }); swingUtil.addAction("srcBaseDir.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { File dir = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); Validate.notNull(dir, "src base directory is not correct!"); manualBaseDir = dir; } }); swingUtil.addAction("execute.actionPerformed", new Action() { public void action(EventObject evt) throws Exception { DefaultListModel model = (DefaultListModel) outPutList.getModel(); for (int ii = 0; ii < model.size(); ii++) { OutputFile file = (OutputFile) model.getElementAt(ii); if (!file.destFile.getParentFile().exists()) { file.destFile.getParentFile().mkdirs(); } FileUtil.copyFile(file.srcFile, file.destFile); } JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("copy success!!\nsize = " + model.getSize(), getTitle()); } }); } catch (Exception e) { e.printStackTrace(); } }