/** * Removes the user-specific component model if this component is in its default state. */ protected void tidyUpUIContext() { if (isDefaultState()) { removeComponentModel(); } }
/** * Test removeAttribute - where there is no model. */ @Test public void testRemoveAttributeSharedModel() { final String key1 = "ABC"; final String testData1 = "ABCDEFGHJ"; AbstractWComponent comp = new SimpleComponent(); comp.setLocked(true); setActiveContext(createUIContext()); comp.setAttribute(key1, testData1); Assert.assertEquals("should return testData1", testData1, comp.getAttribute(key1)); comp.removeComponentModel(); Serializable result = comp.removeAttribute(key1); Assert.assertNull("should return null - shared model", result); Assert.assertNull("should not return testData1 - no model", comp.getAttribute(key1)); }
this.removeComponentModel(); uic.clearScratchMap(this); uic.clearRequestScratchMap(this);