Example #1
0
 /**
  * Sets the output text.
  *
  * @param out cached output
  */
 public void setText(final ArrayOutput out) {
   final byte[] buf = out.buffer();
   final int size = (int) out.size();
   final byte[] chop = token(DOTS);
   if (out.finished() && size >= chop.length) {
     System.arraycopy(chop, 0, buf, size - chop.length, chop.length);
   }
   text.setText(buf, size);
   header.setText((out.finished() ? CHOPPED : "") + RESULT);
   home.setEnabled(gui.context.data() != null);
 }
Example #2
0
  /**
   * Default constructor.
   *
   * @param man view manager
   */
  public TextView(final ViewNotifier man) {
    super(TEXTVIEW, man);
    border(5).layout(new BorderLayout(0, 5));

    header = new BaseXHeader(RESULT);

    home = BaseXButton.command(GUIMenuCmd.C_HOME, gui);
    home.setEnabled(false);

    text = new TextPanel(false, gui);
    text.setSyntax(new SyntaxXML());
    search = new SearchEditor(gui, text);

    final AbstractButton save = BaseXButton.get("c_save", SAVE, false, gui);
    final AbstractButton find = search.button(FIND);

    final BaseXBack buttons = new BaseXBack(false);
    buttons.layout(new TableLayout(1, 3, 1, 0)).border(0, 0, 4, 0);
    buttons.add(save);
    buttons.add(home);
    buttons.add(find);

    final BaseXBack b = new BaseXBack(false).layout(new BorderLayout());
    b.add(buttons, BorderLayout.WEST);
    b.add(header, BorderLayout.EAST);
    add(b, BorderLayout.NORTH);

    add(search, BorderLayout.CENTER);

    save.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            save();
          }
        });
    refreshLayout();
  }
Example #3
0
 /**
  * Serializes the specified nodes.
  *
  * @param n nodes to display
  */
 private void setText(final DBNodes n) {
   if (visible()) {
     try {
       final ArrayOutput ao = new ArrayOutput();
       ao.setLimit(gui.gopts.get(GUIOptions.MAXTEXT));
       if (n != null) n.serialize(Serializer.get(ao));
       setText(ao);
       cmd = null;
       ns = ao.finished() ? n : null;
     } catch (final IOException ex) {
       Util.debug(ex);
     }
   } else {
     home.setEnabled(gui.context.data() != null);
   }
 }
Example #4
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(updatable(gui.context.marked, Data.DOC));
 }
Example #5
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(gui.context.data() != null && !gui.context.root());
 }
Example #6
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(!data || gui.context.data() != null);
 }
Example #7
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   final String tt = gui.notify.query(false);
   b.setEnabled(tt != null);
   b.setToolTipText(tt != null && tt.isEmpty() ? C_GOFORWARD.help : tt);
 }
Example #8
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(
       !gui.gprop.is(GUIProp.FILTERRT) && gui.context.data() != null && !gui.context.root());
 }
Example #9
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   super.refresh(gui, b);
   b.setSelected(gui.fullscreen);
 }
Example #10
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   super.refresh(gui, b);
   b.setSelected(gui.gprop.is(GUIProp.FILTERRT));
 }
Example #11
0
 @Override
 public void refresh(final GUI main, final AbstractButton button) {
   button.setEnabled(text.marked());
 }
Example #12
0
 @Override
 public void refresh(final GUI main, final AbstractButton button) {
   button.setEnabled(clip() != null);
 }
Example #13
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(updatable(gui.context.marked, Data.ATTR, Data.PI, Data.COMM, Data.TEXT));
 }
Example #14
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   // disallow deletion of empty node set or root node
   b.setEnabled(updatable(gui.context.marked));
 }
Example #15
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   final Context ctx = gui.context;
   // disallow copy of empty node set or root node
   b.setEnabled(updatable(ctx.marked, Data.DOC) && ctx.copied != null);
 }
Example #16
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   // disallow copy of empty node set or root node
   final Nodes marked = gui.context.marked;
   b.setEnabled(marked != null && marked.size() != 0);
 }
Example #17
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(gui.editor != null && gui.editor.modified());
 }
Example #18
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   final Nodes marked = gui.context.marked;
   b.setEnabled(marked != null && marked.size() != 0);
 }
Example #19
0
 @Override
 public void refresh(final GUI main, final AbstractButton button) {
   button.setEnabled(!undo.last());
 }