📄 openmapframe.java
字号:
} } /** * BeanContextMembership interface method. Called when objects are * added to the BeanContext. * * @param bcme contains an Iterator that lets you go through the * new objects. */ public void childrenAdded(BeanContextMembershipEvent bcme) { findAndInit(bcme.iterator()); } /** * BeanContextMembership interface method. Called by BeanContext * when children are being removed. Unhooks itself from the * objects that are being removed if they are contained within the * Frame. * * @param bcme event that contains an Iterator to use to go * through the removed objects. */ public void childrenRemoved(BeanContextMembershipEvent bcme) { Iterator it = bcme.iterator(); while (it.hasNext()) { findAndUndo(it.next()); } } /** * Called when an object is removed from the MapHandler. */ public void findAndUndo(Object someObj) { if (someObj instanceof MapPanel && someObj instanceof Container) { Debug.message("basic", "OpenMapFrame: MapBean is being removed from frame"); getContentPane().remove((Container) someObj); if (getJMenuBar() == ((MapPanel) someObj).getMapMenuBar()) { Debug.message("basic", "OpenMapFrame: Menu Bar is being removed"); setJMenuBar(null); } } if (someObj instanceof JMenuBar) { if (getJMenuBar() == (JMenuBar) someObj) { Debug.message("basic", "OpenMapFrame: Menu Bar is being removed"); setJMenuBar(null); } } } /** Method for BeanContextChild interface. */ public BeanContext getBeanContext() { return beanContextChildSupport.getBeanContext(); } /** * Method for BeanContextChild interface. * * @param in_bc The context to which this object is being added */ public void setBeanContext(BeanContext in_bc) throws PropertyVetoException { if (in_bc != null) { in_bc.addBeanContextMembershipListener(this); beanContextChildSupport.setBeanContext(in_bc); findAndInit(in_bc.iterator()); } } /** Method for BeanContextChild interface. */ public void addVetoableChangeListener(String propertyName, VetoableChangeListener in_vcl) { beanContextChildSupport.addVetoableChangeListener(propertyName, in_vcl); } /** Method for BeanContextChild interface. */ public void removeVetoableChangeListener(String propertyName, VetoableChangeListener in_vcl) { beanContextChildSupport.removeVetoableChangeListener(propertyName, in_vcl); } // Implementation of PropertyConsumer Interface /** * Method to set the properties in the PropertyConsumer. It is * assumed that the properties do not have a prefix associated * with them, or that the prefix has already been set. * * @param setList a properties object that the PropertyConsumer * can use to retrieve expected properties it can use for * configuration. */ public void setProperties(Properties setList) { setProperties(null, setList); } /** * Method to set the properties in the PropertyConsumer. The * prefix is a string that should be prepended to each property * key (in addition to a separating '.') in order for the * PropertyConsumer to uniquely identify properies meant for it, * in the midst of of Properties meant for several objects. * * @param prefix a String used by the PropertyConsumer to prepend * to each property value it wants to look up - * setList.getProperty(prefix.propertyKey). If the prefix * had already been set, then the prefix passed in should * replace that previous value. * @param setList a Properties object that the PropertyConsumer * can use to retrieve expected properties it can use for * configuration. */ public void setProperties(String prefix, Properties setList) { if (useAsInternalFrameRootPaneIfNecessary) { boolean useInternalFrames = PropUtils.booleanFromProperties(setList, Environment.UseInternalFrames, false); if (useInternalFrames && Environment.getInternalFrameDesktop() == null) { if (Debug.debugging("windows")) { Debug.output("Setting OpenMapFrame as internal pane."); } Environment.useInternalFrames(getRootPane()); } } } /** * Method to fill in a Properties object, reflecting the current * values of the PropertyConsumer. If the PropertyConsumer has a * prefix set, the property keys should have that prefix plus a * separating '.' prepended to each propery key it uses for * configuration. * * @param getList a Properties object to load the PropertyConsumer * properties into. If getList equals null, then a new * Properties object should be created. * @return Properties object containing PropertyConsumer property * values. If getList was not null, this should equal * getList. Otherwise, it should be the Properties object * created by the PropertyConsumer. */ public Properties getProperties(Properties getList) { if (getList == null) { getList = new Properties(); } getList.setProperty(xProperty, "" + getBounds().x); getList.setProperty(yProperty, "" + getBounds().y); getList.setProperty(Environment.Width, Integer.toString(getWidth())); getList.setProperty(Environment.Height, Integer.toString(getHeight())); return getList; } /** * Method to fill in a Properties object with values reflecting * the properties able to be set on this PropertyConsumer. The key * for each property should be the raw property name (without a * prefix) with a value that is a String that describes what the * property key represents, along with any other information about * the property that would be helpful (range, default value, * etc.). * * @param list a Properties object to load the PropertyConsumer * properties into. If getList equals null, then a new * Properties object should be created. * @return Properties object containing PropertyConsumer property * values. If getList was not null, this should equal * getList. Otherwise, it should be the Properties object * created by the PropertyConsumer. */ public Properties getPropertyInfo(Properties list) { if (list == null) { list = new Properties(); } list.setProperty("x", "Starting X coordinate of window"); list.setProperty("y", "Starting Y coordinate of window"); return list; } /** * Doesn't do anything. The OpenMapFrame looks for properties set * with the "openmap" property prefix. This method is part of the * PropertyConsumer interface. * * @param prefix the prefix String. */ public void setPropertyPrefix(String prefix) {} /** * Get the property key prefix that is being used to prepend to * the property keys for Properties lookups. Returns "openmap". * * @return the property prefix for the frame */ public String getPropertyPrefix() { return Environment.OpenMapPrefix; } public void setUseAsInternalFrameRootPaneIfNecessary(boolean val) { useAsInternalFrameRootPaneIfNecessary = true; } public boolean getUseAsInternalFrameRootPaneIfNecessary() { return useAsInternalFrameRootPaneIfNecessary; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -