⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 informationdelegator.java

📁 OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你就能够快速构建用于访问legacy数据库的应用程序与applets。OpenMap提供了允许用户查看和操作地理空间信息的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                    : fudgeString, labelDesignator);        }    }    /**     * Display a message in a pop-up window.     */    public void displayMessage(String title, String message) {        if (Environment.getBoolean(Environment.UseInternalFrames)) {            JOptionPane.showInternalMessageDialog(Environment.getInternalFrameDesktop(),                    message,                    title,                    JOptionPane.INFORMATION_MESSAGE);        } else {            JOptionPane.showMessageDialog(null,                    message,                    title,                    JOptionPane.INFORMATION_MESSAGE);        }    }    // /////////////////////////////////////////    // InfoDisplayListener interface    /**     * Handle layer requests to have a URL displayed in a Browser.     *      * @param event InfoDisplayEvent     */    public void requestURL(InfoDisplayEvent event) {        displayURL(event.getInformation());    }    /**     * Handle layer requests to have a message displayed in a dialog window.     *      * @param event InfoDisplayEvent     */    public void requestMessage(InfoDisplayEvent event) {        Layer l = event.getLayer();        String layername = (l == null) ? null : l.getName();        displayMessage("Message from " + layername + " layer:",                event.getInformation());    }    /**     * Handle layer requests to have an information line displayed in an     * application status window.     *      * @param event InfoDisplayEvent     */    public void requestInfoLine(InfoDisplayEvent event) {        displayInfoLine(event.getInformation(), event.getPreferredLocation());    }    /**     * Handle layer requests that plain text or html text be displayed in a     * browser.     *      * @param event InfoDisplayEvent     */    public void requestBrowserContent(InfoDisplayEvent event) {        displayBrowserContent(event.getInformation());    }    /**     * If a tooltip is required over a spot on the map then a     * <code>MouseMapListener</code> should pass a MouseEvent to this method.     * The Swing ToolTipManager is used to achieve this. A call to this method     * should always be followed by a call to <code>hideToolTip</code>     *      * @param me A MouseEvent from a <code>MapMouseListener</code> which     *        indicates where the tooltip is to appear (unused)     * @param event an event containing the ToolTip to show     * @deprecated use requestShowToolTip(InfoDisplayEvent) instead.     */    public void requestShowToolTip(MouseEvent me, InfoDisplayEvent event) {        requestShowToolTip(event);    }    /**     * If a tooltip is required over a spot on the map then a     * <code>MouseMapListener</code> should pass a MouseEvent to this method.     * The Swing ToolTipManager is used to achieve this. A call to this method     * should always be followed by a call to <code>hideToolTip</code>     *      * @param event an event containing the ToolTip to show     */    public void requestShowToolTip(InfoDisplayEvent event) {        // shows a tooltip over the map        if (map != null) {            if (ttmanager == null) {                initToolTip();            }            map.setToolTipText(event.getInformation());        }    }    /**     * This method should follow a call to showToolTip in order to indicate that     * the tooltip should no longer be displayed. This method should always     * follow a call to <code>showToolTip</code?     *     * @param me A MouseEvent which passes from a MapMouseListener to     * indicate that a tooltip should disappear      * @deprecated call requestHideToolTip() instead.     */    public void requestHideToolTip(MouseEvent me) {        requestHideToolTip();    }    /**     * This method should follow a call to showToolTip in order to indicate that     * the tooltip should no longer be displayed. This method should always     * follow a call to <code>showToolTip</code?     */    public void requestHideToolTip() {        initToolTip();    }    /**     * This method should be called to intialize the tooltip status so that an     * old tooltip doesn't remain when a layer starts listening to mouse events.     */    public void initToolTip() {        if (ttmanager == null) {            // make sure the MapBean is registered first            ttmanager = ToolTipManager.sharedInstance();            ttmanager.registerComponent(map);            ttmanager.setEnabled(true);            return;        }        // If it already exists, clear out the current tip        if (map != null) {            map.setToolTipText(null);        }    }    /**     * Change the cursor for the MapBean. If the MapBean hasn't been set, then     * nothing will happen on the screen. If a null value is passed in, the     * cursor is reset to the MouseMode value. If the InformationDelegator is     * alowed to show the wait cursor, and the layers are busy, the wait cursor     * will take precidence. The requested cursor from a layer will be set if     * the layers finish.     *      * @param cursor java.awt.Cursor to change the cursor to.     */    public void requestCursor(java.awt.Cursor cursor) {        // This is interpreted as a release from a requester        if (cursor == null) {            // If we're not supposed to be showing the wait cursor...            if (showWaitCursor && !waitingForLayers)                resetCursor();            // Set this to null, so that when we're done waiting for            // the layers, we'll just reset.            currentMapBeanCursor = null;        } else if (this.map != null) {            Cursor newCursor;            // If we're supposed to be showing the watch, do it, but            // save the request for when the layers are done.            if (showWaitCursor && waitingForLayers) {                newCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);                currentMapBeanCursor = cursor;            } else                newCursor = cursor;            map.setCursor(newCursor);        }    }    /**     * Set the cursor to use when the waiting is done, if a layer hasn't asked     * for one to be displayed. For the MouseMode changes, this is automatically     * called.     */    public void setResetCursor(java.awt.Cursor cursor) {        fallbackMapBeanCursor = cursor;    }    /**     * Sets the cursor over the mapbean to the assigned default, or whatever has     * been set by the MouseMode.     */    public void resetCursor() {        if (this.map != null)            map.setCursor(fallbackMapBeanCursor);    }    /**     * If the value passed in is true, the cursor over the MapBean will be the     * waiting cursor layers are off working. The status lights will work, too,     * no matter what the value is. If false, the cursor won't change if the     * layers are working.     */    public void setShowWaitCursor(boolean value) {        showWaitCursor = value;    }    /**     * Returns whether the wait cursor will be shown if the layers are working.     */    public boolean isShowWaitCursor() {        return showWaitCursor;    }    // ////////// MapHandlerChild methods overridden from    // OMComponentPanel    /**     * Called when an object has been added to the BeanContext. The     * InformationDelegator will look for certain objects it needs.     */    public void findAndInit(Object someObj) {        if (someObj instanceof MapBean) {            setMap((MapBean) someObj);        }        if (someObj instanceof MouseDelegator) {            MouseDelegator md = (MouseDelegator) someObj;            md.addPropertyChangeListener(this);        }        statusBar.findAndInit(someObj);    }    /**     * Called when an object is being removed from the BeanContext. Will cause     * the object to be disconnected from the InformationDelegator if it is     * being used.     */    public void findAndUndo(Object someObj) {        if (someObj instanceof MapBean) {            setMap(null);        }        if (someObj instanceof MouseDelegator) {            MouseDelegator md = (MouseDelegator) someObj;            md.removePropertyChangeListener(this);        }        statusBar.findAndUndo(someObj);    }    // ///// PropertyConsumer methods overridden from OMComponentPanel    public void setProperties(String prefix, Properties props) {        setPropertyPrefix(prefix);        prefix = PropUtils.getScopedPropertyPrefix(prefix);        statusBar.setProperties(prefix, props);        setShowLights(PropUtils.booleanFromProperties(props, prefix                + ShowLightsProperty, showLights));        setShowInfoLine(PropUtils.booleanFromProperties(props, prefix                + ShowInfoLineProperty, getShowInfoLine()));        setShowCoordsInfoLine(PropUtils.booleanFromProperties(props, prefix                + ShowCoordsInfoLineProperty, getShowCoordsInfoLine()));        String pl = props.getProperty(prefix + PreferredLocationProperty);        if (pl != null) {            setPreferredLocation(pl);        }    }    public Properties getProperties(Properties props) {        if (props == null) {            props = new Properties();        }        statusBar.getProperties(props);        String prefix = PropUtils.getScopedPropertyPrefix(this);        props.put(prefix + ShowLightsProperty,                new Boolean(showLights).toString());        props.put(prefix + ShowInfoLineProperty,                new Boolean(getShowInfoLine()).toString());        props.put(prefix + ShowCoordsInfoLineProperty,                new Boolean(getShowCoordsInfoLine()).toString());        props.put(prefix + PreferredLocationProperty, getPreferredLocation());        return props;    }    public Properties getPropertyInfo(Properties props) {        if (props == null) {            props = new Properties();        }        statusBar.getPropertyInfo(props);        PropUtils.setI18NPropertyInfo(i18n,                props,                InformationDelegator.class,                ShowLightsProperty,                "Show Layer Status",                "Show the layer status lights.",                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        PropUtils.setI18NPropertyInfo(i18n,                props,                InformationDelegator.class,                ShowInfoLineProperty,                "Show Map Information",                "Show the text line containing map object information.",                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        PropUtils.setI18NPropertyInfo(i18n,                props,                InformationDelegator.class,                ShowCoordsInfoLineProperty,                "Show Coordinate Information",                "Show the text line containing coordinate information.",                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        PropUtils.setI18NPropertyInfo(i18n,                props,                InformationDelegator.class,                PreferredLocationProperty,                "Preferred Location",                "Set the preferred location of the information lines (default under the map).", null);        return props;    }    // ///// Setters and Getters    public void setInfoLineHolder(JLabel ilh) {        infoLineHolder = ilh;    }    public JLabel getInfoLineHolder() {        return infoLineHolder;    }    public void setProgressBar(JProgressBar progressBar) {        this.progressBar = progressBar;    }    public JProgressBar getProgressBar() {        return progressBar;    }    public void setShowLights(boolean set) {        showLights = set;        statusBar.setVisible(set);    }    public boolean getShowLights() {        return showLights;    }    /**     * This only holds if the MAP_OBJECT_INFO_LINE has been created.     *      * @param set sets the visibility of the information line for map object     *        information.     */    public void setShowInfoLine(boolean set) {        if (infoLineHolder2 != null) {            infoLineHolder2.setVisible(set);        }    }    public boolean getShowInfoLine() {        boolean ret = true;        if (infoLineHolder2 != null) {            ret = infoLineHolder2.isVisible();        }        return ret;    }    /**     * This only holds if the COORDINATE_INFO_LINE has been created.     *      * @param set sets the visibility of the information line for coordinate     *        information.     */    public void setShowCoordsInfoLine(boolean set) {        if (infoLineHolder != null) {            infoLineHolder.setVisible(set);        }    }    public boolean getShowCoordsInfoLine() {        boolean ret = true;        if (infoLineHolder != null) {            ret = infoLineHolder.isVisible();        }        return ret;    }    public void setLightTriggers(boolean set) {        statusBar.setLightTriggers(set);    }    public boolean getLightTriggers() {        return statusBar.getLightTriggers();    }    public void setFloatable(boolean value) {}    /**     * BorderLayout.SOUTH by default for this class.     */    protected String preferredLocation = java.awt.BorderLayout.SOUTH;    /**     * MapPanelChild method.     */    public void setPreferredLocation(String value) {        preferredLocation = value;    }    /**     * MapPanelChild method.     */    public String getPreferredLocation() {        return preferredLocation;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -