Re: AjaxFallbackLink Text

2009-07-02 Thread Joshua Martin
Finally figured it out... For the benefit of others, my entire page
with the AjaxFallbackLink w/ custom text:


@SuppressWarnings(serial)
public AssetsPage () {

// List for columns
ListIColumn columns = new ArrayListIColumn();

// Abstract column for showing a pop up window with details
columns.add(new AbstractColumn(new Model()) {

public void populateItem(Item cellItem, String componentId,
IModel rowModel) {

final Workstation item = 
(Workstation)rowModel.getObject();

// HashMap for all the item's values - will be sent to 
window
final HashMapString, String map = new HashMapString, 
String();
map.put(AGENTIDENTIFIER, item.getAgentIdentifier());
map.put(HOSTNAME, item.getHostname());
map.put(DOMAIN, item.getDomainname());
map.put(FQDN, item.getFqdn());
map.put(IP,The IP Address);
map.put(NETMASK, The Netmask);
map.put(GATEWAY, item.getGateway());
map.put(DNS1, item.getDns1());
map.put(DNS2, item.getDns2());

// ModalWindow functions as a pop up window with the 
item's details
final ModalWindow modalWindowDetail;
add(modalWindowDetail = new ModalWindow(modalWindowDetail));

// Action for close button callback
modalWindowDetail.setCloseButtonCallback(new
ModalWindow.CloseButtonCallback()
{
public boolean onCloseButtonClicked(AjaxRequestTarget 
target)
{
return true;
}
});

// Action for window close
modalWindowDetail.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback()
{
public void onClose(AjaxRequestTarget target)
{
// Do Nothing
}
});


AjaxFallbackLink link = new AjaxFallbackLink(componentId) {

@Override
public void onClick(AjaxRequestTarget 
target) {
System.out.println(Viewed 
Details for  + item.getAgentIdentifier());
modalWindowDetail.setTitle(Detail:  + 
item.getHostname());

modalWindowDetail.setCookieName(modal-window-detail);
modalWindowDetail.setContent(new
ModalPanel1(modalWindowDetail.getContentId(), map));
modalWindowDetail.show(target);
}

public void onComponentTagBody(MarkupStream 
markupStream,
ComponentTag openTag) {
String linkText = a href=\#\View 
Details/a;
replaceComponentTagBody(markupStream, 
openTag, linkText);
}
};

cellItem.add(link);
}

});

// Property columns
columns.add(new PropertyColumn(new Model(Agent Identifier),
agentIdentifier, agentIdentifier));
columns.add(new PropertyColumn(new Model(Hostname), 
hostname,
hostname));
columns.add(new PropertyColumn(new Model(FQDN), fqdn, 
fqdn));

// Add the datatable to the page
add(new DefaultDataTable(datatable, columns, new
SortableWorkstationProvider(), 8));
}

--
_

Joshua S. Martin

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



Re: AjaxFallbackLink Text

2009-06-28 Thread Bernard
Hi,

I cannot find the purpose of the IModel constructor argument in
AjaxFallbackLink(java.lang.String id, IModelT model) as I was also
trying to modify the anchor text via the IModel with AJAX.

What is it?

Many thanks.

Bernard


On Thu, 25 Jun 2009 12:11:37 -0500, you wrote:

Two ways come to mind:
- override onComponentTagBody and write it directly to the response
- use a wicket:fragment - add the fragment to the column, the link to
the fragment, and define the text in the html (or use wicket:message,
etc)


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



Re: AjaxFallbackLink Text

2009-06-28 Thread Martijn Dashorst
It is for an object you can use in the onclick handler.

new AjaxFallbackLinkPerson(oo, new Model(person)) {
onclick() {
Person p = getModelObject();
p.delete();
}
}

to display dynamic text inside the link, just nest a Label component
inside the link.

a href=# wicket:id=linkspan wicket:id=label/span/a

Link link = new Link(.){};
Label label = new Label();
link.add(label);
add(link)

Martijn

On Sun, Jun 28, 2009 at 8:54 AM, bern...@actrix.co.nz wrote:
 Hi,

 I cannot find the purpose of the IModel constructor argument in
 AjaxFallbackLink(java.lang.String id, IModelT model) as I was also
 trying to modify the anchor text via the IModel with AJAX.

 What is it?

 Many thanks.

 Bernard


 On Thu, 25 Jun 2009 12:11:37 -0500, you wrote:

Two ways come to mind:
- override onComponentTagBody and write it directly to the response
- use a wicket:fragment - add the fragment to the column, the link to
the fragment, and define the text in the html (or use wicket:message,
etc)


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





-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

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



Re: AjaxFallbackLink Text

2009-06-28 Thread Martin Grigorov
or override onComponentTagBody() and use the model instead of a Label.


El dom, 28-06-2009 a las 11:09 +0200, Martijn Dashorst escribió:
 It is for an object you can use in the onclick handler.
 
 new AjaxFallbackLinkPerson(oo, new Model(person)) {
 onclick() {
 Person p = getModelObject();
 p.delete();
 }
 }
 
 to display dynamic text inside the link, just nest a Label component
 inside the link.
 
 a href=# wicket:id=linkspan wicket:id=label/span/a
 
 Link link = new Link(.){};
 Label label = new Label();
 link.add(label);
 add(link)
 
 Martijn
 
 On Sun, Jun 28, 2009 at 8:54 AM, bern...@actrix.co.nz wrote:
  Hi,
 
  I cannot find the purpose of the IModel constructor argument in
  AjaxFallbackLink(java.lang.String id, IModelT model) as I was also
  trying to modify the anchor text via the IModel with AJAX.
 
  What is it?
 
  Many thanks.
 
  Bernard
 
 
  On Thu, 25 Jun 2009 12:11:37 -0500, you wrote:
 
 Two ways come to mind:
 - override onComponentTagBody and write it directly to the response
 - use a wicket:fragment - add the fragment to the column, the link to
 the fragment, and define the text in the html (or use wicket:message,
 etc)
 
 
  -
  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



