ContextMenuAuxTextUI.java
上传用户:zhengdagz
上传日期:2014-03-06
资源大小:1956k
文件大小:4k
源码类别:

xml/soap/webservice

开发平台:

Java

  1. /*
  2.  * $Id: ContextMenuAuxTextUI.java,v 1.4 2005/10/13 08:59:57 kleopatra Exp $
  3.  *
  4.  * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
  5.  * Santa Clara, California 95054, U.S.A. All rights reserved.
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  20.  */
  21. package org.jdesktop.swingx.plaf;
  22. import java.awt.Graphics;
  23. import java.awt.Point;
  24. import java.awt.Rectangle;
  25. import java.awt.event.ActionEvent;
  26. import java.awt.event.MouseAdapter;
  27. import java.awt.event.MouseEvent;
  28. import java.awt.event.MouseListener;
  29. import java.util.HashMap;
  30. import java.util.Map;
  31. import javax.swing.AbstractAction;
  32. import javax.swing.Action;
  33. import javax.swing.ActionMap;
  34. import javax.swing.JComponent;
  35. import javax.swing.JPasswordField;
  36. import javax.swing.JPopupMenu;
  37. import javax.swing.SwingUtilities;
  38. import javax.swing.UIManager;
  39. import javax.swing.plaf.ComponentUI;
  40. import javax.swing.plaf.TextUI;
  41. import javax.swing.text.BadLocationException;
  42. import javax.swing.text.DefaultEditorKit;
  43. import javax.swing.text.EditorKit;
  44. import javax.swing.text.JTextComponent;
  45. import javax.swing.text.View;
  46. import javax.swing.text.Position.Bias;
  47. /**
  48.  * @author Jeanette Winzenburg
  49.  */
  50. public class ContextMenuAuxTextUI extends TextUI {
  51.     private MouseListener mouseHandler;
  52.     public static ComponentUI createUI(JComponent c) {
  53.         return new ContextMenuAuxTextUI(); 
  54.     }
  55.     public void installUI(JComponent comp) {
  56.         comp.addMouseListener(getMouseListener());
  57.     }
  58.     public void uninstallUI(JComponent comp) {
  59.         comp.removeMouseListener(getMouseListener());
  60.     }
  61.     private MouseListener getMouseListener() {
  62.         if (mouseHandler == null) {
  63.             mouseHandler = createPopupHandler();
  64.         }
  65.         return mouseHandler;
  66.     }
  67.     private MouseListener createPopupHandler() {
  68.         return new ContextMenuHandler(createContextSource());
  69.     }
  70.     private ContextMenuSource createContextSource() {
  71.         return new TextContextMenuSource();
  72.     }
  73.     public void update(Graphics g, JComponent c) {
  74.     }
  75.     public Rectangle modelToView(JTextComponent t, int pos)
  76.             throws BadLocationException {
  77.         // TODO Auto-generated method stub
  78.         return null;
  79.     }
  80.     public Rectangle modelToView(JTextComponent t, int pos, Bias bias)
  81.             throws BadLocationException {
  82.         // TODO Auto-generated method stub
  83.         return null;
  84.     }
  85.     public int viewToModel(JTextComponent t, Point pt) {
  86.         // TODO Auto-generated method stub
  87.         return 0;
  88.     }
  89.     public int viewToModel(JTextComponent t, Point pt, Bias[] biasReturn) {
  90.         // TODO Auto-generated method stub
  91.         return 0;
  92.     }
  93.     public int getNextVisualPositionFrom(JTextComponent t, int pos, Bias b,
  94.             int direction, Bias[] biasRet) throws BadLocationException {
  95.         // TODO Auto-generated method stub
  96.         return 0;
  97.     }
  98.     public void damageRange(JTextComponent t, int p0, int p1) {
  99.         // TODO Auto-generated method stub
  100.     }
  101.     public void damageRange(JTextComponent t, int p0, int p1, Bias firstBias,
  102.             Bias secondBias) {
  103.         // TODO Auto-generated method stub
  104.     }
  105.     public EditorKit getEditorKit(JTextComponent t) {
  106.         // TODO Auto-generated method stub
  107.         return null;
  108.     }
  109.     public View getRootView(JTextComponent t) {
  110.         // TODO Auto-generated method stub
  111.         return null;
  112.     }
  113. }