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

📄 abstractmousemode.java

📁 OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你就能够快速构建用于访问legacy数据库的应用程序与applets。OpenMap提供了允许用户查看和操作地理空间信息的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    /**     * Invoked when the mouse has been clicked on a component. Calls     * fireMapMouseClicked on MouseSupport.     *      * @param e MouseEvent     */    public void mouseClicked(MouseEvent e) {        mouseSupport.fireMapMouseClicked(e);    }    /**     * Invoked when a mouse button has been pressed on a component. Calls     * fiewMapMousePressed on the MouseSupport. Also requests focus on the     * source of the MouseEvent, so that key events can be processed.     *      * @param e MouseEvent     */    public void mousePressed(MouseEvent e) {        e.getComponent().requestFocus();        mouseSupport.fireMapMousePressed(e);    }    /**     * Invoked when a mouse button has been released on a component. Calls     * fireMapMouseReleased on the MouseSupport.     *      * @param e MouseEvent     */    public void mouseReleased(MouseEvent e) {        mouseSupport.fireMapMouseReleased(e);    }    /**     * Invoked when the mouse enters a component. Calls fireMapMouseEntered on     * the MouseSupport.     *      * @param e MouseEvent     */    public void mouseEntered(MouseEvent e) {        mouseSupport.fireMapMouseEntered(e);    }    /**     * Invoked when the mouse exits a component. This does nothing. Extend this     * class to add functionality.     *      * @param e MouseEvent     */    public void mouseExited(MouseEvent e) {        mouseSupport.fireMapMouseExited(e);    }    /**     * Invoked when a mouse button is pressed on a component and then dragged.     * Calls fireMapMouseDragged on the MouseSupport.     *      * @param e MouseEvent     */    public void mouseDragged(MouseEvent e) {        mouseSupport.fireMapMouseDragged(e);    }    /**     * Invoked when the mouse button has been moved on a component (with no     * buttons no down). Calls fireMapMouseMoved on the MouseSupport.     *      * @param e MouseEvent     */    public void mouseMoved(MouseEvent e) {        mouseSupport.fireMapMouseMoved(e);    }    /**     * Invoked from the MouseWheelListener interface.     */    public void mouseWheelMoved(MouseWheelEvent e) {        int rot = e.getWheelRotation();        if (e.getSource() instanceof MapBean) {            MapBean mb = (MapBean) e.getSource();            if (rot > 0) {                // Positive, zoom out                mb.zoom(new ZoomEvent(mb, ZoomEvent.RELATIVE, 1.1f));            } else {                mb.zoom(new ZoomEvent(mb, ZoomEvent.RELATIVE, .9f));            }        }    }    /**     * Part of the MapMouseMode interface. Called when the MouseMode is made     * active or inactive.     *      * @param active true if the mode has been made active, false if it has been     *        made inactive.     */    public void setActive(boolean active) {}    /**     * Set a MouseSupport explicitly.     *      * @param support The new MapMouseSupport instance     */    public void setMouseSupport(MapMouseSupport support) {        mouseSupport = support;    }    /**     * Get the MouseSupport.     *      * @return the MapMouseSupport used by the MouseMode.     */    public MapMouseSupport getMouseSupport() {        return mouseSupport;    }    /**     * Method to let the MouseDelegator know if the MapMouseMode should be     * visible, as opposed to a MapMouseMode that is being provided and     * controlled by another tool. True by default.     */    public boolean isVisible() {        return visible;    }    /**     * Method to set if the MapMouseMode should be visible, as opposed to a     * MapMouseMode that is being provided and controlled by another tool.     */    public void setVisible(boolean value) {        visible = value;    }    /**     * Request to have the parent MapMouseMode act as a proxy for a MapMouseMode     * that wants to remain hidden. Can be useful for directing events to one     * object. This version sets the proxy distribution mask to zero, which     * means that none of this support objects targets will be notified of     * events.     *      * @param mmm the hidden MapMouseMode for this MapMouseMode to send events     *        to.     * @return true if the proxy setup (essentially a lock) is successful, false     *         if the proxy is already set up for another listener.     */    public boolean actAsProxyFor(MapMouseMode mmm) {        return actAsProxyFor(mmm, 0);    }    /**     * Request to have the MapMouseMode act as a proxy for a MapMouseMode that     * wants to remain hidden. Can be useful for directing events to one object.     *      * @param mmm the hidden MapMouseMode for this MapMouseMode to send events     *        to.     * @param pdm the proxy distribution mask to use, which lets this support     *        object notify its targets of events if the parent is acting as a     *        proxy.     * @return true if the proxy setup (essentially a lock) is successful, false     *         if the proxy is already set up for another listener.     */    public boolean actAsProxyFor(MapMouseMode mmm, int pdm) {        return mouseSupport.setProxyFor(mmm, pdm);    }    /**     * Can check if the MapMouseMode is acting as a proxy for another     * MapMouseMode.     */    public boolean isProxyFor(MapMouseMode mmm) {        return mouseSupport.isProxyFor(mmm);    }    /**     * Release the proxy lock on the MapMouseMode.     */    public void releaseProxy() {        mouseSupport.releaseProxy();    }    /**     * Set the mask that dictates which events get sent to this support object's     * targets even if the parent mouse mode is acting as a proxy.     */    public void setProxyDistributionMask(int mask) {        mouseSupport.setProxyDistributionMask(mask);    }    /**     * Get the mask that dictates which events get sent to this support object's     * targets even if the parent mouse mode is acting as a proxy.     */    public int getProxyDistributionMask() {        return mouseSupport.getProxyDistributionMask();    }    public void setProperties(String prefix, Properties props) {        super.setProperties(prefix, props);        prefix = PropUtils.getScopedPropertyPrefix(prefix);        String prettyNameString = props.getProperty(prefix + PrettyNameProperty);        if (prettyNameString != null) {            setPrettyName(prettyNameString);        }        String idString = props.getProperty(prefix + IDProperty);        if (idString != null) {            setID(idString);        }        setModeCursor(props.getProperty(prefix + CursorIDProperty));        String iconString = props.getProperty(prefix + IconProperty);        if (iconString != null) {            setIconName(iconString);        }        zoomWhenMouseWheelUp = PropUtils.booleanFromProperties(props, prefix                + MouseWheelZoomProperty, zoomWhenMouseWheelUp);        String zwmwu = props.getProperty(prefix + MouseWheelZoomProperty);        if (zwmwu != null) {            try {                boolean zSetting = getClass().getField(zwmwu).getBoolean(null);                setZoomWhenMouseWheelUp(zSetting);            } catch (NoSuchFieldException nsfe) {            } catch (IllegalAccessException iae) {            }        }    }    public Properties getProperties(Properties props) {        props = super.getProperties(props);        String prefix = PropUtils.getScopedPropertyPrefix(this);        if (prettyName != null) {            props.put(prefix + PrettyNameProperty, prettyName);        }        props.put(prefix + IDProperty, getID());        int cursorType = getModeCursor().getType();        Field[] cFields = Cursor.class.getFields();        for (int i = 0; i < cFields.length; i++) {            Field f = cFields[i];            String name = f.getName();            if (name.endsWith("_CURSOR")) {                try {                    int testType = f.getInt(null);                    if (testType == cursorType) {                        props.put(prefix + CursorIDProperty, name);                        break;                    }                } catch (IllegalArgumentException e) {                } catch (IllegalAccessException e) {                }            }        }        if (zoomWhenMouseWheelUp) {            props.put(prefix + MouseWheelZoomProperty, "ZOOM_IN");        } else {            props.put(prefix + MouseWheelZoomProperty, "ZOOM_OUT");        }        props.put(prefix +IconProperty, PropUtils.unnull(getIconName()));                return props;    }    public Properties getPropertyInfo(Properties props) {        props = super.getPropertyInfo(props);        Class thisClass = getClass();        String internString = i18n.get(thisClass,                PrettyNameProperty,                I18n.TOOLTIP,                "Presentable name for Mouse Mode.");        props.put(Layer.AddToBeanContextProperty, internString);        internString = i18n.get(thisClass, PrettyNameProperty, "Name");        props.put(PrettyNameProperty + LabelEditorProperty, internString);        internString = i18n.get(thisClass,                IDProperty,                I18n.TOOLTIP,                "Internal ID for Mouse Mode, used by Layers.");        props.put(Layer.AddToBeanContextProperty, internString);        internString = i18n.get(thisClass, IDProperty, "ID");        props.put(IDProperty + LabelEditorProperty, internString);        PropUtils.setI18NPropertyInfo(i18n,                props,                thisClass,                IconProperty,                "Icon",                "Icon to use for mouse mode.",                 null);                PropUtils.setI18NPropertyInfo(i18n,                props,                thisClass,                MouseWheelZoomProperty,                "Mouse Wheel Zoom",                "Action to take when the mouse wheel is rolled up.",                "com.bbn.openmap.util.propertyEditor.ComboBoxPropertyEditor");        props.put(MouseWheelZoomProperty                + OptionPropertyEditor.ScopedOptionsProperty, "zoomin  zoomout");        props.put(MouseWheelZoomProperty + ".zoomin", "ZOOM_IN");        props.put(MouseWheelZoomProperty + ".zoomout", "ZOOM_OUT");        PropUtils.setI18NPropertyInfo(i18n,                props,                thisClass,                CursorIDProperty,                "Cursor",                "Cursor to use for this mouse mode.",                "com.bbn.openmap.util.propertyEditor.ComboBoxPropertyEditor");        StringBuffer cOptions = new StringBuffer();        Field[] cFields = Cursor.class.getFields();        for (int i = 0; i < cFields.length; i++) {            Field f = cFields[i];            String name = f.getName();            if (name.endsWith("_CURSOR")) {                String cName = f.getName();                props.put(CursorIDProperty + "." + cName, cName);                cOptions.append(" " + cName);            }        }        props.put(CursorIDProperty + OptionPropertyEditor.ScopedOptionsProperty,                cOptions.toString().trim());        return props;    }    /**     * PaintListener interface, notifying the MouseMode that the MapBean has     * repainted itself. Useful if the MouseMode is drawing stuff.     */    public void listenerPaint(java.awt.Graphics g) {}    public static class MouseWheelZoomEditor {        public MouseWheelZoomEditor() {        }    }}

⌨️ 快捷键说明

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