Search in sources :

Example 16 with NWindow

use of automenta.vivisect.swing.NWindow in project opennars by opennars.

the class SentenceTablePanel method newSelectedGraphPanel.

public void newSelectedGraphPanel() {
    Term[] sel = new Term[table.getSelectedRows().length];
    int k = 0;
    for (int i : table.getSelectedRows()) {
        Sentence w = (Sentence) table.getValueAt(i, 1);
        sel[k] = w.term;
        k++;
    }
    TermSyntaxVis tt = new TermSyntaxVis(sel);
    syntaxPanel = new PCanvas(tt);
    syntaxPanel.setZoom(10f);
    NWindow w = new NWindow("", syntaxPanel);
    w.setSize(400, 400);
    w.setVisible(true);
// ProcessingGraphPanel2 pgp = new ProcessingGraphPanel2(getSelectedRows(1)) {
// 
// @Override
// public DirectedMultigraph getGraph() {
// 
// DefaultGraphizer graphizer = new DefaultGraphizer(true, true, true, true, 0, false, false) {
// 
// protected void addSentence(NARGraph g, Sentence s) {
// Term t = s.content;
// addTerm(g, t);
// //g.addEdge(s, s.content, new NARGraph.SentenceContent());
// 
// if (t instanceof CompoundTerm) {
// CompoundTerm ct = ((CompoundTerm) t);
// Set<Term> contained = ct.getContainedTerms();
// 
// for (Term x : contained) {
// addTerm(g, x);
// if (ct.containsTerm(x)) {
// g.addEdge(x, t, new NARGraph.TermContent());
// }
// 
// for (Term y : contained) {
// addTerm(g, y);
// 
// if (x != y) {
// if (x.containsTerm(y)) {
// g.addEdge(y, x, new NARGraph.TermContent());
// }
// }
// }
// }
// }
// }
// 
// @Override
// public void onTime(NARGraph g, long time) {
// super.onTime(g, time);
// 
// for (Object o : getItems()) {
// 
// if (o instanceof Task) {
// g.addVertex(o);
// addSentence(g, ((Task) o).sentence);
// } else if (o instanceof Sentence) {
// g.addVertex(o);
// addSentence(g, (Sentence) o);
// }
// }
// //add sentences
// }
// 
// };
// 
// app.updating = true;
// 
// graphizer.setShowSyntax(showSyntax);
// 
// NARGraph g = new NARGraph();
// g.add(nar, newSelectedGraphFilter(), graphizer);
// return g;
// }
// 
// @Override
// public int edgeColor(Object edge) {
// return NARSwing.getColor(edge.toString(), 0.5f, 0.5f).getRGB();
// }
// 
// @Override
// public float edgeWeight(Object edge) {
// return 10;
// }
// 
// @Override
// public int vertexColor(Object vertex) {
// return NARSwing.getColor(vertex.toString(), 0.5f, 0.5f).getRGB();
// }
// 
// };
// NWindow w = new NWindow("", pgp);
// w.setSize(400, 400);
// w.setVisible(true);
}
Also used : NWindow(automenta.vivisect.swing.NWindow) PCanvas(automenta.vivisect.swing.PCanvas) Term(nars.language.Term) TermSyntaxVis(nars.gui.output.graph.TermSyntaxVis) Sentence(nars.entity.Sentence)

Example 17 with NWindow

use of automenta.vivisect.swing.NWindow in project opennars by opennars.

the class Grid2DSpace method newWindow.

public NWindow newWindow(int width, int height, final boolean exitOnClose) {
    NWindow j = new NWindow("") {

        @Override
        protected void close() {
            stop();
            destroy();
            getContentPane().removeAll();
            if (exitOnClose)
                System.exit(0);
        }
    };
    Container content = j.getContentPane();
    content.setLayout(new BorderLayout());
    JPanel menu = new JPanel(new FlowLayout(FlowLayout.LEFT));
    /*final JCheckBox syntaxEnable = new JCheckBox("Syntax");
        syntaxEnable.addActionListener(new ActionListener() {
        @Override public void actionPerformed(ActionEvent e) {
        }
        });
        menu.add(syntaxEnable);
         */
    EditorPanel editor = new EditorPanel(this);
    NWindow editorWindow = new NWindow("Edit", editor);
    editorWindow.setSize(200, 400);
    editorWindow.setVisible(true);
    content.add(menu, BorderLayout.NORTH);
    content.add(this, BorderLayout.CENTER);
    // initial size of the window
    j.setSize(width, height);
    j.setVisible(true);
    return j;
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) NWindow(automenta.vivisect.swing.NWindow) EditorPanel(nars.lab.grid2d.gui.EditorPanel)

Aggregations

NWindow (automenta.vivisect.swing.NWindow)17 PCanvas (automenta.vivisect.swing.PCanvas)7 LineChart (automenta.vivisect.timeline.LineChart)6 TimelineVis (automenta.vivisect.timeline.TimelineVis)6 NAR (nars.core.NAR)5 Default (nars.model.Default)5 NARSwing (nars.gui.NARSwing)3 NARTrace (nars.util.NARTrace)3 JPanel (javax.swing.JPanel)2 Sentence (nars.entity.Sentence)2 Term (nars.language.Term)2 NAR (nars.main.NAR)2 Task (nars.nal.entity.Task)2 Term (nars.nal.language.Term)2 FALCON (automenta.falcon.FALCON)1 TreeMLData (automenta.vivisect.TreeMLData)1 AwesomeButton (automenta.vivisect.swing.AwesomeButton)1 NSlider (automenta.vivisect.swing.NSlider)1 Chart (automenta.vivisect.timeline.Chart)1 MultiTimeline (automenta.vivisect.timeline.MultiTimeline)1