RE: Setting Checked Boxes in CheckGroup

2010-09-28 Thread Shelli Orton
Just wondering if anyone has had a chance to look at the quickstart project and 
could tell me what I'm doing wrong...

Shelli

-Original Message-
From: Shelli Orton 
Sent: Thursday, September 23, 2010 2:24 PM
To: users@wicket.apache.org
Subject: RE: Setting Checked Boxes in CheckGroup

I have attached a sample Eclipse project that exhibits the behaviour.  If 
someone can take the time to look at it and help me solve the problem, it would 
be greatly appreciated.  Please let me know if you need anything else.

Thanks again!

Shelli

-Original Message-
From: Erik van Oosten [mailto:e.vanoos...@grons.nl]
Sent: Thursday, September 23, 2010 12:13 PM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

See http://wicket.apache.org/start/quickstart.html

Use this to create a small application that exhibits the bug.

Regards,
 Erik.


Op 23-09-10 19:26, Shelli Orton schreef:
 What do you mean by quickstart?

 Shelli

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Thursday, September 23, 2010 10:57 AM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 im going to guess something is wrong with your model. hard to tell 
 without a quickstart.

 -igor




--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Setting Checked Boxes in CheckGroup

2010-09-28 Thread Igor Vaynberg
your SelectOption class is missing equals and hashcode

-igor

On Tue, Sep 28, 2010 at 8:38 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Just wondering if anyone has had a chance to look at the quickstart project 
 and could tell me what I'm doing wrong...

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Thursday, September 23, 2010 2:24 PM
 To: users@wicket.apache.org
 Subject: RE: Setting Checked Boxes in CheckGroup

 I have attached a sample Eclipse project that exhibits the behaviour.  If 
 someone can take the time to look at it and help me solve the problem, it 
 would be greatly appreciated.  Please let me know if you need anything else.

 Thanks again!

 Shelli

 -Original Message-
 From: Erik van Oosten [mailto:e.vanoos...@grons.nl]
 Sent: Thursday, September 23, 2010 12:13 PM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 See http://wicket.apache.org/start/quickstart.html

 Use this to create a small application that exhibits the bug.

 Regards,
     Erik.


 Op 23-09-10 19:26, Shelli Orton schreef:
 What do you mean by quickstart?

 Shelli

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Thursday, September 23, 2010 10:57 AM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 im going to guess something is wrong with your model. hard to tell
 without a quickstart.

 -igor




 --
 Erik van Oosten
 http://www.day-to-day-stuff.blogspot.com/


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Setting Checked Boxes in CheckGroup

2010-09-28 Thread Shelli Orton
I added the missing methods and the default selected options are now checked.

Thanks!

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Tuesday, September 28, 2010 9:54 AM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

your SelectOption class is missing equals and hashcode

-igor

On Tue, Sep 28, 2010 at 8:38 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Just wondering if anyone has had a chance to look at the quickstart project 
 and could tell me what I'm doing wrong...

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Thursday, September 23, 2010 2:24 PM
 To: users@wicket.apache.org
 Subject: RE: Setting Checked Boxes in CheckGroup

 I have attached a sample Eclipse project that exhibits the behaviour.  If 
 someone can take the time to look at it and help me solve the problem, it 
 would be greatly appreciated.  Please let me know if you need anything else.

 Thanks again!

 Shelli

 -Original Message-
 From: Erik van Oosten [mailto:e.vanoos...@grons.nl]
 Sent: Thursday, September 23, 2010 12:13 PM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 See http://wicket.apache.org/start/quickstart.html

 Use this to create a small application that exhibits the bug.

 Regards,
     Erik.


 Op 23-09-10 19:26, Shelli Orton schreef:
 What do you mean by quickstart?

 Shelli

 -Original Message-
 From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
 Sent: Thursday, September 23, 2010 10:57 AM
 To: users@wicket.apache.org
 Subject: Re: Setting Checked Boxes in CheckGroup

 im going to guess something is wrong with your model. hard to tell
 without a quickstart.

 -igor




 --
 Erik van Oosten
 http://www.day-to-day-stuff.blogspot.com/


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Setting Checked Boxes in CheckGroup

2010-09-23 Thread Shelli Orton
Does anybody have a suggestion for this?

Thanks,

Shelli

