public void actionPerformed(java.awt.event.ActionEvent evt) { asd.clearValues(); searchFilter=null; btnResetSearch.setEnabled(false); filterUnits(); } });
public void actionPerformed(java.awt.event.ActionEvent evt) { searchFilter = asd.showDialog(); btnResetSearch.setEnabled(searchFilter!=null); filterUnits(); } });
/** * Show the dialog. setVisible(true) blocks until setVisible(false). * * @return Return the filter that was created with this dialog. */ public MechSearchFilter showDialog() { //We need to save a copy since the user can alter the filter state // and then click on the cancel button. We want to make sure the // original filter state is saved. MechSearchFilter currFilter = mechFilter; mechFilter = new MechSearchFilter(currFilter); txtEqExp.setText(mechFilter.getEquipmentExpression()); if ((filterToks == null) || (filterToks.size() == 0) || (filterToks.lastElement() instanceof OperationFT)) { disableOperationButtons(); enableSelectionButtons(); }else{ enableOperationButtons(); disableSelectionButtons(); } setVisible(true); if (isCanceled){ mechFilter = currFilter; }else{ updateMechSearchFilter(); } return mechFilter; }
/** * Clear the filter. */ public void clearValues() { cWalk.setSelectedIndex(0); tWalk.setText(""); cJump.setSelectedIndex(0); tJump.setText(""); cArmor.setSelectedIndex(0); tblWeapons.clearSelection(); tblEquipment.clearSelection(); txtEqExp.setText(""); cbxEnableArmorSearch.setSelected(false); cbxEnableCockpitSearch.setSelected(false); cbxEnableInternalsSearch.setSelected(false); cboArmorType.setSelectedIndex(0); cboCockpitType.setSelectedIndex(0); cboInternalsType.setSelectedIndex(0); mechFilter = null; filterToks.clear(); btnBack.setEnabled(false); disableOperationButtons(); enableSelectionButtons(); }
try{ mechFilter.createFilterExpressionFromTokens(filterToks); setVisible(false); }catch (MechSearchFilter.FilterParsingException e){ JOptionPane.showMessageDialog(this, setVisible(false); }else if (ev.getSource().equals(cboUnitType) || ev.getSource().equals(cboTechLevel) || ev.getSource().equals(cboTechClass)) { filterTables(); }else if (ev.getSource().equals(btnAdd)){ int row = tblEquipment.getSelectedRow(); tblEquipment.getValueAt(row, EquipmentTableModel.COL_QTY)); filterToks.add(new EquipmentFT(internalName,fullName,qty)); txtEqExp.setText(filterExpressionString()); btnBack.setEnabled(true); enableOperationButtons(); disableSelectionButtons(); tblWeapons.getValueAt(row, WeaponsTableModel.COL_QTY)); filterToks.add(new EquipmentFT(internalName,fullName,qty)); txtEqExp.setText(filterExpressionString()); btnBack.setEnabled(true); enableOperationButtons(); disableSelectionButtons(); txtEqExp.setText(filterExpressionString());
populateWeaponsAndEquipmentChoices(); setLayout(new GridBagLayout()); this.add(lblWalk,c); c.gridx = 1; c.gridy = 0; c.insets = new Insets(0,0,0,0); panWalk.add(cWalk); panWalk.add(tWalk); this.add(panWalk,c); c.gridx = 3; c.gridy = 0; c.insets = new Insets(0,40,0,0); cockpitPanel.add(lblCockpitType,BorderLayout.WEST); cockpitPanel.add(cboCockpitType,BorderLayout.EAST); this.add(cockpitPanel,c); c.insets = new Insets(0,0,0,0); c.weighty = 0; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0,10,0,0); this.add(lblJump,c); c.insets = new Insets(0,0,0,0); c.gridx = 1; c.gridy = 1; panJump.add(cJump); panJump.add(tJump); this.add(panJump,c);
JOptionPane.showMessageDialog(null, tScroll, "BV", JOptionPane.INFORMATION_MESSAGE, null); } else if(ev.getSource().equals(btnAdvSearch)) { searchFilter = asd.showDialog(); btnResetSearch.setEnabled((searchFilter != null) && !searchFilter.isDisabled); filterUnits(); } else if(ev.getSource().equals(btnResetSearch)) { asd.clearValues(); searchFilter=null; btnResetSearch.setEnabled(false);
/** Creates new form UnitSelectorDialog */ public UnitSelectorDialog(Frame frame, Campaign c, boolean add) { super(frame, true); unitModel = new MechTableModel(); addToCampaign = add; //TODO: the proper way to do this would be to create a listener interface that has //methods like buyUnit, addUnit, etc. that we could register with this dialog //and then update when needed this.campaign = c; formatter = new DecimalFormat(); asd = new AdvancedSearchDialog(frame, campaign.getCalendar().get(GregorianCalendar.YEAR)); initComponents(); MechSummary[] allMechs = MechSummaryCache.getInstance().getAllMechs(); setMechs(allMechs); setLocationRelativeTo(frame); }
asd = new AdvancedSearchDialog(m_clientgui.frame, m_client.getGame().getOptions().intOption(OptionsConstants.ALLOWED_YEAR));
public UnitSelectorDialog(JFrame frame, UnitLoadingDialog uld, boolean useAlternate) { super(frame, Messages.getString("MechSelectorDialog.title"), true); //$NON-NLS-1$ unitLoadingDialog = uld; this.frame = frame; this.useAlternate = useAlternate;setLocationRelativeTo(frame); unitModel = new MechTableModel(); initComponents(); GUIPreferences guip = GUIPreferences.getInstance(); int width = guip.getMechSelectorSizeWidth(); int height = guip.getMechSelectorSizeHeight(); setSize(width,height); setLocationRelativeTo(frame); asd = new AdvancedSearchDialog(frame, 999999); run(); setVisible(true); }
@Override public void setVisible(boolean visible) { asd.clearValues(); searchFilter=null; filterUnits(); super.setVisible(visible); }
searchFilter=asd.showDialog(); m_bAdvSearchClear.setEnabled(searchFilter!=null); } else if (ev.getSource().equals(m_bAdvSearchClear)){
/** Creates new form UnitSelectorDialog */ public UnitSelectorDialog(ClientGUI cl, UnitLoadingDialog uld) { super(cl.frame, Messages.getString("MechSelectorDialog.title"), true); //$NON-NLS-1$ unitLoadingDialog = uld; if (null != cl) { frame = cl.getFrame(); client = cl.getClient(); clientgui = cl; } unitModel = new MechTableModel(); initComponents(); GUIPreferences guip = GUIPreferences.getInstance(); int width = guip.getMechSelectorSizeWidth(); int height = guip.getMechSelectorSizeHeight(); setSize(width,height); if (null != cl) { setLocationRelativeTo(cl.frame); asd = new AdvancedSearchDialog(cl.frame, client.getGame().getOptions().intOption(OptionsConstants.ALLOWED_YEAR)); } }
@Override public void setVisible(boolean visible) { updateTypeCombo(); if (visible){ GUIPreferences guip = GUIPreferences.getInstance(); comboUnitType.setSelectedIndex(guip.getMechSelectorUnitType()); comboWeight.setSelectedIndex(guip.getMechSelectorWeightClass()); String option = guip.getMechSelectorRulesLevels().replaceAll("\\[", ""); option = option.replaceAll("\\]", ""); if (option.length() > 0) { String[] strSelections = option.split("[,]"); int[] intSelections = new int[strSelections.length]; for (int i = 0; i < strSelections.length; i++) { intSelections[i] = Integer.parseInt(strSelections[i].trim()); } lstTechLevel.setSelectedIndices(intSelections); } } asd.clearValues(); searchFilter=null; btnResetSearch.setEnabled(false); if (!useAlternate) { updatePlayerChoice(); } filterUnits(); super.setVisible(visible); }