Commits

shemnon  committed a20338c

remove slidedown work in process code

  • Participants
  • Parent commits fbdf7f9

Comments (0)

Files changed (4)

File flowdown-app/build.gradle

 
 dependencies {
     compile project(':markdown-node')
-    compile 'org.bitbucket.shemnon.deckcontrol:deckcontrol:0.1.0-SNAPSHOT'
 
 }
 

File flowdown-app/src/main/java/SlideDown/MarkdownToSlideGenerator.java

-package SlideDown;
-
-import com.github.shemnon.deckcontrol.Deck;
-import javafx.application.Platform;
-import javafx.collections.FXCollections;
-import javafx.event.EventHandler;
-import javafx.geometry.Pos;
-import javafx.scene.Node;
-import javafx.scene.control.Button;
-import javafx.scene.input.MouseEvent;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Pane;
-import javafx.scene.layout.VBox;
-import org.bitbucket.shemnon.mdnode.MarkdownNode;
-import org.bitbucket.shemnon.mdnode.MarkdownToNodeGenerator;
-import org.bitbucket.shemnon.mdnode.MarkdownVisitor;
-import org.pegdown.PegDownProcessor;
-import org.pegdown.ast.RootNode;
-
-/**
- * Created with IntelliJ IDEA.
- * User: shemnon
- * Date: 6 Jun 2013
- * Time: 7:50 PM
- */
-public class MarkdownToSlideGenerator extends MarkdownToNodeGenerator {
-
-    private final HBox buttons;
-    Deck deck;
-    VBox box;
-
-    public MarkdownToSlideGenerator() {
-        super();
-        deck = new Deck();
-        deck.getStylesheets().setAll(MarkdownNode.class.getResource(MarkdownNode.STYLESHEET_DEFAULT).toExternalForm());
-        deck.setStyle("-fx-skin: 'com.github.shemnon.deckcontrol.skin.ShelfDeckSkin'");
-        deck.setAlignment(Pos.CENTER);
-        deck.setPrefHeight(400);
-
-        Button prevButton = new Button("Prev");
-        prevButton.setOnAction(evt -> {deck.previousNode();});
-        Button nextButton = new Button("Next");
-        nextButton.setOnAction(evt -> {deck.nextNode();});
-
-        buttons = new HBox(
-                prevButton, nextButton
-        );
-
-        box = new VBox(deck, buttons);
-    }
-
-    public javafx.scene.Node createMarkdownNode(String markdown) {
-        if (markdown == null) {
-            return null;
-        }
-
-        PegDownProcessor processor = new PegDownProcessor(parserFlags);
-
-        final SlideDownVisitor ourVisitor = new SlideDownVisitor();
-
-        ourVisitor.slidePages.clear();
-        ourVisitor.nextSlide();
-
-        RootNode root = processor.parseMarkdown(markdown.toCharArray());
-
-        root.accept(ourVisitor);
-
-        Platform.runLater(()-> {
-            try {
-                int pos = deck.getPrimaryNodeIndex();
-                if (pos < 0) pos = 0;
-
-
-                deck.setNodes(FXCollections.<Node>observableList(ourVisitor.slidePages));
-                deck.setPrimaryNodeIndex(pos);
-                deck.layout(); // this is needed to get the list box bullets to align properly
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        });
-
-        return box;
-
-    }
-
-}

File flowdown-app/src/main/java/SlideDown/SlideDownNode.java

-package SlideDown;
-
-import org.bitbucket.shemnon.OffThreadTransformingPane;
-import org.bitbucket.shemnon.mdnode.MarkdownNode;
-import org.bitbucket.shemnon.mdnode.MarkdownToNodeGenerator;
-
-/**
- * Created with IntelliJ IDEA.
- * User: shemnon
- * Date: 2 Feb 2013
- * Time: 1:57 PM
- */
-
-public class SlideDownNode extends MarkdownNode {
-
-    public SlideDownNode() {
-        this(new MarkdownToSlideGenerator());
-    }
-
-    public SlideDownNode(MarkdownToNodeGenerator generator) {
-        this.generator = generator;
-        setTransformation(this.generator::createMarkdownNode);
-        generator.setMarkdownVisitor(new SlideDownVisitor());
-
-    }
-}

File flowdown-app/src/main/java/SlideDown/SlideDownVisitor.java

-package SlideDown;
-
-import javafx.scene.Node;
-import javafx.scene.layout.Pane;
-import javafx.scene.layout.VBox;
-import org.bitbucket.shemnon.mdnode.MarkdownVisitor;
-import org.pegdown.ast.SimpleNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created with IntelliJ IDEA.
- * User: shemnon
- * Date: 6 Jun 2013
- * Time: 7:53 PM
- */
-public class SlideDownVisitor extends MarkdownVisitor {
-
-    double prefWidth = 600;
-    double prefHeight = 400;
-
-    List<Node> slidePages = new ArrayList<>();
-
-    public void nextSlide() {
-        popNode();
-        VBox slide = new VBox();
-        slide.setPrefWidth(prefWidth);
-        slide.setPrefHeight(prefHeight);
-        slidePages.add(slide);
-        slide.getStyleClass().setAll(MarkdownToSlideGenerator.STYLE_CLASS_BODY);
-        pushNode(slide);
-    }
-
-    @Override
-    public void popNode() {
-        if (nodeStack.size() == 1) {
-            nodeStack.peek().layout();
-        }
-        super.popNode();    //To change body of overridden methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void visit(SimpleNode node) {
-        if (node.getType() == SimpleNode.Type.HRule) {
-            nextSlide();
-        } else {
-            super.visit(node);
-        }
-    }
-}