Package net.wigis.graph

Examples of net.wigis.graph.PaintBean


   * @return String, link
   */
  public String createLinkDk2(String text, String formId, String hiddenButtonId, ArrayList<Tuple<Integer,Integer,DNVEdge>> nodeNedge, HashSet<Integer> uniqueNodes)
  {
 
    PaintBean pb = PaintBean.getCurrentInstance();
    StringBuilder sb = new StringBuilder();
    sb.append( "<a href='#' onclick=\"" ).append("A4J.AJAX.Submit('_viewRoot','" + formId + "',event,{'similarityGroupingId':'" + formId + ":" + hiddenButtonId + "','parameters': {");
   
    int index = 0;
    for(Integer nodeId : uniqueNodes){
      sb.append("'node").append(index).append("':'").append(nodeId).append("',");
      index++;
    }
    index = 0;
    for(Tuple<Integer,Integer,DNVEdge> tuple : nodeNedge){
      sb.append("'edge").append(index).append("':'").append(tuple.getRight().getId()).append("',");
      index++;
    }
    sb.append("'"+formId + ":" + hiddenButtonId + "':'" + formId + ":" + hiddenButtonId).
    append("'},'actionUrl':'" + pb.getContextPath() + "/wigi/WiGiViewerPanel.faces'} );").
    append("\">" + text + "</a>");
   
    return sb.toString();
  }
View Full Code Here


   * @return String, link
   */
  public static String createLinkDk3(String text, String formId, String hiddenButtonId, HashSet<DNVNode> nodes, HashSet<DNVEdge> edges)
  {
 
    PaintBean pb = PaintBean.getCurrentInstance();
    StringBuilder sb = new StringBuilder();
    sb.append( "<a href='#' onclick=\"" ).append("A4J.AJAX.Submit('_viewRoot','" + formId + "',event,{'similarityGroupingId':'" + formId + ":" + hiddenButtonId + "','parameters': {");
    int index = 0;
    for(DNVNode node : nodes){
      sb.append("'node").append(index).append("':'").append(node.getId()).append("',");
      index++;
    }
    index = 0;
    for(DNVEdge edge : edges){
      sb.append("'edge").append(index).append("':'").append(edge.getId()).append("',");
      index++;
    }
    sb.append("'"+formId + ":" + hiddenButtonId + "':'" + formId + ":" + hiddenButtonId).
    append("'},'actionUrl':'" + pb.getContextPath() + "/wigi/WiGiViewerPanel.faces'} );").
    append("\">" + text + "</a>");
 
    return sb.toString();
  }
View Full Code Here

      setSelected( false );
    }
    else
    {
      setSelected( true );
      PaintBean pb = (PaintBean)ContextLookup.lookup( "paintBean", FacesContext.getCurrentInstance() );
      pb.setSelectedNode( this, true );
    }
  }
View Full Code Here

            details.append( "<tr><td>" ).append( key ).append( ":</td><td>" ).append( value ).append( "</td></tr>" );
          }
        }
        else
        {
          PaintBean pb = PaintBean.getCurrentInstance();
          value = "<a href=\"" + pb.getContextPath() + "/wigi/components/viewContents.faces?id=" + id + "\" target=\"_blank\">" + "View contents" + "</a>";
          details.append( "<tr><td>" ).append( key ).append( ":</td><td>" ).append( value ).append( "</td></tr>" );
        }
      }
      details.append( "<tr><td>bbid:</td><td>" ).append( bbId ).append( "</td></tr>" );
      details.append( "<tr><td>type:</td><td>" ).append( type ).append( "</td></tr>" );
      details.append( "</table>" );

      details.append( "<br />" );
      details.append( "<table border=\"1\" cellspacing=\"0\">" );
      details.append( "<tr><td style=\"font-size:large\" colspan=\"2\">Neighbor Nodes:</td></tr>" );

      List<DNVNode> nodes = getNeighbors( true );
      SortByFloatProperty sbfp = new SortByFloatProperty( "year", true );
      Collections.sort( nodes, sbfp );

      for( DNVNode neighbor : nodes )
      {
        value = "";
        if( neighbor.getProperty( "Contents" ) != null )
        {
          PaintBean pb = PaintBean.getCurrentInstance();
          value = "<td><a href=\"" + pb.getContextPath() + "/wigi/components/viewContents.faces?id=" + neighbor.getId() + "\" target=\"_blank\">"
              + neighbor.getLabel() + "</a></td>";
        }
        else
        {
          value = "<td>" + neighbor.getLabel() + "</td>";
View Full Code Here

      graph.removeNode( edges.get( i ) );
    }

    try
    {
      PaintBean pb = (PaintBean)ContextLookup.lookup( "paintBean", FacesContext.getCurrentInstance() );
      if( pb != null )
      {
        pb.forceSubgraphRefresh();
      }
    }
    catch( Exception e )
    {
      e.printStackTrace();
View Full Code Here

          }
        }
      }
      else
      {
        PaintBean pb = PaintBean.getCurrentInstance();
        value = "<a href=\"" + pb.getContextPath() + "/wigi/components/viewContents.faces?id=" + id + "\" target=\"_blank\">" + "View contents" + "</a>";
        key = key.replaceAll( "&", "&amp;" );
        propertiesHtml += "\n\t<tr>\n\t\t<td>" + key + "</td>\n\t\t<td>" + value + "</td>\n\t</tr>";
      }
    }
   
