Esempio n. 1
0
  /**
   * State values are added to the pathway element model.
   *
   * @param relX
   * @param relY
   * @param width
   * @param height
   * @param color
   * @param lineStyle
   * @param lnThickness
   * @param fillColor
   * @param shapeType
   * @param zOrder
   * @param database
   * @param ID
   * @param bioPaxRefs
   * @param graphId
   * @param graphRef
   * @param textLabel
   * @param stateType
   * @return pwElt
   */
  public static PathwayElement createState(
      double relX,
      double relY,
      double width,
      double height,
      Color color,
      int lineStyle,
      int lnThickness,
      Color fillColor,
      IShape shapeType,
      int zOrder,
      DataSource database,
      String ID,
      List<String> bioPaxRefs,
      String graphId,
      String graphRef,
      String textLabel,
      String stateType) {

    // create pathwayElement State
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.STATE);

    // for better definition of identifier and database
    Xref ref = new Xref(ID, database);

    pwElt.setRelX(relX);
    pwElt.setRelY(relY);
    pwElt.setMWidth(width);
    pwElt.setMHeight(height);
    pwElt.setColor(color);
    pwElt.setLineStyle(lineStyle);
    pwElt.setLineThickness(lnThickness);
    pwElt.setFillColor(fillColor);
    pwElt.setShapeType(shapeType);
    pwElt.setZOrder(zOrder);
    pwElt.setDataSource(ref.getDataSource());
    pwElt.setElementID(ref.getId());
    pwElt.setGraphId(graphId);
    pwElt.setGraphRef(graphRef);
    pwElt.setTextLabel(textLabel);

    if (stateType == "unknown") {
    } else {
    }

    if (bioPaxRefs.size() > 0) {
      for (int i = 0; i < bioPaxRefs.size(); i++) {
        pwElt.addBiopaxRef(bioPaxRefs.get(i));
      }
    }
    return pwElt;
  }
Esempio n. 2
0
 private PathwayElement createPathwayELement(Xref xref) {
   PathwayElement pwe = PathwayElement.createPathwayElement(ObjectType.DATANODE);
   pwe.setDataSource(xref.getDataSource());
   pwe.setElementID(xref.getId());
   pwe.setTextLabel(xref.toString());
   pwe.setTransparent(false);
   pwe.setColor(Color.BLACK);
   pwe.setShapeType(ShapeType.RECTANGLE);
   pwe.setLineStyle(LineStyle.SOLID);
   pwe.setInitialSize();
   pwe.setMWidth(120);
   pwe.setMCenterX(60);
   pwe.setMCenterY((35 * x) + 14);
   return pwe;
 }
Esempio n. 3
0
  /**
   * Updates the bottom part of the {@link RegIntTab} with information about the Xref selected in
   * the top part of RIPTab and its interaction
   *
   * @param xref one of the interaction partners (displayed in the top part of the RIPTAB) of the
   *     Xref selected in the main pathway
   * @param results the results object from updating the top part of the RIPTab by selecting an Xref
   *     in the main pathway
   */
  public void updateBackpagePanel(Xref xref, ResultsObj results) {
    backpagePanel.removeAll();
    backpagePanel.setLayout(new BoxLayout(backpagePanel, BoxLayout.PAGE_AXIS));

    PathwayElement e = PathwayElement.createPathwayElement(ObjectType.DATANODE);
    e.setDataSource(xref.getDataSource());
    e.setElementID(xref.getId());
    BackpageTextProvider bpt = new BackpageTextProvider();

    bpt.addBackpageHook(new BackpageInfo(swingEngine.getGdbManager().getCurrentGdb(), results));
    // TODO: fix file table, doesn't always show files
    bpt.addBackpageHook(new BackpageFileTable(results, plugin));
    bpt.addBackpageHook(new BackpagePMID(results));
    // TODO: change this to use multiple BridgeDb databases?
    bpt.addBackpageHook(
        new BackpageTextProvider.BackpageXrefs(swingEngine.getGdbManager().getCurrentGdb()));
    bpt.addBackpageHook(new BackpageExpression(plugin.getDesktop().getGexManager()));
    bpt.addBackpageHook(new BackpageMiscInfo(results));
    BackpagePane bpp = new BackpagePane(bpt, swingEngine.getEngine());
    bpp.setInput(e);

    bpp.addHyperlinkListener(
        new HyperlinkListener() {

          @Override
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
              try {
                Desktop.getDesktop().browse(e.getURL().toURI());
              } catch (IOException e1) {
                e1.printStackTrace();
              } catch (URISyntaxException e1) {
                e1.printStackTrace();
              }
            }
          }
        });
    backpagePanel.add(bpp);

    backpagePanel.revalidate();
    backpagePanel.repaint();
  }
