////////////////////////////////////////////////////////////////////////////
 //
 // Change "Unit" property
 //
 ////////////////////////////////////////////////////////////////////////////
 public void test_propertyUnit() throws Exception {
   DockLayoutPanelInfo panel =
       parse(
           "// filler filler filler filler filler",
           "// filler filler filler filler filler",
           "<ui:UiBinder>",
           "  <g:DockLayoutPanel/>",
           "</ui:UiBinder>");
   refresh();
   // Unit property
   Property unitProperty = panel.getPropertyByTitle("Unit");
   assertNotNull(unitProperty);
   assertTrue(unitProperty.getCategory().isSystem());
   // default value
   assertFalse(unitProperty.isModified());
   assertEquals("PX", getPropertyText(unitProperty));
   // set value
   setPropertyText(unitProperty, "MM");
   assertXML(
       "// filler filler filler filler filler",
       "// filler filler filler filler filler",
       "<ui:UiBinder>",
       "  <g:DockLayoutPanel unit='MM'/>",
       "</ui:UiBinder>");
   assertTrue(unitProperty.isModified());
   assertEquals("MM", getPropertyText(unitProperty));
 }
예제 #2
0
 ////////////////////////////////////////////////////////////////////////////
 //
 // Cell property
 //
 ////////////////////////////////////////////////////////////////////////////
 public void test_propertyCell_existingElement() throws Exception {
   parse(
       "// filler filler filler filler filler",
       "<ui:UiBinder>",
       "  <g:HorizontalPanel>",
       "    <g:Cell>",
       "      <g:Button wbp:name='button'/>",
       "    </g:Cell>",
       "  </g:HorizontalPanel>",
       "</ui:UiBinder>");
   refresh();
   WidgetInfo button = getObjectByName("button");
   // get "Cell" property
   {
     Property cellProperty = button.getPropertyByTitle("Cell");
     assertNotNull(cellProperty);
     assertTrue(cellProperty.getCategory().isSystem());
   }
   // "width"
   {
     Property property = PropertyUtils.getByPath(button, "Cell/width");
     // no value initially
     assertFalse(property.isModified());
     assertEquals(Property.UNKNOWN_VALUE, property.getValue());
     // set value
     property.setValue("100px");
     assertXML(
         "// filler filler filler filler filler",
         "<ui:UiBinder>",
         "  <g:HorizontalPanel>",
         "    <g:Cell width='100px'>",
         "      <g:Button wbp:name='button'/>",
         "    </g:Cell>",
         "  </g:HorizontalPanel>",
         "</ui:UiBinder>");
     // has value
     assertTrue(property.isModified());
     assertEquals("100px", property.getValue());
   }
 }