コード例 #1
0
ファイル: GUICommands.java プロジェクト: JosuaKrause/basex
    @Override
    public void execute(final GUI gui) {
      final boolean rt = gui.gprop.invert(GUIProp.FILTERRT);
      gui.stop();
      // refresh buttons in input bar
      gui.refreshControls();
      // refresh editor buttons
      gui.editor.refreshMark();

      final Context ctx = gui.context;
      final boolean root = ctx.root();
      final Data data = ctx.data();
      if (!rt) {
        if (!root) {
          gui.notify.context(new Nodes(0, data), true, null);
          gui.notify.mark(ctx.current(), null);
        }
      } else {
        if (root) {
          gui.notify.mark(new Nodes(data), null);
        } else {
          final Nodes mark = ctx.marked;
          ctx.marked = new Nodes(data);
          gui.notify.context(mark, true, null);
        }
      }
    }
コード例 #2
0
ファイル: ViewNotifier.java プロジェクト: JosuaKrause/basex
  /**
   * Notifies all views of a context change.
   *
   * @param nodes new context set (may be {@code null} if root nodes are addressed)
   * @param quick quick switch
   * @param vw the calling view
   */
  public void context(final Nodes nodes, final boolean quick, final View vw) {
    final Context ctx = gui.context;

    // add new entry if current node set has not been cached yet
    final Nodes newn = nodes.checkRoot();
    final Nodes empty = new Nodes(new int[0], ctx.data(), ctx.marked.ftpos);
    final Nodes curr = quick ? ctx.current() : null;
    final Nodes cmp = quick ? curr : ctx.marked;
    if (cont[hist] == null ? cmp != null : cmp == null || !cont[hist].sameAs(cmp)) {
      checkHist();
      if (quick) {
        // store history entry
        queries[hist] = "";
        marked[hist] = new Nodes(ctx.data());
        // add current entry
        cont[++hist] = curr;
      } else {
        // store history entry
        final String in = gui.input.getText();
        queries[hist] = in;
        marked[hist] = ctx.marked;
        // add current entry
        cont[++hist] = newn;
        queries[hist] = in;
        marked[hist] = empty;
      }
      histsize = hist;
    }
    ctx.set(newn, empty);

    for (final View v : view) if (v != vw && v.visible()) v.refreshContext(true, quick);
    gui.refreshControls();
  }
コード例 #3
0
ファイル: GUICommands.java プロジェクト: JosuaKrause/basex
 @Override
 public void execute(final GUI gui) {
   // skip operation for root context
   final Context ctx = gui.context;
   if (ctx.root()) return;
   // jump to database root
   ctx.update();
   gui.notify.context(ctx.current(), false, null);
 }
コード例 #4
0
ファイル: GUICommands.java プロジェクト: JosuaKrause/basex
 @Override
 public void execute(final GUI gui) {
   // skip operation for root context
   final Context ctx = gui.context;
   if (ctx.root()) return;
   // check if all nodes are document nodes
   boolean doc = true;
   final Data data = ctx.data();
   for (final int pre : ctx.current().pres) doc &= data.kind(pre) == Data.DOC;
   if (doc) {
     // if yes, jump to database root
     ctx.update();
     gui.notify.context(ctx.current(), false, null);
   } else {
     // otherwise, jump to parent nodes
     gui.execute(new Cs(".."));
   }
 }
コード例 #5
0
ファイル: Http.java プロジェクト: killdashnine/Play20
 /** Returns the current lang. */
 public static play.i18n.Lang lang() {
   return play.i18n.Lang.preferred(Context.current().request().acceptLanguages());
 }
コード例 #6
0
ファイル: Http.java プロジェクト: killdashnine/Play20
 /** Returns the current session. */
 public static Session session() {
   return Context.current().session();
 }
コード例 #7
0
ファイル: Http.java プロジェクト: killdashnine/Play20
 /** Returns the current flash scope. */
 public static Flash flash() {
   return Context.current().flash();
 }
コード例 #8
0
ファイル: Http.java プロジェクト: killdashnine/Play20
 /** Returns the current request. */
 public static Request request() {
   return Context.current().request();
 }
コード例 #9
0
ファイル: Http.java プロジェクト: killdashnine/Play20
 /** Returns the current response. */
 public static Response response() {
   return Context.current().response();
 }