-Original Message-
From: Shelli Orton 
Sent: Wednesday, September 22, 2010 1:54 PM
To: users@wicket.apache.org
Subject: Setting Checked Boxes in CheckGroup

Hi,

I am trying to use a CheckGroup to manage which columns are used in a
datatable.  I've set up my columns as per the code below.  The
getColumnCheckBoxes method creates the check boxes that will be part of
the group.  The getDefaultColumns defines which columns should be
checked by default.  The default columns are being set, but the boxes
are not being displayed as checked when the page is first loaded.
However, the correct columns are being displayed in the datatable, so
they are being set behind the scenes.

How do I get them to display as checked on page load?

Thanks in advance!

Shelli

CODE:

public class HomePage extends WebPage
{
StringResourceModel columnA = new StringResourceModel(columnA,
this,
null);
StringResourceModel columnB = new StringResourceModel(columnB,
this,
null);   
StringResourceModel columnC = new StringResourceModel(columnC,
this,
null);
StringResourceModel columnD = new StringResourceModel(columnD,
this,
null);

ArrayListSelectOption columnCheckBoxes = null;

CheckGroupSelectOption columnCheckGroup = new
CheckGroupSelectOption(columnCheckGroup,
new ArrayListSelectOption());

@SuppressWarnings(rawtypes)
ListIColumn columns = new ArrayListIColumn();

/**
 * Constructor that is invoked when page is invoked without a
session.
 * 
 * @param parameters Page parameters
 */
@SuppressWarnings(rawtypes)
public HomePage(final PageParameters parameters)
{
@SuppressWarnings(serial)
Form queryForm = new Form(queryForm)
{
@Override
protected void onSubmit()
{
// do stuff
}
};

add(queryForm);

// Create column selection boxes
columnCheckGroup.add(new
CheckGroupSelector(columnCheckGroupSelector));

@SuppressWarnings({ unchecked, serial })
ListView checkBoxes = new ListView(columnCheckGroup,
getColumnCheckBoxes())
{
@SuppressWarnings(unchecked)
protected void populateItem(ListItem item)
{
item.add(new Check(columnCheckbox, item.getModel()));
item.add(new Label(displayValue,
new PropertyModel(item.getModel(),
displayValue)));
}

};

if (columnCheckGroup.getModelObject().isEmpty())
{
columnCheckGroup.setModelObject(this.getDefaultColumns());
}

columnCheckGroup.add(checkBoxes);
queryForm.add(columnCheckGroup);

// more init stuff...

}

public ArrayListSelectOption getColumnCheckBoxes()
{
if (columnCheckBoxes == null)
{
columnCheckBoxes = new ArrayListSelectOption();

columnCheckBoxes.add(new SelectOption(columnA,
this.columnA.getObject()));
columnCheckBoxes.add(new SelectOption(columnB,
this.columnB.getObject()));
columnCheckBoxes.add(new SelectOption(columnC,
this.columnC.getObject()));
columnCheckBoxes.add(new SelectOption(columnD,
this.columnD.getObject()));
}

return columnCheckBoxes;
}

/*
By default, columns A and B are selected
*/
private ArrayListSelectOption getDefaultColumns()
{
ArrayListSelectOption defaultColumns = new
ArrayListSelectOption();

defaultColumns.add(new SelectOption(columnA,
this.columnA.getObject()));
defaultColumns.add(new SelectOption(columnB,
this.columnB.getObject()));

return defaultColumns;
}

class SelectOption implements Serializable
{
private static final long serialVersionUID = 1L;

private String propertyValue;
private String displayValue;

/**
 * Utility class for storing property and display values for
option 
 * widgets (e.g. drop down lists, check boxes).
 */
public SelectOption(String propertyValue, String displayValue)
{
this.propertyValue = propertyValue;
this.displayValue = displayValue;
}

// getters/setters 
}
}


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Setting Checked Boxes in CheckGroup

2010-09-23 Thread Igor Vaynberg
im going to guess something is wrong with your model. hard to tell
without a quickstart.

-igor

