Advertisement
Guest User

Untitled

a guest
Nov 6th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1. public class ListSites extends MyBasePage {
  2.    
  3.     private static final long serialVersionUID = -4911668101120395550L;
  4.  
  5.     public ListSites() {
  6.        
  7.  
  8.         //List containing a number of items
  9.         add(new ListView<MyInfo>("sitelist", MyWebApplication.get().getListSitesHelper()
  10.                 .getMySitesInfo()) {
  11.  
  12.  
  13.                     private static final long serialVersionUID = 1L;
  14.  
  15.             @Override
  16.             protected void populateItem(ListItem<MyInfo> item) {
  17.                 item.setOutputMarkupPlaceholderTag(true);
  18.                 //dummy text box
  19.                 final Label dummy = new Label("dummy", "Dummy: "+item.getModelObject().getSiteName());
  20.                 dummy.setOutputMarkupPlaceholderTag(true);
  21.                 dummy.setVisible(false);
  22.                
  23.                 final MyInfo siteInfo = item.getModelObject();
  24.                 item.add(new Label("locationName", siteInfo.getLocationName()));
  25.                 item.add(new Label("siteName", siteInfo.getSiteName()));
  26.                
  27.                 // setting up labels for showrawinfo
  28.                 final Model<String> modelRawInfo = new Model<String>();
  29.                 modelRawInfo.setObject("Detailed raw xml Info >>");
  30.                 final Label lblRawInfo = new Label("rawinfolabel", modelRawInfo);
  31.                 lblRawInfo.setOutputMarkupPlaceholderTag(true);
  32.                
  33.                 final Label lblHideInfo = new Label("hidelblinfo", "hideraw");
  34.  
  35.  
  36.  
  37.                 AjaxLink infoLink = new AjaxLink("showrawinfo", modelRawInfo) {
  38.                     boolean toogle = false;
  39.  
  40.                     public void onClick(AjaxRequestTarget target) {
  41.  
  42.                             dummy.setVisible(true);
  43.  
  44.                         target.add(dummy);
  45.  
  46.                     }
  47.                 };
  48.                
  49.                 modelRawInfo.setObject("Hide Info");
  50.                 AjaxLink hideLink = new AjaxLink("hiderawinfo",modelRawInfo) {
  51.  
  52.                     public void onClick(AjaxRequestTarget target) {
  53.  
  54.                             dummy.setVisible(false);
  55.  
  56.                         target.add(dummy);
  57.  
  58.                     }
  59.                 };             
  60.                
  61.                
  62.                 item.add(dummy);           
  63.                 item.add(infoLink);
  64.                 item.add(hideLink);
  65.  
  66.                
  67.  
  68.            
  69.         }
  70.  
  71.     });
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement