Package lupos.gui.anotherSyntaxHighlighting

Examples of lupos.gui.anotherSyntaxHighlighting.LuposDocumentReader


        infoPanel.add(info);
        pPanel.add(infoPanel, BorderLayout.NORTH);

        final LuposDocument document = new LuposDocument();
        final LuposJTextPane ta_prefixes = new LuposJTextPane(document);
        document.init(TurtleParser.createILuposParser(new LuposDocumentReader(document)), false);

        // just to get all prefixes before displaying them...
        for(QueryResult qr: resultQueryEvaluator){
          qr.toString(prefixInstance);
        }
View Full Code Here


          final Object[] row = new Object[max + 1];

          if (operatorGraph == null) {
            final LuposDocument document = new LuposDocument();
            final LuposJTextPane textPane = new LuposJTextPane(document);
            document.init(TurtleParser.createILuposParser(new LuposDocumentReader(document)), false);
            textPane.setText(p.getName().toString(prefixInstance));
            textPane.setEditable(false);
            row[0] = textPane;
          } else {
            row[0] = p.getName().toString(prefixInstance);
          }

          int index = 1;
          for (final Literal l : p.getParameters()) {
            if (operatorGraph == null) {
              final LuposDocument document = new LuposDocument();
              final LuposJTextPane textPane = new LuposJTextPane(document);
              document.init(TurtleParser.createILuposParser(new LuposDocumentReader(document)), false);
              textPane.setText(l.toString(prefixInstance));
              textPane.setEditable(false);

              row[index++] = textPane;
            } else {
              row[index++] = l.toString(prefixInstance);
            }
          }

          for (int i2 = index; i2 < max + 1; i2++) {
            row[i2] = "";
          }

          rows[i++] = row;
        }

        tablesJTable[indexJTables++] = generateTable(rows, tableHead,
            operatorGraph);
      } else if (qr instanceof GraphResult) {
        final GraphResult gr = (GraphResult) qr;

        final String[] tableHead = { "Subject", "Predicate", "Object" };

        final Object[][] rows = new Object[gr.getGraphResultTriples()
            .size()][];

        int i = 0;

        for (final Triple t : gr.getGraphResultTriples()) {
          if (operatorGraph == null) {
            final LuposDocument documentSubject = new LuposDocument();
            final LuposJTextPane textPaneSubject = new LuposJTextPane(documentSubject);
            documentSubject.init(TurtleParser.createILuposParser(new LuposDocumentReader(documentSubject)), false);
            textPaneSubject.setText(t.getSubject().toString(prefixInstance));
            textPaneSubject.setEditable(false);

            final LuposDocument documentPredicate = new LuposDocument();
            final LuposJTextPane textPanePredicate = new LuposJTextPane(documentPredicate);
            documentPredicate.init(TurtleParser.createILuposParser(new LuposDocumentReader(documentPredicate)), false);
            textPanePredicate.setText(t.getPredicate().toString(prefixInstance));
            textPanePredicate.setEditable(false);

            final LuposDocument documentObject = new LuposDocument();
            final LuposJTextPane textPaneObject = new LuposJTextPane(documentObject);
            documentObject.init(TurtleParser.createILuposParser(new LuposDocumentReader(documentObject)), false);
            textPaneObject.setText(t.getObject().toString(
                prefixInstance));
            textPaneObject.setEditable(false);

            rows[i++] = new Object[] { textPaneSubject,
                textPanePredicate, textPaneObject };
          } else {
            rows[i++] = new String[] {
                t.getSubject().toString(prefixInstance),
                t.getPredicate().toString(prefixInstance),
                t.getObject().toString(prefixInstance) };
          }
        }

        tablesJTable[indexJTables++] = generateTable(rows, tableHead,
            operatorGraph);
      } else {
        final HashSet<Variable> variables = new HashSet<Variable>();

        // get variables...
        for (final Bindings ba : qr) {
          variables.addAll(ba.getVariableSet());
        }

        // --- generate table head - begin ---
        final String[] tableHead = new String[variables.size()];

        int i = 0;

        // result order is defined...
        if (resultOrder != null && resultOrder.size() > 0) {
          for (final String s : resultOrder) {
            if (variables.contains(new Variable(s))) {
              tableHead[i++] = "?" + s;
            }
          }
        } else {
          // result order is not defined...
          for (final Variable v : variables) {
            tableHead[i++] = v.toString();
          }
        }
        // --- generate table head - end ---

        // --- generate table rows - begin ---
        final Object[][] rows = new Object[qr.size()][];

        i = 0;

        for (final Bindings ba : qr) {
          final Object[] row = new Object[variables.size()];

          int j = 0;

          // result order is defined...
          if (resultOrder != null && resultOrder.size() > 0) {
            for (final String s : resultOrder) {
              if (variables.contains(new Variable(s))) {
                final Literal literal = ba.get(new Variable(s));
                String value = "";

                if (literal != null) {
                  value = literal.toString(prefixInstance);
                }

                if (operatorGraph == null) {
                  final LuposDocument document = new LuposDocument();
                  final LuposJTextPane textPane = new LuposJTextPane(document);
                  document.init(TurtleParser.createILuposParser(new LuposDocumentReader(document)), false);
                  textPane.setText(value);
                  textPane.setEditable(false);

                  row[j++] = textPane;
                } else {
                  row[j++] = value;
                }
              }
            }
          } else { // result order is not defined...
            for (final Variable variable : variables) {
              final Literal literal = ba.get(variable);
              String value = "";

              if (literal != null) {
                value = literal.toString(prefixInstance);
              }

              if (operatorGraph == null) {
                final LuposDocument document = new LuposDocument();
                final LuposJTextPane textPane = new LuposJTextPane(document);
                document.init(TurtleParser.createILuposParser(new LuposDocumentReader(document)), false);
                textPane.setText(value);
                textPane.setEditable(false);

                row[j++] = textPane;
              } else {
View Full Code Here

    final LuposDocument document = new LuposDocument();
    this.tp_rifInput = new VisualRifJTextPane(document);
    this.tp_rifInput.setFont(new Font("Courier", Font.PLAIN, 12));
    this.tp_rifInput.setTabWidth(4);
    document.init(lupos.gui.anotherSyntaxHighlighting.javacc.RIFParser.createILuposParser(new LuposDocumentReader(document)), true, 100);
    this.setRifInputSP(new JScrollPane(this.tp_rifInput));
    final TextLineNumber tln = new TextLineNumber(this.tp_rifInput);
    this.rifInputSP.setRowHeaderView( tln );
  }
View Full Code Here

      }
    });

    final LuposDocument document = new LuposDocument();
    this.tp_queryInput = new LuposJTextPane(document);
    document.init(SPARQLParser.createILuposParser(new LuposDocumentReader(document)), true, 100);
    new JTextPanePreparer(this.tp_queryInput, StrategyManager.LANGUAGE.SPARQL, document);

    this.queryInputSP = new JScrollPane(this.tp_queryInput);

    return this.generateInputTab(bt_visualEdit, null,
View Full Code Here

      }
    });

    final LuposDocument document = new LuposDocument();
    this.tp_rifInput = new LuposJTextPane(document);
    document.init(RIFParser.createILuposParser(new LuposDocumentReader(document)), true, 100);
    new JTextPanePreparer(this.tp_rifInput, StrategyManager.LANGUAGE.RIF, document);

    this.rifInputSP = new JScrollPane(this.tp_rifInput);

    return this.generateInputTab(bt_visualEdit, null, "Choose a RIF query:\t",
View Full Code Here

      }
    });

    final LuposDocument document_data = new LuposDocument();
    this.tp_dataInput = new LuposJTextPane(document_data);
    document_data.init(TurtleParser.createILuposParser(new LuposDocumentReader(document_data)), true, 100);
    new JTextPanePreparer(this.tp_dataInput, StrategyManager.LANGUAGE.RDF, document_data);

    this.dataInputSP = new JScrollPane(this.tp_dataInput);

    return this.generateInputTab(bt_visualEdit, bt_CondensedView,
View Full Code Here

    final JFrame frame = this.createSmallFrame(panel, "Enter Query...");

    // create components for query input with syntax highlighting...
    final LuposDocument document = new LuposDocument();
    final JTextPane tp_query = new LuposJTextPane(document);
    document.init(SPARQLParser.createILuposParser(new LuposDocumentReader(document)), false, 100);

    tp_query.addKeyListener(this.getKeyListener(frame));
    tp_query.setFont(new Font("Courier New", Font.PLAIN, 12));
    tp_query.setPreferredSize(new Dimension(794, 200));
    tp_query.setText("PREFIX dc:      <http://purl.org/dc/elements/1.1/>\nPREFIX dcterms: <http://purl.org/dc/terms/>\n\nSELECT DISTINCT ?author ?yr\nWHERE {\n  ?doc1 dc:author ?author.\n  ?doc1 dc:ref ?doc2.\n  ?doc2 dc:ref ?doc3.\n  ?doc3 dc:ref ?doc1.\n  OPTIONAL {\n    ?doc1 dcterms:issued ?yr. FILTER(?yr < 1950)\n  }\n}\nORDER BY ASC(?author)");
View Full Code Here

          JPanel panel = new JPanel();
          final JFrame frame = parent.visualEditor.createSmallFrame(panel, "JumpOverOperator conditions");

          LuposDocument document = new LuposDocument();
          final JTextPane tp = new LuposJTextPane(document);
          document.init(JavaScanner.createILuposParser(new LuposDocumentReader(document)), true);

          tp.addKeyListener(parent.visualEditor.getKeyListener(frame));
          tp.setFont(new Font("Courier New", Font.PLAIN, 12));
          tp.setText(operator.getConditions());
View Full Code Here

    JPanel shortDescrPanel=new JPanel(new BorderLayout());
    shortDescrPanel.add(new JLabel("Short description:"), BorderLayout.NORTH);
   
    LuposDocument document_shortDescription = new LuposDocument();
    this.tp_shortDescription = new LuposJTextPane(document_shortDescription);
    document_shortDescription.init(HTMLScanner.createILuposParser(new LuposDocumentReader(document_shortDescription)), true);

    JScrollPane sp_shortDescription = new JScrollPane(this.tp_shortDescription);
    sp_shortDescription.setPreferredSize(new Dimension(sp_shortDescription.getPreferredSize().width, 75));
   
    shortDescrPanel.add(sp_shortDescription, BorderLayout.CENTER);

    // Panel for long description...
    JPanel longDescrPanel=new JPanel(new BorderLayout());
    longDescrPanel.add(new JLabel("Long description:"), BorderLayout.NORTH);
   
    LuposDocument document_longDescription = new LuposDocument();
    this.tp_longDescription = new LuposJTextPane(document_longDescription);
    document_longDescription.init(HTMLScanner.createILuposParser(new LuposDocumentReader(document_shortDescription)), true);

    JScrollPane sp_longDescription = new JScrollPane(this.tp_longDescription);
    sp_longDescription.setPreferredSize(new Dimension(sp_longDescription.getPreferredSize().width, 150));

    longDescrPanel.add(sp_longDescription, BorderLayout.CENTER);
   
    // Panel See also
    JPanel seeAlsoPanel=new JPanel(new BorderLayout());
    seeAlsoPanel.add(new JLabel("See also:"), BorderLayout.NORTH);
   
    JPanel rulesPanel=new JPanel(new BorderLayout());
    JPanel rulepackagesPanel=new JPanel(new BorderLayout());
       
    rulesPanel.add(new JLabel("Rules:"), BorderLayout.NORTH);
    rulepackagesPanel.add(new JLabel("Rule Packages:"), BorderLayout.NORTH);
   
    this.seeAlsoPanel_rules = new JPanel(new GridLayout(0,3));

    rulesPanel.add(this.seeAlsoPanel_rules, BorderLayout.CENTER);

    this.seeAlsoPanel_rulePackages = new JPanel(new GridLayout(0,1));

    rulepackagesPanel.add(this.seeAlsoPanel_rulePackages, BorderLayout.CENTER);
   
    JSplitPane seeAlsoSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    seeAlsoSplitPane.setTopComponent(rulesPanel);
    seeAlsoSplitPane.setBottomComponent(rulepackagesPanel);
    seeAlsoSplitPane.setOneTouchExpandable(true);
    seeAlsoSplitPane.setContinuousLayout(true);
    seeAlsoSplitPane.setDividerLocation(0.5);
   
    seeAlsoPanel.add(seeAlsoSplitPane, BorderLayout.CENTER);
   
    // create split panes...
    JSplitPane descrSplitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    descrSplitPane.setTopComponent(shortDescrPanel);
    descrSplitPane.setBottomComponent(longDescrPanel);
    descrSplitPane.setOneTouchExpandable(true);
   
    JSplitPane mainSplitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    mainSplitPane.setTopComponent(descrSplitPane);
    mainSplitPane.setOneTouchExpandable(true);
   
    // Panel Visual Representation   
    final JPanel visualRepresentation = new JPanel(new BorderLayout());
    final JPanel filePanel = new JPanel();

    if(this.elementType == TypeEnum.Rule) {
     
      this.jCB_showVisualRepresentation = new JCheckBox("show visual representation", true);
      visualRepresentation.add(this.jCB_showVisualRepresentation, BorderLayout.NORTH);
     
      final JPanel innerVisualRepresPanel = new JPanel(new BorderLayout());
      this.jCB_showVisualRepresentation.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ie) {
          innerVisualRepresPanel.setVisible(ie.getStateChange() == ItemEvent.SELECTED);
        }
      });
           
      innerVisualRepresPanel.add(new JLabel("Transition text:"), BorderLayout.NORTH);
     
      LuposDocument document_transitionText = new LuposDocument();
      this.tp_transitionText = new LuposJTextPane(document_transitionText);
      document_transitionText.init(HTMLScanner.createILuposParser(new LuposDocumentReader(document_transitionText)), true);

      JScrollPane sp_transitionText = new JScrollPane(this.tp_transitionText);
      sp_transitionText.setPreferredSize(new Dimension(sp_transitionText.getPreferredSize().width, 75));

      innerVisualRepresPanel.add(sp_transitionText, BorderLayout.CENTER);
View Full Code Here

    JPanel globalImportCodePanel=new JPanel(new BorderLayout());
    globalImportCodePanel.add(new JLabel("Additional import declarations:"), BorderLayout.NORTH);

    LuposDocument document_globalImportCode = new LuposDocument();
    this.jTP_additionalImportDeclarations = new LuposJTextPane(document_globalImportCode);
    document_globalImportCode.init(JavaScanner.createILuposParser(new LuposDocumentReader(document_globalImportCode)), true);

    JScrollPane jSP_globalImportCode = new JScrollPane(this.jTP_additionalImportDeclarations);

    globalImportCodePanel.add(jSP_globalImportCode, BorderLayout.CENTER);
   
    JPanel globalJavaCodePanel=new JPanel(new BorderLayout());
    globalJavaCodePanel.add(new JLabel("Additional global java code:"), BorderLayout.NORTH);

    LuposDocument document_globalJavaCode = new LuposDocument();
    this.jTP_globalJavaCode = new LuposJTextPane(document_globalJavaCode);
    document_globalJavaCode.init(JavaScanner.createILuposParser(new LuposDocumentReader(document_globalJavaCode)), true);

    JScrollPane jSP_globalJavaCode = new JScrollPane(this.jTP_globalJavaCode);

    globalJavaCodePanel.add(jSP_globalJavaCode, BorderLayout.CENTER);
View Full Code Here

TOP

Related Classes of lupos.gui.anotherSyntaxHighlighting.LuposDocumentReader

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.