public void removeUpdate(DocumentEvent e) { filterUnits(); } });
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); }
private void initComponents() { setMinimumSize(new java.awt.Dimension(640, 480)); comboPlayer.setVisible(!useAlternate); getContentPane().setLayout(new GridBagLayout()); tlScroll.setMinimumSize(new Dimension(300, 100)); tlScroll.setPreferredSize(new Dimension(300, 100)); updateTypeCombo(); c = new GridBagConstraints(); c.gridx = 1; updatePlayerChoice(); c.fill = GridBagConstraints.BOTH; c.weightx = c.weighty = 1; getContentPane().add(splitPane, c); c.insets = new Insets(5,0,5,0); c.weightx = c.weighty = 0; c.gridy = 1; getContentPane().add(panelOKBtns, c); pack(); JRootPane rootPane = getRootPane(); KeyStroke escape = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
public void actionPerformed(ActionEvent ev) { if (ev.getSource().equals(comboWeight) || ev.getSource().equals(comboUnitType)) { filterUnits(); } else if (ev.getSource().equals(btnSelect)) { select(false); } else if (ev.getSource().equals(btnSelectClose)) { select(true); } else if (ev.getSource().equals(btnClose)) { close(); } else if (ev.getSource().equals(btnShowBV)) { JEditorPane tEditorPane = new JEditorPane(); tEditorPane.setContentType("text/html"); tEditorPane.setEditable(false); Entity e = getSelectedEntity(); if (null == e) { return; searchFilter = asd.showDialog(); btnResetSearch.setEnabled((searchFilter != null) && !searchFilter.isDisabled); filterUnits(); } else if(ev.getSource().equals(btnResetSearch)) { asd.clearValues(); searchFilter=null; btnResetSearch.setEnabled(false); filterUnits();
void select(boolean close) { Entity e = getSelectedEntity(); if (useAlternate) { // For MML chosenEntity = e; } else if (null != e) { Client c = null; if (comboPlayer.getSelectedIndex() > 0) { String name = (String) comboPlayer.getSelectedItem(); c = clientgui.getBots().get(name); } if (c == null) { c = client; } autoSetSkillsAndName(e); e.setOwner(c.getLocalPlayer()); c.sendAddEntity(e); } if (close) { setVisible(false); } }
@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); }
/** 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)); } }
unitModel.setData(mechs); filterUnits(); pack(); int width = guip.getMechSelectorSizeWidth(); int height = guip.getMechSelectorSizeHeight(); setSize(width,height);
@Override protected void processWindowEvent(WindowEvent e){ super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_DEACTIVATED){ GUIPreferences guip = GUIPreferences.getInstance(); guip.setMechSelectorUnitType(comboUnitType.getSelectedIndex()); guip.setMechSelectorWeightClass(comboWeight.getSelectedIndex()); guip.setMechSelectorRulesLevels(Arrays.toString(lstTechLevel.getSelectedIndices())); guip.setMechSelectorSizeHeight(getSize().height); guip.setMechSelectorSizeWidth(getSize().width); } }
void refreshUnitView() { boolean populateTextFields = true; Entity selectedUnit = getSelectedEntity();
unitLoadingDialog.setVisible(true); mechSelectorDialog = new UnitSelectorDialog(this, unitLoadingDialog); randomArmyDialog = new RandomArmyDialog(this); randomSkillDialog = new RandomSkillDialog(this);
public void insertUpdate(DocumentEvent e) { filterUnits(); }
public void changedUpdate(DocumentEvent e) { filterUnits(); }
@Override public void valueChanged(ListSelectionEvent evt) { if (evt.getValueIsAdjusting()) { return; } if (evt.getSource().equals(lstTechLevel)) { filterUnits(); } }