You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Joshua Martin <jo...@gmail.com> on 2009/07/03 04:55:39 UTC

Re: AjaxFallbackLink Text

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
		List<IColumn> columns = new ArrayList<IColumn>();
		
		// 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 HashMap<String, String> map = new HashMap<String, 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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org