On Thu, Sep 23, 2010 at 9:25 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Does anybody have a suggestion for this?

 Thanks,

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Wednesday, September 22, 2010 1:54 PM
 To: users@wicket.apache.org
 Subject: Setting Checked Boxes in CheckGroup

 Hi,

 I am trying to use a CheckGroup to manage which columns are used in a
 datatable.  I've set up my columns as per the code below.  The
 getColumnCheckBoxes method creates the check boxes that will be part of
 the group.  The getDefaultColumns defines which columns should be
 checked by default.  The default columns are being set, but the boxes
 are not being displayed as checked when the page is first loaded.
 However, the correct columns are being displayed in the datatable, so
 they are being set behind the scenes.

 How do I get them to display as checked on page load?

 Thanks in advance!

 Shelli

 CODE:

 public class HomePage extends WebPage
 {
    StringResourceModel columnA = new StringResourceModel(columnA,
            this,
            null);
    StringResourceModel columnB = new StringResourceModel(columnB,
            this,
            null);
    StringResourceModel columnC = new StringResourceModel(columnC,
            this,
            null);
    StringResourceModel columnD = new StringResourceModel(columnD,
            this,
            null);

    ArrayListSelectOption columnCheckBoxes = null;

    CheckGroupSelectOption columnCheckGroup = new
 CheckGroupSelectOption(columnCheckGroup,
            new ArrayListSelectOption());

   �...@suppresswarnings(rawtypes)
    ListIColumn columns = new ArrayListIColumn();

    /**
     * Constructor that is invoked when page is invoked without a
 session.
     *
     * @param parameters Page parameters
     */
   �...@suppresswarnings(rawtypes)
    public HomePage(final PageParameters parameters)
    {
       �...@suppresswarnings(serial)
        Form queryForm = new Form(queryForm)
        {
           �...@override
            protected void onSubmit()
            {
                // do stuff
            }
        };

        add(queryForm);

        // Create column selection boxes
        columnCheckGroup.add(new
 CheckGroupSelector(columnCheckGroupSelector));

       �...@suppresswarnings({ unchecked, serial })
        ListView checkBoxes = new ListView(columnCheckGroup,
                getColumnCheckBoxes())
        {
           �...@suppresswarnings(unchecked)
            protected void populateItem(ListItem item)
            {
                item.add(new Check(columnCheckbox, item.getModel()));
                item.add(new Label(displayValue,
                        new PropertyModel(item.getModel(),
 displayValue)));
            }

        };

        if (columnCheckGroup.getModelObject().isEmpty())
        {
            columnCheckGroup.setModelObject(this.getDefaultColumns());
        }

        columnCheckGroup.add(checkBoxes);
        queryForm.add(columnCheckGroup);

        // more init stuff...

    }

    public ArrayListSelectOption getColumnCheckBoxes()
    {
        if (columnCheckBoxes == null)
        {
            columnCheckBoxes = new ArrayListSelectOption();

            columnCheckBoxes.add(new SelectOption(columnA,
 this.columnA.getObject()));
            columnCheckBoxes.add(new SelectOption(columnB,
 this.columnB.getObject()));
            columnCheckBoxes.add(new SelectOption(columnC,
 this.columnC.getObject()));
            columnCheckBoxes.add(new SelectOption(columnD,
 this.columnD.getObject()));
        }

        return columnCheckBoxes;
    }

    /*
        By default, columns A and B are selected
    */
    private ArrayListSelectOption getDefaultColumns()
    {
        ArrayListSelectOption defaultColumns = new
 ArrayListSelectOption();

        defaultColumns.add(new SelectOption(columnA,
 this.columnA.getObject()));
        defaultColumns.add(new SelectOption(columnB,
 this.columnB.getObject()));

        return defaultColumns;
    }

    class SelectOption implements Serializable
    {
        private static final long serialVersionUID = 1L;

        private String propertyValue;
        private String displayValue;

        /**
         * Utility class for storing property and display values for
 option
         * widgets (e.g. drop down lists, check boxes).
         */
        public SelectOption(String propertyValue, String displayValue)
        {
            this.propertyValue = propertyValue;
            this.displayValue = displayValue;
        }

        // getters/setters 
    }
 }


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


 -
 To unsubscribe, e-mail: users-unsubscr

RE: Setting Checked Boxes in CheckGroup

2010-09-23 Thread Shelli Orton
What do you mean by quickstart?

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] 
Sent: Thursday, September 23, 2010 10:57 AM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

im going to guess something is wrong with your model. hard to tell
without a quickstart.

-igor

