Package org.fife.ui.rsyntaxtextarea.folding

Examples of org.fife.ui.rsyntaxtextarea.folding.FoldManager$Listener


    Element root = doc.getDefaultRootElement();
    int topPosition = textArea.viewToModel(
                new Point(visibleRect.x,visibleRect.y));
    int topLine = root.getElementIndex(topPosition);
    int cellHeight = textArea.getLineHeight();
    FoldManager fm = ((RSyntaxTextArea)textArea).getFoldManager();

    // Compute the y at which to begin painting text, taking into account
    // that 1 logical line => at least 1 physical line, so it may be that
    // y<0.  The computed y-value is the y-value of the top of the first
    // (possibly) partially-visible view.
    Rectangle visibleEditorRect = ui.getVisibleEditorRect();
    Rectangle r = LineNumberList.getChildViewBounds(v, topLine,
                        visibleEditorRect);
    int y = r.y;
    y += (cellHeight-collapsedFoldIcon.getIconHeight())/2;

    int visibleBottom = visibleRect.y + visibleRect.height;
    int x = width - 10;
    int line = topLine;
    boolean paintingOutlineLine = foldWithOutlineShowing!=null &&
        foldWithOutlineShowing.containsLine(line);
    int lineCount = root.getElementCount();

    while (y<visibleBottom && line<lineCount) {

      int curLineH = LineNumberList.getChildViewBounds(v, line,
          visibleEditorRect).height;

      if (paintingOutlineLine) {
        g.setColor(getForeground());
        int w2 = width/2;
        if (line==foldWithOutlineShowing.getEndLine()) {
          int y2 = y + curLineH - cellHeight/2;
          g.drawLine(w2,y, w2,y2);
          g.drawLine(w2,y2, width-2,y2);
          paintingOutlineLine = false;
        }
        else {
          g.drawLine(w2,y, w2,y+curLineH);
        }
      }
      Fold fold = fm.getFoldForLine(line);
      if (fold!=null) {
        if (fold==foldWithOutlineShowing && !fold.isCollapsed()) {
          g.setColor(getForeground());
          int w2 = width/2;
          g.drawLine(w2,y+cellHeight/2, w2,y+curLineH);
View Full Code Here


      Point p = e.getPoint();
      int line = rowAtPoint(p);

      RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
      FoldManager fm = rsta.getFoldManager();

      Fold fold = fm.getFoldForLine(line);
      if (fold!=null) {
        fold.toggleCollapsedState();
        getGutter().repaint();
        textArea.repaint();
      }
View Full Code Here

            RSyntaxTextArea rsta = (RSyntaxTextArea)getTextArea();
            if (rsta.isCodeFoldingEnabled()) {

              int lastDot = getDot();
              FoldManager fm = rsta.getFoldManager();
              int line = 0;
              try {
                line = textArea.getLineOfOffset(dot);
              } catch (Exception e) {
                e.printStackTrace();
              }

              if (fm.isLineHidden(line)) {

                //System.out.println("filterBypass: avoiding hidden line");
                try {
                  if (dot>lastDot) { // Moving to further line
                    int lineCount = textArea.getLineCount();
                    while (++line<lineCount &&
                        fm.isLineHidden(line));
                      if (line<lineCount) {
                        dot = textArea.getLineStartOffset(line);
                      }
                      else { // No lower lines visible
                        UIManager.getLookAndFeel().
                            provideErrorFeedback(textArea);
                        return;
                      }
                  }
                  else if (dot<lastDot) { // Moving to earlier line
                    while (--line>=0 && fm.isLineHidden(line));
                    if (line>=0) {
                      dot = textArea.getLineEndOffset(line) - 1;
                    }
                  }
            } catch (Exception e) {
View Full Code Here

          if (target.isCodeFoldingEnabled()) {
            int last = pos==endOffs-1 ? target.getLineCount()-1 :
              target.getLineOfOffset(pos+1);
            int current = target.getLineOfOffset(pos);
            if (last!=current) { // If moving up a line...
              FoldManager fm = target.getFoldManager();
              if (fm.isLineHidden(current)) {
                while (--current>0 && fm.isLineHidden(current));
                pos = target.getLineEndOffset(current) - 1;
              }
            }
          }
        }
        break;

      case EAST:
        if(pos == -1) {
          pos = view.getStartOffset();
        }
        else {
          pos = Math.min(pos + 1, view.getDocument().getLength());
          if (target.isCodeFoldingEnabled()) {
            int last = pos==0 ? 0 : target.getLineOfOffset(pos-1);
            int current = target.getLineOfOffset(pos);
            if (last!=current) { // If moving down a line...
              FoldManager fm = target.getFoldManager();
              if (fm.isLineHidden(current)) {
                int lineCount = target.getLineCount();
                while (++current<lineCount && fm.isLineHidden(current));
                pos = current==lineCount ?
                    target.getLineEndOffset(last)-1 : // Was the last visible line
                    target.getLineStartOffset(current);
              }
            }
View Full Code Here

    // A line containing only Token.NULL is an empty line.
    else if (token.getType()==Token.NULL) {
      int line = c.getLineOfOffset(offs)// Sure to be > c.getLineCount()-1 ??
//      return c.getLineStartOffset(line+1);
FoldManager fm = c.getFoldManager();
line = fm.getVisibleLineBelow(line);
return c.getLineStartOffset(line);
    }

    else {
      return token.getListOffset(c, e, 0, x);
View Full Code Here

    int end = range.getEndOffset();

    boolean foldsExpanded = false;
    if (textArea instanceof RSyntaxTextArea) {
      RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
      FoldManager fm = rsta.getFoldManager();
      if (fm.isCodeFoldingSupportedAndEnabled()) {
        foldsExpanded = fm.ensureOffsetNotInClosedFold(start);
        foldsExpanded |= fm.ensureOffsetNotInClosedFold(end);
      }
    }

    if (select) {
      textArea.setSelectionStart(start);
View Full Code Here

    // When line wrap is not enabled, take the faster code path.
    if (textArea==null) {
      return;
    }
    RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
    FoldManager fm = rsta.getFoldManager();
    if (!fm.isCodeFoldingSupportedAndEnabled()) {
      super.paintComponent(g);
      return;
    }

    visibleRect = g.getClipBounds(visibleRect);
    if (visibleRect==null) { // ???
      visibleRect = getVisibleRect();
    }
    //System.out.println("IconRowHeader repainting: " + visibleRect);
    if (visibleRect==null) {
      return;
    }
    paintBackgroundImpl(g, visibleRect);

    if (textArea.getLineWrap()) {
      paintComponentWrapped(g);
      return;
    }

    Document doc = textArea.getDocument();
    Element root = doc.getDefaultRootElement();
    textAreaInsets = textArea.getInsets(textAreaInsets);
    if (visibleRect.y<textAreaInsets.top) {
      visibleRect.height -= (textAreaInsets.top - visibleRect.y);
      visibleRect.y = textAreaInsets.top;
    }

    // Get the first line to paint.
    int cellHeight = textArea.getLineHeight();
    int topLine = (visibleRect.y-textAreaInsets.top)/cellHeight;

    // Get where to start painting (top of the row).
    // We need to be "scrolled up" up just enough for the missing part of
    // the first line.
    int y = topLine*cellHeight + textAreaInsets.top;

    // AFTER calculating visual offset to paint at, account for folding.
    topLine += fm.getHiddenLineCountAbove(topLine, true);

    // Paint the active line range.
    if (activeLineRangeStart>-1 && activeLineRangeEnd>-1) {
      Color activeLineRangeColor = getActiveLineRangeColor();
      g.setColor(activeLineRangeColor);
View Full Code Here

        final XMLBeansModel model = new XMLBeansModel(Factory.parse(is).getJbossesb());
       
        final List<Listener> awareListeners = model.getESBAwareListeners() ;
        assertEquals("Listener count", 1, awareListeners.size()) ;
       
        final Listener listener = awareListeners.get(0) ;
        assertTrue("JmsListener", listener instanceof JmsListener) ;
       
        final Document doc = YADOMUtil.createDocument() ;
        final Element root = doc.createElement("root") ;
        final Element listenerElement = JmsListenerMapper.map(root, (JmsListener)listener, model) ;
View Full Code Here

    JmsMessageFilter listenerDestination = awareListener.getJmsMessageFilter();
    assertEquals("queue/B", listenerDestination.getDestName());
    assertEquals(JmsMessageFilter.DestType.TOPIC, listenerDestination.getDestType());
    assertEquals("service='Reconciliation'", listenerDestination.getSelector());

    Listener untypedAwareListener = awareListeners.get(1);
    assertEquals("Bank-Listener-Generic", untypedAwareListener.getName());
    assertEquals("my-generic-bus", untypedAwareListener.getBusidref());
    assertTrue(!untypedAwareListener.getIsGateway());

    Service gatewayService = model.getService(gatewayListener);
    Service awareService = model.getService(awareListener);
    assertSame(gatewayService, awareService);
    assertEquals("Bank", awareService.getCategory());
View Full Code Here

        final XMLBeansModel model = new XMLBeansModel(Factory.parse(is).getJbossesb());
       
        final List<Listener> awareListeners = model.getESBAwareListeners() ;
        assertEquals("Listener count", 1, awareListeners.size()) ;
       
        final Listener listener = awareListeners.get(0) ;
        assertTrue("JmsListener", listener instanceof JmsListener) ;
       
        final Document doc = YADOMUtil.createDocument() ;
        final Element root = doc.createElement("root") ;
        final Element listenerElement = JmsListenerMapper.map(root, (JmsListener)listener, model) ;
View Full Code Here

TOP

Related Classes of org.fife.ui.rsyntaxtextarea.folding.FoldManager$Listener

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.