1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.webkit.plugin;
  27 
  28 import java.io.IOError;
  29 import java.net.URL;
  30 
  31 import com.sun.webkit.graphics.WCGraphicsContext;
  32 
  33 
  34 final class DefaultPlugin implements Plugin {
  35 
  36     //private JLabel nullComp;
  37 
  38     private void init(final String pluginDetails) {
  39         //nullComp = new JLabel(pluginDetails);
  40         //nullComp.setHorizontalAlignment(JLabel.CENTER);
  41         //nullComp.setVisible(true);
  42     }
  43 
  44     DefaultPlugin(URL url, String type, String[] pNames, String[] pValues) {
  45         init("Default Plugin for: " + (null==url ? "(null)" : url.toExternalForm()));
  46     }
  47 
  48     @Override
  49     public void paint(WCGraphicsContext g, int intX, int intY, int intWidth, int intHeight)
  50     {
  51         //if(g instanceof  WCGraphics2DContext){
  52             //nullComp.paint( ((WCGraphics2DContext)g).getImageGraphics() );
  53         //}
  54         g.fillRect(x, y, w, h, 0x11aaffff);
  55     }
  56 
  57     public void activate(Object nativeContainer, PluginListener pl) {}
  58 
  59     public void destroy() {}
  60 
  61     public void setVisible(boolean isVisible) {}
  62 
  63     public void setEnabled(boolean enabled) {}
  64 
  65     private int x = 0;
  66     private int y = 0;
  67     private int w = 0;
  68     private int h = 0;
  69     public void setBounds(int x, int y, int width, int height) {
  70         this.x = x;
  71         this.y = y;
  72         this.w = width;
  73         this.h = height;
  74         //nullComp.setBounds(new Rectangle(x, y, width, height) ) ;
  75     }
  76 
  77     public Object invoke(String subObjectId, String methodName, Object[] args) throws IOError {
  78         return null;
  79     }
  80 
  81     public boolean handleMouseEvent(
  82             String type,
  83             int offsetX,
  84             int offsetY,
  85             int screenX,
  86             int screenY,
  87             int button,
  88             boolean buttonDown,
  89             boolean altKey,
  90             boolean metaKey,
  91             boolean ctrlKey,
  92             boolean shiftKey,
  93             long timeStamp)
  94     {
  95         return false;
  96     }
  97 
  98     public void requestFocus() {}
  99 
 100     public void setNativeContainerBounds(int x, int y, int width, int height) {}
 101 }
 102