Package org.jvnet.flamingo.common.icon

Examples of org.jvnet.flamingo.common.icon.ResizableIcon


         
    try{
      URL btnIconResourceUrl = getClass().getClassLoader().getResource(
          ActivityLabel.getSVGIconPath(value.getClass()));
     
      ResizableIcon btnSVGIcon = null;
     
      if(btnIconResourceUrl != null) {
        btnSVGIcon = SvgBatikResizableIcon.getSvgIcon(
            btnIconResourceUrl, new Dimension(24, 24));
      }
View Full Code Here


          }
        //}
        URL btnIconResourceUrl = getClass().getClassLoader().getResource(
              ActivityLabel.getSVGIconPath(activityCls));
       
        ResizableIcon btnSVGIcon = null;
       
        if(btnIconResourceUrl != null) {
          btnSVGIcon = SvgBatikResizableIcon.getSvgIcon(btnIconResourceUrl, new Dimension(32, 32));
        }
       
        if(btnSVGIcon == null){  //if there's no SVG icon for requested activity type, try to use the GIF image icon instead.
          ImageIcon activityGifImageIcon = ActivityLabel.getImageIcon(activityCls);
          if(activityGifImageIcon!=null)
            btnSVGIcon = new IconWrapperResizableIcon(activityGifImageIcon);
        }

        if(btnSVGIcon == null){  //if there's no icon even, use default one.
          URL defaultIconResourceUrl = getClass().getClassLoader().getResource(
              ActivityLabel.getSVGIconPath(DefaultActivity.class));
         
          if(defaultIconResourceUrl!=null)
            btnSVGIcon = SvgBatikResizableIcon.getSvgIcon(defaultIconResourceUrl, new Dimension(32, 32));
        }

        if(btnSVGIcon != null) {
          JCommandButton btn = new JCommandButton(name, btnSVGIcon);
          activityTypeNameMap.put(activityCls, name);
          btn.setToolTipText(clsName);
          btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
              ProcessDesigner.this.insertActivity(activityCls);
              ProcessDesigner.this.setDocumentChanged(true);
            }         
          });
         
          DragSource dragSource = DragSource.getDefaultDragSource();
          dragSource.createDefaultDragGestureRecognizer(
            btn, // component where drag originates
            DnDConstants.ACTION_COPY_OR_MOVE, // actions
            new DragGestureListener(){
              /**
               * start of D&D framework implementation
               */
             
              public void dragGestureRecognized(DragGestureEvent e) {
                e.startDrag(DragSource.DefaultCopyDrop, // cursor
                  new Transferable(){

                    public DataFlavor[] getTransferDataFlavors() {
                      // TODO Auto-generated method stub
                      return null;
                    }

                    public boolean isDataFlavorSupported(DataFlavor flavor) {
                      // TODO Auto-generated method stub
                      return false;
                    }

                    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
                      List list = new ArrayList();
                      list.add(activityCls);
                      return list;
                    }
                 
                  })// drag source listener
              }
              public void dragDropEnd(DragSourceDropEvent e) {}
              public void dragEnter(DragSourceDragEvent e) {}
              public void dragExit(DragSourceEvent e) {}
              public void dragOver(DragSourceDragEvent e) {}
              public void dropActionChanged(DragSourceDragEvent e) {}

              /**
               * end of D&D framework implementation
               */
            }
          ); // drag gesture recognizer
         
          if(!activityByBand.containsKey(bandName)){
            URL bandIconResourceUrl = getClass().getClassLoader().getResource(
                ActivityLabel.getSVGIconPath(activityCls, bandIconName));
           
            ResizableIcon bandSVGIcon = null;

            if(bandIconResourceUrl!=null){
              bandSVGIcon = SvgBatikResizableIcon.getSvgIcon(
                  bandIconResourceUrl, new Dimension(25, 25));
            }
View Full Code Here

     *
     * @param icon icon path
     * @return resizable icon
     */
    public static ResizableIcon createResizableIcon(final Icon icon) {
        ResizableIcon resizableIcon = new ResizableIcon() {
            int width = icon.getIconWidth();
            int height = icon.getIconHeight();

            @Override
            public int getIconHeight() {
View Full Code Here

TOP

Related Classes of org.jvnet.flamingo.common.icon.ResizableIcon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.