Exemplo n.º 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);
 }
Exemplo n.º 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();
  }
Exemplo n.º 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);
   }
 }
Exemplo n.º 4
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(gui.context.data() != null && !gui.context.root());
 }
Exemplo n.º 5
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(!data || gui.context.data() != null);
 }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
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());
 }
Exemplo n.º 8
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   super.refresh(gui, b);
   b.setSelected(gui.fullscreen);
 }
Exemplo n.º 9
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   super.refresh(gui, b);
   b.setSelected(gui.gprop.is(GUIProp.FILTERRT));
 }
Exemplo n.º 10
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(updatable(gui.context.marked, Data.DOC));
 }
Exemplo n.º 11
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   final Nodes marked = gui.context.marked;
   b.setEnabled(marked != null && marked.size() != 0);
 }
Exemplo n.º 12
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));
 }
Exemplo n.º 13
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));
 }
Exemplo n.º 14
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);
 }
Exemplo n.º 15
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);
 }
Exemplo n.º 16
0
 @Override
 public void refresh(final GUI gui, final AbstractButton b) {
   b.setEnabled(gui.editor != null && gui.editor.modified());
 }