List of usage examples for java.beans EventHandler create
public static <T> T create(Class<T> listenerInterface, Object target, String action, String eventPropertyName)
From source file:org.orbisgis.mapeditor.map.MapEditor.java
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC) public void addResultSetProviderFactory(ResultSetProviderFactory resultSetProviderFactory) { Action rsAction = new DefaultAction("RSF_" + resultSetProviderFactory.getName(), resultSetProviderFactory.getName(), null, EventHandler.create(ActionListener.class, this, "onChangeRendererData", "")).setMenuGroup(true) .setParent(MapEditorAction.A_DATA_PROVIDERS) .setButtonGroup(MapEditorAction.TOGGLE_GROUP_DATA_PROVIDERS); rsFactories.put(resultSetProviderFactory, rsAction); actions.addAction(rsAction);//w w w . j a va 2 s . c o m }
From source file:org.orbisgis.mapeditor.map.MapEditor.java
/** * Notifies this component that it now has a parent component. When this * method is invoked, the chain of parent components is set up with * KeyboardAction event listeners.// w w w .j av a2 s . c om */ @Override public void addNotify() { super.addNotify(); if (!initialised.getAndSet(true)) { addComponentListener(sizeListener); // Read the default map context file initMapContext(); //Register listener dragDropHandler.getTransferEditableEvent().addListener(this, EventHandler.create(EditableTransferListener.class, this, "onDropEditable", "editableList")); mapControl.addMouseMotionListener( EventHandler.create(MouseMotionListener.class, this, "onMouseMove", "point", "mouseMoved")); mapStatusBar.addVetoableChangeListener(MapStatusBar.PROP_USER_DEFINED_SCALE_DENOMINATOR, EventHandler.create(VetoableChangeListener.class, this, "onUserSetScaleDenominator", "")); // When the tree is expanded update the manager size mapsManager.getTree().addComponentListener(sizeListener); mapsManager.getTree().addTreeExpansionListener( EventHandler.create(TreeExpansionListener.class, this, "updateMapControlSize")); } }
From source file:org.orbisgis.view.geocatalog.Catalog.java
/** * Default constructor//w w w . ja v a 2s. c o m */ public Catalog() { super(new BorderLayout()); dockingParameters.setName("geocatalog"); dockingParameters.setTitle(I18N.tr("GeoCatalog")); dockingParameters.setTitleIcon(OrbisGISIcon.getIcon("geocatalog")); dockingParameters.setCloseable(true); //Add the Source List in a Scroll Pane, //then add the scroll pane in this panel add(new JScrollPane(makeSourceList()), BorderLayout.CENTER); //Init the filter factory manager filterFactoryManager = new FilterFactoryManager<IFilter, DefaultActiveFilter>(); //Set the factory that must be shown when the user click on add filter button filterFactoryManager.setDefaultFilterFactory(DEFAULT_FILTER_FACTORY); //Set listener on filter change event, this event will update the filters FilterFactoryManager.FilterChangeListener refreshFilterListener = EventHandler.create( FilterFactoryManager.FilterChangeListener.class, sourceListContent, //target of event "setFilters", //target method "source.getFilters" //target method argument ); filterFactoryManager.getEventFilterChange().addListener(sourceListContent, refreshFilterListener); filterFactoryManager.getEventFilterFactoryChange().addListener(sourceListContent, refreshFilterListener); //Add the filter list at the top of the geocatalog add(filterFactoryManager.makeFilterPanel(false), BorderLayout.NORTH); //Create an action to add a new filter dockingActions.addAction(new DefaultAction(GeoCatalogMenu.M_ADD_FILTER, I18N.tr("Add filter"), I18N.tr("Add a new data source filter"), OrbisGISIcon.getIcon("add_filter"), EventHandler.create(ActionListener.class, filterFactoryManager, "onAddFilter"), null)); // Set the built-in actions to docking frame dockingParameters.setDockActions(dockingActions.getActions()); // Add a listener to put additional actions to this docking dockingActions.addPropertyChangeListener(new ActionDockingListener(dockingParameters)); //Add the geocatalog specific filters registerFilterFactories(); // Register built-ins popup actions createPopupActions(); }
From source file:org.orbisgis.view.geocatalog.Catalog.java
/** * Create the Source List ui component/*from w ww . j a v a 2 s .c o m*/ */ private JList makeSourceList() { sourceList = new JList(); //Set the list content renderer sourceList.setCellRenderer(new DataSourceListCellRenderer(sourceList)); //Add mouse listener for popup menu sourceList .addMouseListener(EventHandler.create(MouseListener.class, this, "onMouseActionOnSourceList", "")); //This method ask the event data as argument //Create the list content manager sourceListContent = new SourceListModel(); //Replace the default model by the GeoCatalog model sourceList.setModel(sourceListContent); SourceListTransferHandler transferHandler = new SourceListTransferHandler(); //Call the method this.onDropURI when the user drop uri(like files) on the list control transferHandler.getDropListenerHandler().addListener(this, EventHandler.create(SourceListTransferHandler.DropUriListener.class, this, "onDropURI", "uriList")); sourceList.setTransferHandler(transferHandler); sourceList.setDragEnabled(true); //Attach the content to the DataSource instance sourceListContent.setListeners(); return sourceList; }
From source file:org.orbisgis.view.map.MapEditor.java
/** * Notifies this component that it now has a parent component. When this * method is invoked, the chain of parent components is set up with * KeyboardAction event listeners./*from w ww . j ava 2 s . c om*/ */ @Override public void addNotify() { super.addNotify(); if (!initialised.getAndSet(true)) { addComponentListener(sizeListener); // Read the default map context file initMapContext(); //Register listener dragDropHandler.getTransferEditableEvent().addListener(this, EventHandler.create( MapTransferHandler.EditableTransferListener.class, this, "onDropEditable", "editableList")); mapControl.addMouseMotionListener( EventHandler.create(MouseMotionListener.class, this, "onMouseMove", "point", "mouseMoved")); mapStatusBar.addVetoableChangeListener(MapStatusBar.PROP_USER_DEFINED_SCALE_DENOMINATOR, EventHandler.create(VetoableChangeListener.class, this, "onUserSetScaleDenominator", "")); // When the tree is expanded update the manager size mapsManager.getTree().addComponentListener(sizeListener); mapsManager.getTree().addTreeExpansionListener( EventHandler.create(TreeExpansionListener.class, this, "updateMapControlSize")); } }