Exemplo n.º 1
0
 public static void hideIfModelIsEmpty(Component component) {
   if (component != null
       && (component.getDefaultModel() == null
           || component.getDefaultModelObject() == null
           || Strings.isNullOrEmpty(component.getDefaultModelObjectAsString()))) {
     component.setVisible(false);
   }
 }
 @Test
 public void testTimestamp() {
   login("sysadmin", "sysadmin");
   Date now = new Date();
   tester.startPage(HomePage.class);
   tester.assertComponent("timestamp", Label.class);
   Component timestampLabel = tester.getComponentFromLastRenderedPage("timestamp");
   String timestamp = (String) timestampLabel.getDefaultModelObject();
   DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
   assertEquals(timestamp, dateFormat.format(now));
 }
Exemplo n.º 3
0
 /**
  * Convenience method to get the model object of this location's component.
  *
  * @return model
  */
 @SuppressWarnings("unchecked")
 public <T> T getModelObject() {
   return (T) component.getDefaultModelObject();
 }