rename my PickChoiceDialog to PickCheckBoxDialog and bring back the correct one

This commit is contained in:
Salco 2018-04-23 09:58:28 -04:00
parent e53a9d5f39
commit d782b69f0f
4 changed files with 861 additions and 161 deletions

View file

@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="scrollList" alignment="1" max="32767" attributes="0"/>
<Component id="panelCommands" alignment="0" max="32767" attributes="0"/>
<Component id="panelHeader" alignment="0" max="32767" attributes="0"/>
<Component id="panelSearch" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="panelHeader" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelSearch" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="scrollList" pref="240" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelCommands" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panelHeader">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelMessage" alignment="1" pref="0" max="32767" attributes="0"/>
<Component id="labelSubMessage" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="labelMessage" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelSubMessage" pref="30" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="labelMessage">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&lt;html&gt;&lt;div style=&apos;text-align: center;&apos;&gt;example long message example long message example long message example long message example long message&lt;/div&gt;&lt;/html&gt;"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="labelSubMessage">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="true" component="labelSubMessage" italic="true" property="font" relativeSize="true" size="0"/>
</FontInfo>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="&lt;html&gt;&lt;div style=&apos;text-align: center;&apos;&gt;example long message example long&lt;/div&gt;&lt;/html&gt;"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelSearch">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="labelSearch" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="editSearch" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="labelSearch" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="editSearch" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="labelSearch">
<Properties>
<Property name="text" type="java.lang.String" value="Search:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="editSearch">
<Properties>
<Property name="text" type="java.lang.String" value="sample search text"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="scrollList">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="listChoices">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="3">
<StringItem index="0" value="item1"/>
<StringItem index="1" value="item2"/>
<StringItem index="2" value="item3"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelCommands">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="btClear" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btOK" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btCancel" min="-2" pref="83" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btCancel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btOK" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btClear" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btOK">
<Properties>
<Property name="text" type="java.lang.String" value="Choose"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btOKActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="getRootPane().setDefaultButton(btOK);"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="btCancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btCancelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btClear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[30, 25]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btClearActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="getRootPane().setDefaultButton(btOK);"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View file

@ -0,0 +1,594 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.client.dialog;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.*;
import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.DefaultListModel;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.KeyStroke;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import mage.choices.Choice;
import mage.client.MageFrame;
import mage.client.util.SettingsManager;
import mage.client.util.gui.GuiDisplayUtil;
import mage.client.util.gui.MageDialogState;
/**
*
* @author JayDi85
* @author Salco
*/
public class PickCheckBoxDialog extends MageDialog {
Choice choice;
ArrayList<KeyValueItem> allItems = new ArrayList<>();
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel();
CheckBoxList.CheckBoxListModel m_dataModel;
CheckBoxList tList;
final private static String HTML_TEMPLATE = "<html><div style='text-align: center;'>%s</div></html>";
private void setFocus(CheckBoxList obj){
if (!(obj instanceof java.awt.Component)) {
throw new IllegalArgumentException("Must be a java.awt.Component!");
}
this.scrollList.setViewportView((java.awt.Component)obj);
}
private javax.swing.JList get_a_Jlist_from_ScrollListView(){
return ((javax.swing.JList)this.scrollList.getViewport().getView());
}
private void restoreData(Object dataFrom){
this.allItems.forEach((item) -> {
((CheckBoxList.CheckBoxListModel)dataFrom).addElement(item.getObjectValue());
});
}
public void showDialog(Choice choice) {
showDialog(choice, null, null, null);
}
public void showDialog(Choice choice, String startSelectionValue) {
showDialog(choice, null, null, startSelectionValue);
}
public void showDialog(Choice choice, UUID objectId, MageDialogState mageDialogState) {
showDialog(choice, objectId, mageDialogState, null);
}
public void showDialog(Choice choice, UUID objectId, MageDialogState mageDialogState, String startSelectionValue) {
this.choice = choice;
KeyValueItem tempKeyValue;
int indexInTList;
setLabelText(this.labelMessage, choice.getMessage());
setLabelText(this.labelSubMessage, choice.getSubMessage());
btCancel.setEnabled(!choice.isRequired());
// 2 modes: string or key-values
// sore data in allItems for inremental filtering
// http://logicbig.com/tutorials/core-java-tutorial/swing/list-filter/
this.allItems.clear();
if (choice.isKeyChoice()){
for (Map.Entry<String, String> entry: choice.getKeyChoices().entrySet()) {
if(tList != null){
indexInTList = m_dataModel.indexOf(entry.getKey());
tempKeyValue=new KeyValueItem(entry.getKey(), entry.getValue(),(CheckBoxList.CheckBoxListItem) this.tList.getModel().getElementAt(indexInTList));
}
else{
tempKeyValue=new KeyValueItem(entry.getKey(), entry.getValue());
}
this.allItems.add(tempKeyValue);
}
} else {
for (String value: choice.getChoices()){
if(tList != null){
indexInTList = m_dataModel.indexOf(value);
tempKeyValue=new KeyValueItem(value, value,(CheckBoxList.CheckBoxListItem) tList.getModel().getElementAt(indexInTList));
}
else{
tempKeyValue=new KeyValueItem(value, value);
}
this.allItems.add(tempKeyValue);
}
}
// sorting
if(choice.isSortEnabled()){
Collections.sort(this.allItems, new Comparator<KeyValueItem>() {
@Override
public int compare(KeyValueItem o1, KeyValueItem o2) {
Integer n1 = choice.getSortData().get(o1.getKey());
Integer n2 = choice.getSortData().get(o2.getKey());
return n1.compareTo(n2);
}
});
}
// search
if(choice.isSearchEnabled())
{
panelSearch.setVisible(true);
this.editSearch.setText(choice.getSearchText());
}else{
panelSearch.setVisible(false);
this.editSearch.setText("");
}
// listeners for inremental filtering
editSearch.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
choice.setSearchText(editSearch.getText());
loadData();
}
@Override
public void removeUpdate(DocumentEvent e) {
choice.setSearchText(editSearch.getText());
loadData();
}
@Override
public void changedUpdate(DocumentEvent e) {
choice.setSearchText(editSearch.getText());
loadData();
}
});
// listeners for select up and down without edit focus lost
editSearch.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
//System.out.println("types");
}
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_UP){
doPrevSelect();
}else if(e.getKeyCode() == KeyEvent.VK_DOWN){
doNextSelect();
}
}
@Override
public void keyReleased(KeyEvent e) {
//System.out.println("released");
}
});
// listeners double click choose
listChoices.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(e.getClickCount() == 2){
doChoose();
}
}
});
// listeners for ESC close
if(!choice.isRequired()){
String cancelName = "cancel";
InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), cancelName);
ActionMap actionMap = getRootPane().getActionMap();
actionMap.put(cancelName, new AbstractAction() {
public void actionPerformed(ActionEvent e) {
doCancel();
}
});
}
// window settings
if (this.isModal()){
MageFrame.getDesktop().add(this, JLayeredPane.MODAL_LAYER);
}else{
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
}
if (mageDialogState != null) {
mageDialogState.setStateToDialog(this);
} else {
Point centered = SettingsManager.instance.getComponentPosition(getWidth(), getHeight());
this.setLocation(centered.x, centered.y);
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
}
// final load
loadData();
// start selection
if((startSelectionValue != null)){
javax.swing.JList currentlistChoices;// = new javax.swing.JList();
currentlistChoices=this.get_a_Jlist_from_ScrollListView();
/*currentlistChoices = this.listChoices;*/
int selectIndex = -1;
for(int i = 0; i < this.listChoices.getModel().getSize(); i++){
//KeyValueItem listItem = (KeyValueItem)currentlistChoices.getModel().getElementAt(i);
String elementOfList = currentlistChoices.getModel().getElementAt(i).toString();
if (elementOfList.equals(startSelectionValue)){
selectIndex = i;
break;
}
}
if(selectIndex >= 0){
// currentlistChoices=this.get_a_Jlist_from_ScrollListView();
/*currentlistChoices = this.listChoices;*/
currentlistChoices.setSelectedIndex(selectIndex);
currentlistChoices.ensureIndexIsVisible(selectIndex);
}
}
this.setVisible(true);
}
public void setWindowSize(int width, int heigth){
this.setSize(new Dimension(width, heigth));
}
private void loadData(){
// load data to datamodel after filter or on startup
String filter = choice.getSearchText();
if (filter == null){ filter = ""; }
filter = filter.toLowerCase();
this.dataModel.clear();
this.m_dataModel.clear();
for(KeyValueItem item: this.allItems){
if(!choice.isSearchEnabled() || item.Value.toLowerCase().contains(filter)){
this.dataModel.addElement(item);
this.m_dataModel.addElement(item.getObjectValue());
}
}
}
private void setLabelText(JLabel label, String text){
if ((text != null) && !text.equals("")){
label.setText(String.format(HTML_TEMPLATE, text));
label.setVisible(true);
}else{
label.setText("");
label.setVisible(false);
}
}
private void doNextSelect(){
int newSel = this.listChoices.getSelectedIndex() + 1;
int maxSel = this.listChoices.getModel().getSize() - 1;
if(newSel <= maxSel){
this.listChoices.setSelectedIndex(newSel);
this.listChoices.ensureIndexIsVisible(newSel);
}
}
private void doPrevSelect(){
int newSel = this.listChoices.getSelectedIndex() - 1;
if(newSel >= 0){
this.listChoices.setSelectedIndex(newSel);
this.listChoices.ensureIndexIsVisible(newSel);
}
}
private void doChoose(){
if((tList != null)||(setChoice())){
this.m_dataModel.clear();
restoreData(this.m_dataModel);
this.hideDialog();
}
}
private void doCancel(){
this.listChoices.clearSelection();
this.choice.clearChoice();
hideDialog();
}
/**
* Creates new form PickChoiceDialog
* @param list
*/
public PickCheckBoxDialog(CheckBoxList list) {
initComponents();
tList=list;
this.listChoices.setModel(dataModel);
this.setModal(true);
if(tList != null)
{
this.listChoices.setVisible(false);
m_dataModel= ( CheckBoxList.CheckBoxListModel )tList.getModel();
tList.setSelectionForeground(Color.BLUE);
if(this.tList instanceof javax.swing.JList){
setFocus(tList);
}
}
}
/**
* Creates new form PickChoiceDialog
*/
public PickCheckBoxDialog() {
this(null);
}
public boolean setChoice() {
KeyValueItem item = (KeyValueItem)this.listChoices.getSelectedValue();
// auto select one item (after incemental filtering)
if((item == null) && (this.listChoices.getModel().getSize() == 1)){
this.listChoices.setSelectedIndex(0);
item = (KeyValueItem)this.listChoices.getSelectedValue();
}
if(item != null){
if(choice.isKeyChoice()){
choice.setChoiceByKey(item.getKey());
}else{
choice.setChoice(item.getKey());
}
return true;
}else{
choice.clearChoice();
return false;
}
}
class KeyValueItem
{
private final String Key;
private final String Value;
private final CheckBoxList.CheckBoxListItem objectValue;
public KeyValueItem(String value) {
this(value,null,null);
}
public KeyValueItem(String value, String label) {
this(value,label,null);
}
public KeyValueItem(String value, String label,CheckBoxList.CheckBoxListItem object) {
this.Key = value;
this.Value = label;
this.objectValue = object;
}
public String getKey() {
return this.Key;
}
public String getValue() {
return this.Value;
}
public Object getObjectValue(){
return (CheckBoxList.CheckBoxListItem)this.objectValue;
}
@Override
public String toString() {
return this.Value;
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelHeader = new javax.swing.JPanel();
labelMessage = new javax.swing.JLabel();
labelSubMessage = new javax.swing.JLabel();
panelSearch = new javax.swing.JPanel();
labelSearch = new javax.swing.JLabel();
editSearch = new javax.swing.JTextField();
scrollList = new javax.swing.JScrollPane();
listChoices = new javax.swing.JList();
panelCommands = new javax.swing.JPanel();
btOK = new javax.swing.JButton();
btCancel = new javax.swing.JButton();
btClear = new javax.swing.JButton();
labelMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelMessage.setText("<html><div style='text-align: center;'>example long message example long message example long message example long message example long message</div></html>");
labelSubMessage.setFont(labelSubMessage.getFont().deriveFont((labelSubMessage.getFont().getStyle() | java.awt.Font.ITALIC) | java.awt.Font.BOLD));
labelSubMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelSubMessage.setText("<html><div style='text-align: center;'>example long message example long</div></html>");
javax.swing.GroupLayout panelHeaderLayout = new javax.swing.GroupLayout(panelHeader);
panelHeader.setLayout(panelHeaderLayout);
panelHeaderLayout.setHorizontalGroup(
panelHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelHeaderLayout.createSequentialGroup()
.addGroup(panelHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(labelSubMessage, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(0, 0, 0))
);
panelHeaderLayout.setVerticalGroup(
panelHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelHeaderLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(labelMessage)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelSubMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))
);
labelSearch.setText("Search:");
editSearch.setText("sample search text");
javax.swing.GroupLayout panelSearchLayout = new javax.swing.GroupLayout(panelSearch);
panelSearch.setLayout(panelSearchLayout);
panelSearchLayout.setHorizontalGroup(
panelSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSearchLayout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(labelSearch)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(editSearch)
.addGap(0, 0, 0))
);
panelSearchLayout.setVerticalGroup(
panelSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSearchLayout.createSequentialGroup()
.addGap(3, 3, 3)
.addGroup(panelSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelSearch)
.addComponent(editSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3))
);
listChoices.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "item1", "item2", "item3" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
scrollList.setViewportView(listChoices);
btOK.setText("Choose");
btOK.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btOKActionPerformed(evt);
}
});
btCancel.setText("Cancel");
btCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btCancelActionPerformed(evt);
}
});
btClear.setText("Clear");
btClear.setMinimumSize(new java.awt.Dimension(30, 25));
btClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btClearActionPerformed(evt);
}
});
javax.swing.GroupLayout panelCommandsLayout = new javax.swing.GroupLayout(panelCommands);
panelCommands.setLayout(panelCommandsLayout);
panelCommandsLayout.setHorizontalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btClear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelCommandsLayout.setVerticalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btCancel)
.addComponent(btOK)
.addComponent(btClear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
getRootPane().setDefaultButton(btOK);
getRootPane().setDefaultButton(btOK);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scrollList, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(panelCommands, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelSearch, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(panelHeader, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(scrollList, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOKActionPerformed
doChoose();
}//GEN-LAST:event_btOKActionPerformed
private void btCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCancelActionPerformed
doCancel();
}//GEN-LAST:event_btCancelActionPerformed
/**
* Closes the dialog
*/
private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
doCancel();
}//GEN-LAST:event_closeDialog
private void btClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btClearActionPerformed
// TODO add your handling code here:
this.tList.uncheckAll();
//this.tList.repaint();
scrollList.repaint();
}//GEN-LAST:event_btClearActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btCancel;
private javax.swing.JButton btClear;
private javax.swing.JButton btOK;
private javax.swing.JTextField editSearch;
private javax.swing.JLabel labelMessage;
private javax.swing.JLabel labelSearch;
private javax.swing.JLabel labelSubMessage;
private javax.swing.JList listChoices;
private javax.swing.JPanel panelCommands;
private javax.swing.JPanel panelHeader;
private javax.swing.JPanel panelSearch;
private javax.swing.JScrollPane scrollList;
// End of variables declaration//GEN-END:variables
}

View file

@ -39,7 +39,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="panelSearch" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="scrollList" pref="240" max="32767" attributes="0"/>
<Component id="scrollList" pref="246" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelCommands" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
@ -55,8 +55,8 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="labelMessage" alignment="1" pref="0" max="32767" attributes="0"/>
<Component id="labelSubMessage" alignment="1" max="32767" attributes="0"/>
<Component id="labelMessage" alignment="1" pref="210" max="32767" attributes="0"/>
<Component id="labelSubMessage" alignment="1" pref="210" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
@ -65,10 +65,10 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="labelMessage" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="labelSubMessage" pref="30" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="labelSubMessage" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -158,14 +158,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="btClear" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btOK" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="btCancel" min="-2" pref="83" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="btOK" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btCancel" linkSize="3" min="-2" pref="70" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -176,7 +174,6 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btCancel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btOK" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btClear" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -203,20 +200,6 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btCancelActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="btClear">
<Properties>
<Property name="text" type="java.lang.String" value="Clear"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[30, 25]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btClearActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="getRootPane().setDefaultButton(btOK);"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents>

View file

@ -5,7 +5,6 @@
*/
package mage.client.dialog;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
@ -33,7 +32,6 @@ import mage.client.util.gui.MageDialogState;
/**
*
* @author JayDi85
* @author Salco
*/
public class PickChoiceDialog extends MageDialog {
@ -41,29 +39,9 @@ public class PickChoiceDialog extends MageDialog {
Choice choice;
ArrayList<KeyValueItem> allItems = new ArrayList<>();
DefaultListModel<KeyValueItem> dataModel = new DefaultListModel();
CheckBoxList.CheckBoxListModel m_dataModel;
CheckBoxList tList;
final private static String HTML_TEMPLATE = "<html><div style='text-align: center;'>%s</div></html>";
private void setFocus(CheckBoxList obj){
if (!(obj instanceof java.awt.Component)) {
throw new IllegalArgumentException("Must be a java.awt.Component!");
}
this.scrollList.setViewportView((java.awt.Component)obj);
}
private javax.swing.JList get_a_Jlist_from_ScrollListView(){
return ((javax.swing.JList)this.scrollList.getViewport().getView());
}
private void restoreData(Object dataFrom){
this.allItems.forEach((item) -> {
((CheckBoxList.CheckBoxListModel)dataFrom).addElement(item.getObjectValue());
});
}
public void showDialog(Choice choice) {
showDialog(choice, null, null, null);
}
@ -78,8 +56,6 @@ public class PickChoiceDialog extends MageDialog {
public void showDialog(Choice choice, UUID objectId, MageDialogState mageDialogState, String startSelectionValue) {
this.choice = choice;
KeyValueItem tempKeyValue;
int indexInTList;
setLabelText(this.labelMessage, choice.getMessage());
setLabelText(this.labelSubMessage, choice.getSubMessage());
@ -92,25 +68,11 @@ public class PickChoiceDialog extends MageDialog {
this.allItems.clear();
if (choice.isKeyChoice()){
for (Map.Entry<String, String> entry: choice.getKeyChoices().entrySet()) {
if(tList != null){
indexInTList = m_dataModel.indexOf(entry.getKey());
tempKeyValue=new KeyValueItem(entry.getKey(), entry.getValue(),(CheckBoxList.CheckBoxListItem) this.tList.getModel().getElementAt(indexInTList));
}
else{
tempKeyValue=new KeyValueItem(entry.getKey(), entry.getValue());
}
this.allItems.add(tempKeyValue);
this.allItems.add(new KeyValueItem(entry.getKey(), entry.getValue()));
}
} else {
for (String value: choice.getChoices()){
if(tList != null){
indexInTList = m_dataModel.indexOf(value);
tempKeyValue=new KeyValueItem(value, value,(CheckBoxList.CheckBoxListItem) tList.getModel().getElementAt(indexInTList));
}
else{
tempKeyValue=new KeyValueItem(value, value);
}
this.allItems.add(tempKeyValue);
this.allItems.add(new KeyValueItem(value, value));
}
}
@ -119,8 +81,8 @@ public class PickChoiceDialog extends MageDialog {
Collections.sort(this.allItems, new Comparator<KeyValueItem>() {
@Override
public int compare(KeyValueItem o1, KeyValueItem o2) {
Integer n1 = choice.getSortData().get(o1.getKey());
Integer n2 = choice.getSortData().get(o2.getKey());
Integer n1 = choice.getSortData().get(o1.Key);
Integer n2 = choice.getSortData().get(o2.Key);
return n1.compareTo(n2);
}
});
@ -222,24 +184,18 @@ public class PickChoiceDialog extends MageDialog {
// start selection
if((startSelectionValue != null)){
javax.swing.JList currentlistChoices;// = new javax.swing.JList();
currentlistChoices=this.get_a_Jlist_from_ScrollListView();
/*currentlistChoices = this.listChoices;*/
int selectIndex = -1;
for(int i = 0; i < this.listChoices.getModel().getSize(); i++){
//KeyValueItem listItem = (KeyValueItem)currentlistChoices.getModel().getElementAt(i);
String elementOfList = currentlistChoices.getModel().getElementAt(i).toString();
if (elementOfList.equals(startSelectionValue)){
KeyValueItem listItem = (KeyValueItem)this.listChoices.getModel().getElementAt(i);
if (listItem.Key.equals(startSelectionValue)){
selectIndex = i;
break;
}
}
if(selectIndex >= 0){
// currentlistChoices=this.get_a_Jlist_from_ScrollListView();
/*currentlistChoices = this.listChoices;*/
currentlistChoices.setSelectedIndex(selectIndex);
currentlistChoices.ensureIndexIsVisible(selectIndex);
this.listChoices.setSelectedIndex(selectIndex);
this.listChoices.ensureIndexIsVisible(selectIndex);
}
}
@ -254,14 +210,12 @@ public class PickChoiceDialog extends MageDialog {
// load data to datamodel after filter or on startup
String filter = choice.getSearchText();
if (filter == null){ filter = ""; }
filter = filter.toLowerCase();
filter = filter.toLowerCase(Locale.ENGLISH);
this.dataModel.clear();
this.m_dataModel.clear();
for(KeyValueItem item: this.allItems){
if(!choice.isSearchEnabled() || item.Value.toLowerCase().contains(filter)){
if(!choice.isSearchEnabled() || item.Value.toLowerCase(Locale.ENGLISH).contains(filter)){
this.dataModel.addElement(item);
this.m_dataModel.addElement(item.getObjectValue());
}
}
}
@ -294,9 +248,7 @@ public class PickChoiceDialog extends MageDialog {
}
private void doChoose(){
if((tList != null)||(setChoice())){
this.m_dataModel.clear();
restoreData(this.m_dataModel);
if(setChoice()){
this.hideDialog();
}
}
@ -307,35 +259,13 @@ public class PickChoiceDialog extends MageDialog {
hideDialog();
}
/**
* Creates new form PickChoiceDialog
* @param list
*/
public PickChoiceDialog(CheckBoxList list) {
initComponents();
tList=list;
this.listChoices.setModel(dataModel);
this.setModal(true);
if(tList != null)
{
this.listChoices.setVisible(false);
m_dataModel= ( CheckBoxList.CheckBoxListModel )tList.getModel();
tList.setSelectionForeground(Color.BLUE);
if(this.tList instanceof javax.swing.JList){
setFocus(tList);
}
}
}
/**
* Creates new form PickChoiceDialog
*/
public PickChoiceDialog() {
this(null);
initComponents();
this.listChoices.setModel(dataModel);
this.setModal(true);
}
public boolean setChoice() {
@ -364,18 +294,10 @@ public class PickChoiceDialog extends MageDialog {
{
private final String Key;
private final String Value;
private final CheckBoxList.CheckBoxListItem objectValue;
public KeyValueItem(String value) {
this(value,null,null);
}
public KeyValueItem(String value, String label) {
this(value,label,null);
}
public KeyValueItem(String value, String label,CheckBoxList.CheckBoxListItem object) {
this.Key = value;
this.Value = label;
this.objectValue = object;
}
public String getKey() {
@ -386,10 +308,6 @@ public class PickChoiceDialog extends MageDialog {
return this.Value;
}
public Object getObjectValue(){
return (CheckBoxList.CheckBoxListItem)this.objectValue;
}
@Override
public String toString() {
return this.Value;
@ -416,7 +334,6 @@ public class PickChoiceDialog extends MageDialog {
panelCommands = new javax.swing.JPanel();
btOK = new javax.swing.JButton();
btCancel = new javax.swing.JButton();
btClear = new javax.swing.JButton();
labelMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
labelMessage.setText("<html><div style='text-align: center;'>example long message example long message example long message example long message example long message</div></html>");
@ -431,17 +348,17 @@ public class PickChoiceDialog extends MageDialog {
panelHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelHeaderLayout.createSequentialGroup()
.addGroup(panelHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(labelSubMessage, javax.swing.GroupLayout.Alignment.TRAILING))
.addComponent(labelMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
.addComponent(labelSubMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
panelHeaderLayout.setVerticalGroup(
panelHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelHeaderLayout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(labelMessage)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(labelSubMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE))
.addGap(0, 0, 0)
.addComponent(labelSubMessage))
);
labelSearch.setText("Search:");
@ -490,39 +407,30 @@ public class PickChoiceDialog extends MageDialog {
}
});
btClear.setText("Clear");
btClear.setMinimumSize(new java.awt.Dimension(30, 25));
btClear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btClearActionPerformed(evt);
}
});
javax.swing.GroupLayout panelCommandsLayout = new javax.swing.GroupLayout(panelCommands);
panelCommands.setLayout(panelCommandsLayout);
panelCommandsLayout.setHorizontalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btClear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(btCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
panelCommandsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btCancel, btOK});
panelCommandsLayout.setVerticalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btCancel)
.addComponent(btOK)
.addComponent(btClear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(btOK))
.addContainerGap())
);
getRootPane().setDefaultButton(btOK);
getRootPane().setDefaultButton(btOK);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@ -546,7 +454,7 @@ public class PickChoiceDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(scrollList, javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
.addComponent(scrollList, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
@ -570,16 +478,8 @@ public class PickChoiceDialog extends MageDialog {
doCancel();
}//GEN-LAST:event_closeDialog
private void btClearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btClearActionPerformed
// TODO add your handling code here:
this.tList.uncheckAll();
//this.tList.repaint();
scrollList.repaint();
}//GEN-LAST:event_btClearActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btCancel;
private javax.swing.JButton btClear;
private javax.swing.JButton btOK;
private javax.swing.JTextField editSearch;
private javax.swing.JLabel labelMessage;