On Thu, Sep 23, 2010 at 9:25 AM, Shelli Orton shelli.or...@sjrb.ca wrote:
 Does anybody have a suggestion for this?

 Thanks,

 Shelli

 -Original Message-
 From: Shelli Orton
 Sent: Wednesday, September 22, 2010 1:54 PM
 To: users@wicket.apache.org
 Subject: Setting Checked Boxes in CheckGroup

 Hi,

 I am trying to use a CheckGroup to manage which columns are used in a
 datatable.  I've set up my columns as per the code below.  The
 getColumnCheckBoxes method creates the check boxes that will be part of
 the group.  The getDefaultColumns defines which columns should be
 checked by default.  The default columns are being set, but the boxes
 are not being displayed as checked when the page is first loaded.
 However, the correct columns are being displayed in the datatable, so
 they are being set behind the scenes.

 How do I get them to display as checked on page load?

 Thanks in advance!

 Shelli

 CODE:

 public class HomePage extends WebPage
 {
    StringResourceModel columnA = new StringResourceModel(columnA,
            this,
            null);
    StringResourceModel columnB = new StringResourceModel(columnB,
            this,
            null);
    StringResourceModel columnC = new StringResourceModel(columnC,
            this,
            null);
    StringResourceModel columnD = new StringResourceModel(columnD,
            this,
            null);

    ArrayListSelectOption columnCheckBoxes = null;

    CheckGroupSelectOption columnCheckGroup = new
 CheckGroupSelectOption(columnCheckGroup,
            new ArrayListSelectOption());

   �...@suppresswarnings(rawtypes)
    ListIColumn columns = new ArrayListIColumn();

    /**
     * Constructor that is invoked when page is invoked without a
 session.
     *
     * @param parameters Page parameters
     */
   �...@suppresswarnings(rawtypes)
    public HomePage(final PageParameters parameters)
    {
       �...@suppresswarnings(serial)
        Form queryForm = new Form(queryForm)
        {
           �...@override
            protected void onSubmit()
            {
                // do stuff
            }
        };

        add(queryForm);

        // Create column selection boxes
        columnCheckGroup.add(new
 CheckGroupSelector(columnCheckGroupSelector));

       �...@suppresswarnings({ unchecked, serial })
        ListView checkBoxes = new ListView(columnCheckGroup,
                getColumnCheckBoxes())
        {
           �...@suppresswarnings(unchecked)
            protected void populateItem(ListItem item)
            {
                item.add(new Check(columnCheckbox, item.getModel()));
                item.add(new Label(displayValue,
                        new PropertyModel(item.getModel(),
 displayValue)));
            }

        };

        if (columnCheckGroup.getModelObject().isEmpty())
        {
            columnCheckGroup.setModelObject(this.getDefaultColumns());
        }

        columnCheckGroup.add(checkBoxes);
        queryForm.add(columnCheckGroup);

        // more init stuff...

    }

    public ArrayListSelectOption getColumnCheckBoxes()
    {
        if (columnCheckBoxes == null)
        {
            columnCheckBoxes = new ArrayListSelectOption();

            columnCheckBoxes.add(new SelectOption(columnA,
 this.columnA.getObject()));
            columnCheckBoxes.add(new SelectOption(columnB,
 this.columnB.getObject()));
            columnCheckBoxes.add(new SelectOption(columnC,
 this.columnC.getObject()));
            columnCheckBoxes.add(new SelectOption(columnD,
 this.columnD.getObject()));
        }

        return columnCheckBoxes;
    }

    /*
        By default, columns A and B are selected
    */
    private ArrayListSelectOption getDefaultColumns()
    {
        ArrayListSelectOption defaultColumns = new
 ArrayListSelectOption();

        defaultColumns.add(new SelectOption(columnA,
 this.columnA.getObject()));
        defaultColumns.add(new SelectOption(columnB,
 this.columnB.getObject()));

        return defaultColumns;
    }

    class SelectOption implements Serializable
    {
        private static final long serialVersionUID = 1L;

        private String propertyValue;
        private String displayValue;

        /**
         * Utility class for storing property and display values for
 option
         * widgets (e.g. drop down lists, check boxes).
         */
        public SelectOption(String propertyValue, String displayValue)
        {
            this.propertyValue = propertyValue;
            this.displayValue = displayValue;
        }

        // getters/setters

Re: Setting Checked Boxes in CheckGroup

2010-09-23 Thread Erik van Oosten

See http://wicket.apache.org/start/quickstart.html

Use this to create a small application that exhibits the bug.

Regards,
Erik.


Op 23-09-10 19:26, Shelli Orton schreef:

What do you mean by quickstart?

Shelli

-Original Message-
From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com]
Sent: Thursday, September 23, 2010 10:57 AM
To: users@wicket.apache.org
Subject: Re: Setting Checked Boxes in CheckGroup

im going to guess something is wrong with your model. hard to tell
without a quickstart.

-igor
   




--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Setting Checked Boxes in CheckGroup

2010-09-22 Thread Shelli Orton
Hi,

I am trying to use a CheckGroup to manage which columns are used in a
datatable.  I've set up my columns as per the code below.  The
getColumnCheckBoxes method creates the check boxes that will be part of
the group.  The getDefaultColumns defines which columns should be
checked by default.  The default columns are being set, but the boxes
are not being displayed as checked when the page is first loaded.
However, the correct columns are being displayed in the datatable, so
they are being set behind the scenes.

How do I get them to display as checked on page load?

Thanks in advance!

Shelli

CODE:

public class HomePage extends WebPage
{
StringResourceModel columnA = new StringResourceModel(columnA,
this,
null);
StringResourceModel columnB = new StringResourceModel(columnB,
this,
null);   
StringResourceModel columnC = new StringResourceModel(columnC,
this,
null);
StringResourceModel columnD = new StringResourceModel(columnD,
this,
null);

ArrayListSelectOption columnCheckBoxes = null;

CheckGroupSelectOption columnCheckGroup = new
CheckGroupSelectOption(columnCheckGroup,
new ArrayListSelectOption());

@SuppressWarnings(rawtypes)
ListIColumn columns = new ArrayListIColumn();

/**
 * Constructor that is invoked when page is invoked without a
session.
 * 
 * @param parameters Page parameters
 */
@SuppressWarnings(rawtypes)
public HomePage(final PageParameters parameters)
{
@SuppressWarnings(serial)
Form queryForm = new Form(queryForm)
{
@Override
protected void onSubmit()
{
// do stuff
}
};

add(queryForm);

// Create column selection boxes
columnCheckGroup.add(new
CheckGroupSelector(columnCheckGroupSelector));

@SuppressWarnings({ unchecked, serial })
ListView checkBoxes = new ListView(columnCheckGroup,
getColumnCheckBoxes())
{
@SuppressWarnings(unchecked)
protected void populateItem(ListItem item)
{
item.add(new Check(columnCheckbox, item.getModel()));
item.add(new Label(displayValue,
new PropertyModel(item.getModel(),
displayValue)));
}

};

if (columnCheckGroup.getModelObject().isEmpty())
{
columnCheckGroup.setModelObject(this.getDefaultColumns());
}

columnCheckGroup.add(checkBoxes);
queryForm.add(columnCheckGroup);

// more init stuff...

}

public ArrayListSelectOption getColumnCheckBoxes()
{
if (columnCheckBoxes == null)
{
columnCheckBoxes = new ArrayListSelectOption();

columnCheckBoxes.add(new SelectOption(columnA,
this.columnA.getObject()));
columnCheckBoxes.add(new SelectOption(columnB,
this.columnB.getObject()));
columnCheckBoxes.add(new SelectOption(columnC,
this.columnC.getObject()));
columnCheckBoxes.add(new SelectOption(columnD,
this.columnD.getObject()));
}

return columnCheckBoxes;
}

/*
By default, columns A and B are selected
*/
private ArrayListSelectOption getDefaultColumns()
{
ArrayListSelectOption defaultColumns = new
ArrayListSelectOption();

defaultColumns.add(new SelectOption(columnA,
this.columnA.getObject()));
defaultColumns.add(new SelectOption(columnB,
this.columnB.getObject()));

return defaultColumns;
}

class SelectOption implements Serializable
{
private static final long serialVersionUID = 1L;

private String propertyValue;
private String displayValue;

/**
 * Utility class for storing property and display values for
option 
 * widgets (e.g. drop down lists, check boxes).
 */
public SelectOption(String propertyValue, String displayValue)
{
this.propertyValue = propertyValue;
this.displayValue = displayValue;
}

// getters/setters 
}
}


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org