View Full Code Here

        Logger.write( "File must be one of the accepted formats: XML CSV or TUP.  \n\n" );
        throw new Exception();
      }

      FacesContext fc = FacesContext.getCurrentInstance();
      PaintBean p = (PaintBean)ContextLookup.lookup( "paintBean", fc );
      GraphsBean gb = (GraphsBean)ContextLookup.lookup( "graphsBean", fc );
      if( gb != null )
        gb.buildFileList();
      // set the graph value here
      p.setSelectedFile( Settings.GRAPHS_PATH + UPLOAD_FILE_PREFIX + lastFile + ".dnv" );
      // Lay out the graph
      p.runLayout();
      // Save the graph again
      p.saveGraph();

      ec = fc.getExternalContext();
      // redirect to visualizer
      try
      {
        ec.redirect( p.getContextPath() + WIGI_URL );
      }
      catch( IOException e )
      {
        e.printStackTrace();
      }
View Full Code Here

    canvas.showSettingsFrame();
  }

  public static WiGiGUI init() {
    GraphsPathFilter.init();
    PaintBean pb = new PaintBean();
//    pb.setSelectedFile( Settings.GRAPHS_PATH + "UserStudy/testGraphs/graph1large.dnv" );
//    pb.setSelectedFile( Settings.GRAPHS_PATH + "UserStudy/testGraphs/graph1large.dnv" );
    pb.setWhiteSpaceBuffer( 0.14f );
    pb.setDrawNeighborHighlight( true );
    pb.setInterpolationMethodUseWholeGraph( true );
    pb.setScalePositions( true );
    pb.setPlaySound( true );
    JFrame frame = new JFrame( "WiGi - GUI" );
    frame.setSize( 800, 800 );
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    JFrame overviewFrame = new JFrame("Overview");
    WiGiGUIHandler handler = new WiGiGUIHandler( pb, overviewFrame );
    handler.setWiGiDockIcon();
    frame.setIconImage( handler.getWigiIconImage() );
    overviewFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    overviewFrame.setUndecorated( true );
    overviewFrame.setSize( WiGiOverviewPanel.OVERVIEW_SIZE, WiGiOverviewPanel.OVERVIEW_SIZE );
    overviewFrame.setResizable( false );
    overviewFrame.setIconImage( handler.getWigiIconImage() );

    GLCapabilities caps = new GLCapabilities();
    caps.setDoubleBuffered( true );
    caps.setHardwareAccelerated( true );
    WiGiOverviewPanel overviewPanel = new WiGiOverviewPanel( pb );
    overviewFrame.getContentPane().add( overviewPanel );

    caps = new GLCapabilities();
    caps.setDoubleBuffered( true );
    caps.setHardwareAccelerated( true );
    WiGiGUI canvas = new WiGiGUI( caps, pb, frame, overviewFrame, handler );
    overviewPanel.setRenderComponent( canvas );
    canvas.setBounds( 0, 0, pb.getWidthInt(), pb.getHeightInt() );
//    canvas.setDoubleBuffered( true );
    canvas.addMouseListener( canvas );
    canvas.addMouseMotionListener( canvas );
    canvas.addMouseWheelListener( canvas );
    canvas.addKeyListener( canvas );
    canvas.getSettingsFrame().setIconImage( handler.getWigiIconImage() );
   
    frame.addComponentListener( canvas );
    frame.addKeyListener( canvas );
    frame.add( canvas );
//    moveOverview();
   
    // Placing window in the center of the screen
      // Get the size of the screen
      Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
      // Determine the new location of the window
      int w = frame.getSize().width;
      int h = frame.getSize().height;
      int x = (dim.width-w)/2;
      int y = (dim.height-h)/2;
      // Move the window
      frame.setLocation( x, y );
    frame.setVisible( true );
    overviewFrame.setBounds( frame.getX() + frame.getWidth() + 10, frame.getY(), WiGiOverviewPanel.OVERVIEW_SIZE, WiGiOverviewPanel.OVERVIEW_SIZE );
    overviewFrame.setVisible(true);

    pb.setWidth( canvas.getWidth() );
    pb.setHeight( canvas.getHeight() );
                   
    return canvas;
  }
View Full Code Here

TOP

Related Classes of net.wigis.graph.PaintBean

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.