/** * Turns the "selected Geometry" button on/off. This is used when the selected geometry is null * and the button should be disabled (as clicking on it would have no effect * * @param enabled whether the button should be on/off */ public void setSelGeoButtonEnabled(boolean enabled) { selecGeoButton.setEnabled(enabled); // noCritButton.setSelected( ); if (!enabled) { if (noCritButton.isSelected()) { noCritButton.doClick(); } else { bboxCritButton.doClick(); } } }
/* * (non-Javadoc) * * @see * eu.europa.ec.markt.dss.commons.swing.mvc.applet.wizard.WizardView#wizardModelChange(java.beans.PropertyChangeEvent * ) */ @Override public void wizardModelChange(final PropertyChangeEvent evt) { if (SignatureModel.PROPERTY_FORMAT.equals(evt.getPropertyName())) { final String format = getModel().getFormat(); if (FormatType.CADES.equals(format)) { envelopingButton.setEnabled(true); detachedButton.setEnabled(true); envelopedButton.setEnabled(false); if (envelopedButton.isSelected()) { envelopedButton.setSelected(false); } envelopingButton.doClick(); } if (FormatType.PADES.equals(format)) { envelopingButton.setEnabled(false); detachedButton.setEnabled(false); envelopedButton.setEnabled(true); if (envelopingButton.isSelected() || detachedButton.isSelected()) { envelopingButton.setSelected(false); detachedButton.setSelected(false); } envelopedButton.doClick(); } if (FormatType.XADES.equals(format)) { envelopingButton.setEnabled(true); detachedButton.setEnabled(true); envelopedButton.setEnabled(FileType.XML == getModel().getFileType()); if (envelopedButton.isSelected()) { envelopedButton.setSelected(false); } envelopingButton.doClick(); } if (FormatType.ASICS.equals(format)) { envelopingButton.setEnabled(false); detachedButton.setEnabled(true); envelopedButton.setEnabled(false); if (envelopedButton.isSelected() || envelopingButton.isSelected()) { envelopingButton.setSelected(false); envelopedButton.setSelected(false); } detachedButton.doClick(); } levelComboBox.setSelectedIndex(-1); } }
@Override protected boolean initializeFromMatch( JdbcDatastore datastore, NamedPattern<UrlPart> namedPattern, NamedPatternMatch<UrlPart> match) { final String pattern = namedPattern.toString(); switch (pattern) { case URL_SID_BASED: _radioSid.doClick(); break; case URL_FALLBACK: case URL_SERVICE_NAME_BASED: default: _radioServiceName.doClick(); break; } return super.initializeFromMatch(datastore, namedPattern, match); }
@Override public final void clickJRadioButton(final int id) { final Component combo = searchComponentByHcCode(mlet, id); if (combo != null && combo instanceof JRadioButton) { final JRadioButton radioButton = (JRadioButton) combo; radioButton.doClick(); // MCanvas.doActon(combo); } else { LogManager.err(NO_COMPONENT_HCCODE + id); } }
public NewGameDialog(GUI parent) { this.parent = parent; this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setTitle("New game"); this.setSize(250, 150); this.setResizable(false); this.setLocationRelativeTo(null); JPanel contentPane = new JPanel(); this.add(contentPane); contentPane.setLayout(new FlowLayout()); // BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); SpinnerNumberModel model = new SpinnerNumberModel(1, 1, 3, 1); JLabel numAIlabel = new JLabel("Number of opponents:"); numAIlabel.setMaximumSize(numAIlabel.getPreferredSize()); contentPane.add(numAIlabel); numAI = new JSpinner(model); /*{ @Override public Dimension getMaximumSize() { Dimension dim = super.getMaximumSize(); dim.height = getPreferredSize().height; return dim; } };*/ numAI.setEditor(new JSpinner.DefaultEditor(numAI)); numAI.setPreferredSize(new Dimension(100, 30)); // numAI.setMaximumSize(numAI.getPreferredSize()); contentPane.add(numAI); chooseDifficulty = new ButtonGroup(); JRadioButton easy = new JRadioButton("Easy"); JRadioButton intermediate = new JRadioButton("Intermediate"); JRadioButton hard = new JRadioButton("Hard"); easy.setActionCommand("EASY"); intermediate.setActionCommand("INTERMEDIATE"); hard.setActionCommand("HARD"); chooseDifficulty.add(easy); chooseDifficulty.add(intermediate); chooseDifficulty.add(hard); contentPane.add(easy); contentPane.add(intermediate); contentPane.add(hard); easy.doClick(); JButton confirm = new JButton("Confirm"); contentPane.add(confirm); confirm.addActionListener(this); this.setVisible(true); }
public void initComponents(Hashtable<Glyph, List<Glyph>> intersectionTable) { JPanel messageLblPan = new JPanel(); messageLblPan.setLayout(new BoxLayout(messageLblPan, BoxLayout.X_AXIS)); JLabel messageLbl = new JLabel(Strings.nestChoiceDiagMSG); messageLbl.setBorder(BorderFactory.createTitledBorder(Strings.infoMSG)); messageLblPan.add(messageLbl); JPanel sharedGroupPan = new JPanel(); sharedGroupPan.setLayout(new GridLayout(0, 3)); JPanel buttonGroup = null; JRadioButton selectionRadBtn = null; ButtonGroup radioGroup = null; Map<Glyph, Glyph> nestMap = new HashMap<Glyph, Glyph>(); for (Glyph i : intersectionTable.keySet()) { // for each draged component buttonGroup = new JPanel(); buttonGroup.setLayout(new BoxLayout(buttonGroup, BoxLayout.Y_AXIS)); buttonGroup.setBorder(BorderFactory.createTitledBorder(i.getName())); radioGroup = new ButtonGroup(); for (Glyph j : intersectionTable.get(i)) { // for each entity it intersects with selectionRadBtn = new JRadioButton(j.getName()); selectionRadBtn.addActionListener( FacadeController.getInstance().nestDialog_RadioListener(nestMap, i, j)); buttonGroup.add(selectionRadBtn); radioGroup.add(selectionRadBtn); } selectionRadBtn.doClick(); sharedGroupPan.add(buttonGroup); } JPanel okBtnPan = new JPanel(); okBtnPan.setLayout(new BoxLayout(okBtnPan, BoxLayout.X_AXIS)); JButton okBtn = new JButton("Ok"); okBtnPan.add(okBtn); okBtn.addActionListener(FacadeController.getInstance().nestDialog_OkListener(nestMap, this)); JButton cancelBtn = new JButton("Cancel"); okBtnPan.add(cancelBtn); cancelBtn.addActionListener(FacadeController.getInstance().nestDialog_cancelBtnListener(this)); contentPane.add(Box.createRigidArea(new Dimension(0, 5))); contentPane.add(messageLblPan); contentPane.add(Box.createRigidArea(new Dimension(0, 5))); contentPane.add(sharedGroupPan); contentPane.add(okBtnPan); centerDialog(); }
/** Create buttons for choosing the spatial criteria and a panel for them */ private JComponent createSpatialButtons() { // JLabel label = new JLabel( GUIMessages.SPATIAL_CRITERIA ); // label.setBounds(LEFT_MARGIN + 2, 370,200,18); // add(label); noCritButton = new JRadioButton(I18N.getString("AttributeResearchPanel.none")); noCritButton.setActionCommand(WFSPanel.NONE); noCritButton.doClick(); bboxCritButton = new JRadioButton(I18N.getString("AttributeResearchPanel.bbox")); bboxCritButton.setActionCommand(WFSPanel.BBOX); bboxCritButton.setBounds(10, 30, 200, STD_HEIGHT); selecGeoButton = new JRadioButton(I18N.getString("AttributeResearchPanel.selectedGeometry")); selecGeoButton.setActionCommand(WFSPanel.SELECTED_GEOM); ActionListener bal = new ActionListener() { public void actionPerformed(ActionEvent e) { JRadioButton rb = (JRadioButton) e.getSource(); spatialSearchCriteria = rb.getActionCommand(); } }; noCritButton.addActionListener(bal); bboxCritButton.addActionListener(bal); selecGeoButton.addActionListener(bal); ButtonGroup bg = new ButtonGroup(); bg.add(noCritButton); bg.add(bboxCritButton); bg.add(selecGeoButton); Box b = Box.createVerticalBox(); b.setAlignmentX(0.95f); b.setBorder( BorderFactory.createTitledBorder(I18N.getString("AttributeResearchPanel.spatialCriteria"))); b.add(noCritButton); b.add(bboxCritButton); b.add(selecGeoButton); b.setPreferredSize(new Dimension(150, 100)); return b; }
public HSQLSettings() { super(HSQLDB.class); CPSModule.debug("HSQLSettings", "using pref node:" + HSQLDB.class.toString()); rdoUseGlobalDir = new JRadioButton("Use global output directory", false); rdoUseGlobalDir.addItemListener(this); rdoUseCustomDir = new JRadioButton("Use other directory:", false); rdoUseCustomDir.addItemListener(this); ButtonGroup bg = new ButtonGroup(); bg.add(rdoUseCustomDir); bg.add(rdoUseGlobalDir); lblCustomOutDir = new JLabel(); flchCustomDir = new JFileChooser(); flchCustomDir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); btnCustomDir = new JButton("Choose Output Directory"); btnCustomDir.addActionListener(this); buildConfigPanel(); rdoUseGlobalDir.doClick(); }
public void setTextureByName(String name) { JRadioButton b = texNameToButton.get(name); if (b != null) b.doClick(); }
public void setTestCase(TestCaseEdit test) { this.test = test; // choose default format rbXML.setEnabled(true); rbXML.doClick(); }
public void resetConfigurationToDefaults() { rdoUseGlobalDir.doClick(); lblCustomOutDir.setText( flchCustomDir.getFileSystemView().getDefaultDirectory().getAbsolutePath()); }
@Override public void selectPpmReceiver() { _receiverPpmRadioButton.doClick(); }
private void addListeners() { for (int i = 0; i < algorithmChooseRadioButtons.size(); i++) { JRadioButton button = algorithmChooseRadioButtons.get(i); button.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { step2Module.setHcsAlgm(map.get(e.getSource())); JPanel p = step2Module.getHcsAlgm().getAlgorithmConfigPanel(); algmConfigPanel.removeAll(); algmConfigPanel.add(p); } } }); if (i == 0) { button.doClick(); algmConfigPanel.removeAll(); step2Module.setHcsAlgm(map.get(button)); algmConfigPanel.add(step2Module.getHcsAlgm().getAlgorithmConfigPanel()); } } apply.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < algorithmChooseRadioButtons.size(); i++) { JRadioButton button = algorithmChooseRadioButtons.get(i); if (button.isSelected()) { JPanel algmConfigPanel = algms.get(i).getAlgorithmConfigPanel(); if (algmConfigPanel instanceof PickAlgorithmConfigPanel) { PickAlgorithmConfigPanel pacPanel = (PickAlgorithmConfigPanel) algmConfigPanel; PickAlgorithm palgm = pacPanel.getAlgorithm(); palgm.setAlgorithm_selected(true); palgm.setCondition_number_value(pacPanel.getCondition_number_value()); // palgm.setGuaranteed_loan_balance_floor_selected( // pacPanel.isGuaranteed_loan_balance_floor_selected()); palgm.setGuaranteed_loan_balance_floor_unit( pacPanel.getGuaranteed_loan_balance_floor_unit()); palgm.setGuaranteed_loan_balance_floor_value( pacPanel.getGuaranteed_loan_balance_floor_value()); palgm.setOut_Guaranteed_loan_balance_floor_unit( pacPanel.getGuaranteed_loan_balance_floor_unit()); palgm.setOut_Guaranteed_loan_balance_floor_value( pacPanel.getGuaranteed_loan_balance_floor_value()); palgm.setGuarantor_floor_selected(pacPanel.isGuarantorFloorSelected()); palgm.setOut_guarantor_floor_selected(pacPanel.isOutGuarantorFloorSelected()); palgm.setGuarantor_floor_value(pacPanel.getGuarantorFloor()); palgm.setOut_Guarantor_floor_value(pacPanel.getOutGuarantorFloor()); palgm.setLoan_balance_floor_selected(pacPanel.isLoanBalanceFloorSelected()); palgm.setLoan_balance_floor_unit(pacPanel.getLoanBalanceFloorUnit()); palgm.setLoan_balance_floor_value(pacPanel.getLoanBalanceFloor()); palgm.setMutually_guaranteed_floor_selected( pacPanel.isMutuallyGuarantorFloorSelected()); palgm.setMutually_guaranteed_floor_value(pacPanel.getMutuallyGuarantorFloor()); palgm.setOne_hand_vertex_all(pacPanel.isOne_hand_vertex_all_selected()); palgm.setOne_hand_vertex_in_only(pacPanel.isOne_hand_vertex_in_only_selected()); palgm.setOne_hand_vertex_none(pacPanel.isOne_hand_vertex_none_selected()); palgm.setTwo_hand_vertex_all(pacPanel.isTwo_hand_vertex_all_selected()); palgm.setTwo_hand_vertex_in_only(pacPanel.isTwo_hand_vertex_in_only_selected()); palgm.setTwo_hand_vertex_none(pacPanel.isTwo_hand_vertex_none_selected()); palgm.setThree_hand_vertex_all(pacPanel.isThree_hand_vertex_all_selected()); palgm.setThree_hand_vertex_in_only( pacPanel.isThree_hand_vertex_in_only_selected()); palgm.setThree_hand_vertex_none(pacPanel.isThree_hand_vertex_none_selected()); palgm.setPick_corecorp_loop(pacPanel.isPickCorecorpLoopSelected()); palgm.setPick_mutually_guaranteed_corp( pacPanel.isPickMutuallyGuaranteedCorpSelected()); palgm.setUnpick_corecorp_son(pacPanel.isUnpickCorecorpSonSelected()); GCClassify gcClassify = gcClassifyConfigPanel.getGcClassify(); gcClassify.setLoan_balance_floor(gcClassifyConfigPanel.getLoan_balance_floor()); gcClassify.setLoan_balance_ceiling( gcClassifyConfigPanel.getLoan_balance_ceiling()); try { palgm.updateConfigCache(); gcClassify.updateConfigCache(); rdaConfigPanel.updateConfigCache(); boolean sucess = Config.saveDoc(); if (sucess) { JOptionPane.showMessageDialog( ConfigPanel.this, successMessage, "提示", JOptionPane.INFORMATION_MESSAGE); InfoPane.getInstance().info(successMessage); } } catch (Exception e1) { JOptionPane.showMessageDialog( ConfigPanel.this, "应用配置成功,但保存配置时出错,不影响下一步继续进行。", "警告", JOptionPane.WARNING_MESSAGE); } finally { Module.gotoStep(3); } } } } } }); }
@Override public void selectQuadX() { _quadXRadioButton.doClick(); }
public void setGeometryByName(String name) { JRadioButton b = geomNameToButton.get(name); if (b != null) b.doClick(); }
public void resetConfiguration() { if (getUseGlobalDir()) rdoUseGlobalDir.doClick(); else rdoUseCustomDir.doClick(); lblCustomOutDir.setText(getCustomOutDir()); }
@Test public void testBindModel() { model = new ModelObject(); view = new ViewObject(); class Profil { private String nom; private Integer id; public Profil(String nom, Integer id) { this.nom = nom; this.id = id; } public String getNom() { return nom; } public void setNom(String nom) { this.nom = nom; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } @Override public String toString() { return this.getNom(); } } Profil profil = new Profil("nom", 1); List<Object> profils = new ArrayList<Object>(); profils.add(profil); model.setProfils(profils); JTextField jtextfield = (JTextField) view.getNameTextField(); appController.bindModel(view, model); // The test on JTextField Component JTextField jtextfield2 = new JTextField(); JFrame frame = new JFrame(); frame.add(jtextfield); frame.add(jtextfield2); frame.setVisible(true); jtextfield.setText("Nom"); jtextfield.requestFocus(); jtextfield2.requestFocus(); Assert.assertTrue(jtextfield.getListeners(FocusListener.class).length != 0); // this thread is defined to wait until the focus event get fired try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } // The test established on JTextField binding model Assert.assertTrue(model.getName().equals("Nom")); // The test established on JCheckBox binding model JCheckBox jcheckbox1 = (JCheckBox) view.getJcheckbox1(); JCheckBox jcheckbox2 = (JCheckBox) view.getJcheckbox2(); jcheckbox1.doClick(); jcheckbox2.doClick(); List<String> checked = new ArrayList<String>(); checked.add(jcheckbox1.getText()); checked.add(jcheckbox2.getText()); Assert.assertEquals(model.getChoices(), checked); // The test established on JRadioButton JRadioButton jradiobutton1 = (JRadioButton) view.getJradiobutton1(); JRadioButton jradiobutton2 = (JRadioButton) view.getJradiobutton2(); jradiobutton1.doClick(); Assert.assertEquals(model.getChoice(), model.getInitChoice1()); jradiobutton2.doClick(); Assert.assertEquals(model.getChoice(), model.getInitChoice2()); // The test established on JLabel binding model JLabel jlabel = (JLabel) view.getJlabel(); Assert.assertEquals(jlabel.getText(), model.getLabelInitValue()); // The test established on JList binding model JList jlist = (JList) view.getJlist(); Assert.assertTrue(jlist.getVisibleRowCount() != 0); // The test established on JTable binding model JTable jtable = (JTable) view.getTable(); Assert.assertTrue(view.getTable().getRowCount() == 1); // The test established on JSpinner binding model JSpinner jspinner = view.getJspinner(); Assert.assertEquals(jspinner.getValue(), model.getProfils().get(0)); // The test established on JComboBox binding model JComboBox jcombobox = (JComboBox) view.getProfilComboBox(); Assert.assertTrue(view.getProfilComboBox().getItemCount() == 1); }
public CarsTableFrame(boolean showAllCars, String locationName, String trackName) { super(Bundle.getMessage("TitleCarsTable")); this.showAllCars = showAllCars; this.locationName = locationName; this.trackName = trackName; // general GUI configuration getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); // Set up the table in a Scroll Pane.. carsTableModel = new CarsTableModel(showAllCars, locationName, trackName); TableSorter sorter = new TableSorter(carsTableModel); carsTable = new JTable(sorter); sorter.setTableHeader(carsTable.getTableHeader()); JScrollPane carsPane = new JScrollPane(carsTable); carsPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); carsTableModel.initTable(carsTable, this); // load the number of cars and listen for changes updateNumCars(); carsTableModel.addTableModelListener(this); // Set up the control panel // row 1 JPanel cp1 = new JPanel(); cp1.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("SortBy"))); cp1.add(sortByNumber); cp1.add(sortByRoad); cp1.add(sortByType); JPanel clp = new JPanel(); clp.setBorder(BorderFactory.createTitledBorder("")); clp.add(sortByColor); clp.add(sortByLoad); cp1.add(clp); cp1.add(sortByKernel); cp1.add(sortByLocation); JPanel destp = new JPanel(); destp.setBorder(BorderFactory.createTitledBorder("")); destp.add(sortByDestination); destp.add(sortByFinalDestination); destp.add(sortByRwe); cp1.add(destp); cp1.add(sortByTrain); JPanel movep = new JPanel(); movep.setBorder(BorderFactory.createTitledBorder("")); movep.add(sortByMoves); movep.add(sortByBuilt); movep.add(sortByOwner); if (Setup.isValueEnabled()) { movep.add(sortByValue); } if (Setup.isRfidEnabled()) { movep.add(sortByRfid); } if (ScheduleManager.instance().numEntries() > 0) { movep.add(sortByWait); movep.add(sortByPickup); } movep.add(sortByLast); cp1.add(movep); // row 2 JPanel cp2 = new JPanel(); cp2.setLayout(new BoxLayout(cp2, BoxLayout.X_AXIS)); JPanel cp2Add = new JPanel(); cp2Add.setBorder(BorderFactory.createTitledBorder("")); cp2Add.add(numCars); cp2Add.add(textCars); cp2Add.add(textSep1); cp2Add.add(addButton); cp2.add(cp2Add); JPanel cp2Find = new JPanel(); cp2Find.setBorder(BorderFactory.createTitledBorder("")); findButton.setToolTipText(Bundle.getMessage("findCar")); findCarTextBox.setToolTipText(Bundle.getMessage("findCar")); cp2Find.add(findButton); cp2Find.add(findCarTextBox); cp2.add(cp2Find); JPanel cp2Save = new JPanel(); cp2Save.setBorder(BorderFactory.createTitledBorder("")); cp2Save.add(saveButton); cp2.add(cp2Save); // place controls in scroll pane JPanel controlPanel = new JPanel(); controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.Y_AXIS)); controlPanel.add(cp1); controlPanel.add(cp2); // some tool tips sortByFinalDestination.setToolTipText(Bundle.getMessage("FinalDestination")); sortByRwe.setToolTipText(Bundle.getMessage("ReturnWhenEmpty")); sortByPickup.setToolTipText(Bundle.getMessage("TipPickup")); sortByLast.setToolTipText(Bundle.getMessage("TipLastMoved")); JScrollPane controlPane = new JScrollPane(controlPanel); getContentPane().add(carsPane); getContentPane().add(controlPane); // setup buttons addButtonAction(addButton); addButtonAction(findButton); addButtonAction(saveButton); sortByNumber.setSelected(true); addRadioButtonAction(sortByNumber); addRadioButtonAction(sortByRoad); addRadioButtonAction(sortByType); addRadioButtonAction(sortByColor); addRadioButtonAction(sortByLoad); addRadioButtonAction(sortByKernel); addRadioButtonAction(sortByLocation); addRadioButtonAction(sortByDestination); addRadioButtonAction(sortByFinalDestination); addRadioButtonAction(sortByRwe); addRadioButtonAction(sortByTrain); addRadioButtonAction(sortByMoves); addRadioButtonAction(sortByBuilt); addRadioButtonAction(sortByOwner); addRadioButtonAction(sortByValue); addRadioButtonAction(sortByRfid); addRadioButtonAction(sortByWait); addRadioButtonAction(sortByPickup); addRadioButtonAction(sortByLast); group.add(sortByNumber); group.add(sortByRoad); group.add(sortByType); group.add(sortByColor); group.add(sortByLoad); group.add(sortByKernel); group.add(sortByLocation); group.add(sortByDestination); group.add(sortByFinalDestination); group.add(sortByRwe); group.add(sortByTrain); group.add(sortByMoves); group.add(sortByBuilt); group.add(sortByOwner); group.add(sortByValue); group.add(sortByRfid); group.add(sortByWait); group.add(sortByPickup); group.add(sortByLast); // sort by location if (!showAllCars) { sortByLocation.doClick(); if (locationName != null) { String title = Bundle.getMessage("TitleCarsTable") + " " + locationName; if (trackName != null) { title = title + " " + trackName; } setTitle(title); } } // build menu JMenuBar menuBar = new JMenuBar(); JMenu toolMenu = new JMenu(Bundle.getMessage("Tools")); toolMenu.add( new CarRosterMenu(Bundle.getMessage("TitleCarRoster"), CarRosterMenu.MAINMENU, this)); toolMenu.add(new ShowCheckboxesCarsTableAction(carsTableModel)); toolMenu.add(new ResetCheckboxesCarsTableAction(carsTableModel)); toolMenu.add(new ModifyLocationsAction()); toolMenu.add(new TrainsByCarTypeAction()); toolMenu.add(new CarsSetFrameAction(carsTable)); menuBar.add(toolMenu); menuBar.add(new jmri.jmrit.operations.OperationsMenu()); setJMenuBar(menuBar); addHelpMenu("package.jmri.jmrit.operations.Operations_Cars", true); // NOI18N initMinimumSize(); addHorizontalScrollBarKludgeFix(controlPane, controlPanel); // create ShutDownTasks createShutDownTask(); }