View Javadoc
1 /* 2 * ==================================================================== 3 * 4 * This code is subject to the freebxml License, Version 1.1 5 * 6 * Copyright (c) 2003 freebxml.org. All rights reserved. 7 * 8 * ==================================================================== 9 */ 10 package com.sun.xml.registry.client.browser.swing; 11 12 import java.util.Observable; 13 14 import javax.xml.registry.JAXRException; 15 16 /*** 17 * Implements a few commonly used methods in a MappedModel. Uses the strategy 18 * design pattern. 19 * 20 * @author Fabian Ritzmann 21 */ 22 public abstract class RegistryMappedModel 23 extends Observable implements MappedModel { 24 25 protected String key = null; 26 27 28 /*** 29 * Initializes the object with an initial mapping. 30 * 31 * @param k Key that selects the initial model mapping. 32 */ 33 public RegistryMappedModel(String k) { 34 this.key = k; 35 } 36 37 38 /*** 39 * Sets a new mapping. All observers registered with this model are 40 * notified if the mapping changed. 41 * 42 * @see com.sun.xml.registry.client.browser.swing.MappedModel#setKey(String) 43 * 44 * @param k Key to the new mapping 45 */ 46 public void setKey(String k) { 47 if (! k.equals(this.key)) { 48 this.key = k; 49 setChanged(); 50 notifyObservers(); 51 } 52 53 } 54 55 /*** 56 * Derived classes need to implement the interface method. 57 * 58 * @see com.sun.xml.registry.client.browser.swing.Model#validate() 59 */ 60 public abstract void validate() throws JAXRException; 61 62 }

This page was automatically generated by Maven