AjaxFallbackLink Text

2009-06-25 Thread Joshua Martin
Trying to add an AjaxFallbackLink to a DataTable via an AbstractColumn
and I can't figure out how to set the text in the cell to say
something like view details or something.

I know that in the constructor, the String is for the component's ID,
and I thought that the model was for the text in the link - apparently
not...


// Abstract column for showing a pop up window with details
columns.add(new AbstractColumn(new Model(Actions)) {

public void populateItem(Item cellItem, String
componentId, IModel rowModel) {

final Workstation item = (Workstation)rowModel.getObject();

// HashMap for all the item's values - will be sent to window
final HashMapString, String map = new
HashMapString, String();
map.put(AGENTIDENTIFIER, item.getAgentIdentifier());
map.put(HOSTNAME, item.getHostname());
map.put(DOMAIN, item.getDomainname());
map.put(FQDN, item.getFqdn());
map.put(IP,The IP Address);
map.put(NETMASK, The Netmask);
map.put(GATEWAY, item.getGateway());
map.put(DNS1, item.getDns1());
map.put(DNS2, item.getDns2());

// ModalWindow functions as a pop up window with the
item's details
final ModalWindow modalWindowDetail;
add(modalWindowDetail = new ModalWindow(modalWindowDetail));

// Action for close button callback
modalWindowDetail.setCloseButtonCallback(new
ModalWindow.CloseButtonCallback()
{
public boolean
onCloseButtonClicked(AjaxRequestTarget target)
{
return true;
}
});

// Action for window close
modalWindowDetail.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback()
{
public void onClose(AjaxRequestTarget target)
{
// Do Nothing
}
});


AjaxFallbackLink link = new
AjaxFallbackLink(componentId, new Model(asdfasdf)) {

@Override
public void onClick(AjaxRequestTarget target) {
System.out.println(Viewed Details for  +
item.getAgentIdentifier());
modalWindowDetail.setTitle(Detail:  +
item.getHostname());
modalWindowDetail.setCookieName(modal-window-detail);
modalWindowDetail.setContent(new
ModalPanel1(modalWindowDetail.getContentId(), map));
modalWindowDetail.show(target);
}
};

cellItem.add(link);
}

});

--
_

Joshua S. Martin

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



Re: AjaxFallbackLink Text

2009-06-25 Thread Jeremy Thomerson
Two ways come to mind:
- override onComponentTagBody and write it directly to the response
- use a wicket:fragment - add the fragment to the column, the link to
the fragment, and define the text in the html (or use wicket:message,
etc)

--
Jeremy Thomerson
http://www.wickettraining.com




On Thu, Jun 25, 2009 at 11:32 AM, Joshua Martinjosmar52...@gmail.com wrote:
 Trying to add an AjaxFallbackLink to a DataTable via an AbstractColumn
 and I can't figure out how to set the text in the cell to say
 something like view details or something.

 I know that in the constructor, the String is for the component's ID,
 and I thought that the model was for the text in the link - apparently
 not...


        // Abstract column for showing a pop up window with details
        columns.add(new AbstractColumn(new Model(Actions)) {

            public void populateItem(Item cellItem, String
 componentId, IModel rowModel) {

                final Workstation item = (Workstation)rowModel.getObject();

                // HashMap for all the item's values - will be sent to window
                final HashMapString, String map = new
 HashMapString, String();
                map.put(AGENTIDENTIFIER, item.getAgentIdentifier());
                map.put(HOSTNAME, item.getHostname());
                map.put(DOMAIN, item.getDomainname());
                map.put(FQDN, item.getFqdn());
                map.put(IP,The IP Address);
                map.put(NETMASK, The Netmask);
                map.put(GATEWAY, item.getGateway());
                map.put(DNS1, item.getDns1());
                map.put(DNS2, item.getDns2());

                // ModalWindow functions as a pop up window with the
 item's details
                final ModalWindow modalWindowDetail;
                add(modalWindowDetail = new ModalWindow(modalWindowDetail));

                // Action for close button callback
                modalWindowDetail.setCloseButtonCallback(new
 ModalWindow.CloseButtonCallback()
                {
                    public boolean
 onCloseButtonClicked(AjaxRequestTarget target)
                    {
                        return true;
                    }
                });

                // Action for window close
                modalWindowDetail.setWindowClosedCallback(new
 ModalWindow.WindowClosedCallback()
                {
                    public void onClose(AjaxRequestTarget target)
                    {
                        // Do Nothing
                    }
                });


                AjaxFallbackLink link = new
 AjaxFallbackLink(componentId, new Model(asdfasdf)) {

                   �...@override
                    public void onClick(AjaxRequestTarget target) {
                        System.out.println(Viewed Details for  +
 item.getAgentIdentifier());
                        modalWindowDetail.setTitle(Detail:  +
 item.getHostname());
                        modalWindowDetail.setCookieName(modal-window-detail);
                        modalWindowDetail.setContent(new
 ModalPanel1(modalWindowDetail.getContentId(), map));
                        modalWindowDetail.show(target);
                    }
                };

                cellItem.add(link);
            }

        });

 --
 _

 Joshua S. Martin

 -
 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