Esempio n. 4
0
  /**
   * DataNode values are added to the pathway element model.
   *
   * @param centerX
   * @param centerY
   * @param width
   * @param height
   * @param textLabel
   * @param identifier
   * @param source
   * @param dnType
   * @param graphId
   * @param color
   * @param fontSize
   * @param zOrder
   * @param vAlign
   * @param groupRef
   * @param bioPaxRefs
   * @param commentList
   * @return pwElt
   */
  public static PathwayElement createDataNode(
      Double centerX,
      Double centerY,
      Double width,
      Double height,
      String textLabel,
      String identifier,
      DataSource source,
      String dnType,
      String graphId,
      Color color,
      Double fontSize,
      Integer zOrder,
      String vAlign,
      String groupRef,
      List<String> bioPaxRefs,
      List<String> commentList) {

    // create pathwayElement data node
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.DATANODE);

    // for better definition of identifier and database
    Xref ref = new Xref(identifier, source);

    // put variables in element
    if (centerX != null) {
      pwElt.setMCenterX(centerX);
    } else {
      System.out.println("No CenterX for datanode!!");
      throw new EmptyStackException();
    }
    if (centerY != null) {
      pwElt.setMCenterY(centerY);
    } else {
      System.out.println("No centerY for datanode!!");
      throw new EmptyStackException();
    }
    if (width != null) {
      pwElt.setMWidth(width);
    } else {
      System.out.println("No width for datanode!!");
      throw new EmptyStackException();
    }
    if (height != null) {
      pwElt.setMHeight(height);
    } else {
      System.out.println("No height for datanode!!");
      throw new EmptyStackException();
    }
    if (!(textLabel.equals(""))) pwElt.setTextLabel(textLabel);
    else {
      System.out.println("No label name for datanode!!");
      throw new EmptyStackException();
    }
    if (!(ref.getId().isEmpty())) pwElt.setElementID(ref.getId());
    if (ref.getDataSource() != null) pwElt.setDataSource(ref.getDataSource());
    if (dnType != null) pwElt.setDataNodeType(dnType);
    if (!(graphId.equals(""))) {
      pwElt.setGraphId(graphId);
    } else {
      System.out.println("No GraphId for datanode!!");
      throw new EmptyStackException();
    }
    if (color != null) {
      pwElt.setColor(color);
    }
    if (fontSize != null) pwElt.setMFontSize(fontSize);
    if (zOrder != -1) pwElt.setZOrder(zOrder);
    // System.out.println(groupRef);
    // if (!(groupRef.equals(""))) pwElt.setGraphRef(groupRef);

    if (vAlign.toLowerCase() == "middle") {
      pwElt.setValign(ValignType.MIDDLE);
    } else if (vAlign.toLowerCase() == "bottom") {
      pwElt.setValign(ValignType.BOTTOM);
    } else if (vAlign.toLowerCase() == "top") {
      pwElt.setValign(ValignType.TOP);
    } else {
      pwElt.setValign(ValignType.MIDDLE);
    }

    if (bioPaxRefs.size() > 0) {
      for (int i = 0; i < bioPaxRefs.size(); i++) {
        pwElt.addBiopaxRef(bioPaxRefs.get(i));
      }
    }

    if (commentList.size() > 0) {
      for (int i = 0; i < commentList.size(); i += 2) {
        pwElt.addComment(commentList.get(i), commentList.get(i + 1));
      }
    }
    return pwElt;
  }