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.awt.event.ActionEvent; 13 import java.awt.event.ActionListener; 14 15 import javax.swing.JComboBox; 16 17 /*** 18 * Listens on a ComboBox and sets a new key in the MappedModel if a 19 * value was selected. 20 * 21 * @author Fabian Ritzmann 22 */ 23 public class RegistryComboBoxListener implements ActionListener { 24 25 private final MappedModel model; 26 private final MappedPanel panel; 27 28 /*** 29 * Initializes the object. 30 * 31 * @param m A MappedModel on which this controller operates 32 * @param p A MappedPanel that displays the MappedModel 33 */ 34 public RegistryComboBoxListener(MappedModel m, MappedPanel p) { 35 this.model = m; 36 this.panel = p; 37 } 38 39 /*** 40 * Retrieves the selected value from the ComboBox, tells the panel that 41 * the mapping is changing and sets the new key in the model. 42 * 43 * @see java.awt.event.ActionListener#actionPerformed(ActionEvent) 44 */ 45 public void actionPerformed(ActionEvent e) { 46 JComboBox cb = (JComboBox) e.getSource(); 47 String text = (String) cb.getSelectedItem(); 48 this.panel.setMappingIsChanging(true); 49 this.model.setKey(text); 50 this.panel.setMappingIsChanging(false); 51 } 52 53 }

This page was automatically generated by Maven