Ejemplo n.º 1
0
  private void postChirp() {
    // Making the RPC call and submitting in the feeds
    // Instead of using our wrapper we will use the Core RPC call mechanism from the docs
    feedservice.sendFeed(
        feed,
        new AsyncCallback<Void>() {
          @Override
          public void onSuccess(Void result) {
            // User Chirped so we have a new feed coming up and the list needs to be repopulated
            // But if user has not clicked on the right Tab as per the chirp the feed might not be
            // visible
            eventbus.fireEvent(
                new FeedsCheckEvent(feed.getCity(), feed.getAuthor(), feed.getClient()));
          }

          @Override
          public void onFailure(Throwable caught) {
            System.err.println("Feed Posting Failed: " + caught);
          }
        });

    // When done Chirping make the buttons unavailaible again,clear the textbox
    display.getChirpButton().setEnabled(false);
    display.getAttachFile().setEnabled(false);

    display.getTextArea().setText("");
  }
  public void dispose() {
    shell.dispose();
    if (trayItem != null) {
      trayItem.dispose();
      trayItem = null;
    }

    if (image != null) {
      image.dispose();
    }
    if (image2 != null) {
      image2.dispose();
    }
    try {
      if (!display.isDisposed()) {
        display.dispose();
      }
    } catch (Exception e) {
      // already disposed
    }
    // dispose AWT frames
    if (settingsFrame != null) {
      settingsFrame.dispose();
    }
    if (aboutFrame != null) {
      aboutFrame.dispose();
    }
    if (logBrokerMonitor != null) {
      logBrokerMonitor.dispose();
    }
  }
Ejemplo n.º 3
0
  /**
   * Starts a game of TicTacToe
   *
   * @return
   */
  private Player startGame() {

    display.out(board.toString());
    Player winningPlayer = new Player(0, R.none);
    Player currentPlayer = player1;
    boolean isPlaying = true;

    while (isPlaying) {

      if (!currentPlayer.isAI()) {
        board.addPlayerAt(playerMove(), currentPlayer);
      } else {
        try {
          Thread.sleep(1000);
        } catch (Exception e) {
          System.out.print(e.getMessage());
        }
        board.addPlayerAt(compMove(), currentPlayer);
      }
      if (board.testVictory()) {
        isPlaying = false;
        winningPlayer = currentPlayer;
        display.out(String.format(R.winnerIs, winningPlayer.getName()));
      } else if (testDraw()) {
        isPlaying = false;
        display.out(R.draw);
      } else {
        currentPlayer = (currentPlayer == player1) ? player2 : player1;
      }
      display.out(board.toString());
    }
    return winningPlayer;
  }
Ejemplo n.º 4
0
  public void positionWindow(boolean resetToDefault) {
    String mapWindow;

    mapShellBounds = mapShell.getBounds();
    mapWindow = prefs.get(RadarConsts.PREF_KEY_MAP_WINDOW, "");

    if (mapWindow.equals("") || resetToDefault) {
      Rectangle dispBounds, tableBounds;

      dispBounds = ((Display.getCurrent()).getPrimaryMonitor()).getClientArea();
      tableBounds = display.getShells()[1].getBounds();

      mapShellBounds.width = dispBounds.width - tableBounds.width;
      mapShellBounds.height = dispBounds.height;
      mapShellBounds.x = dispBounds.x + tableBounds.width;
      mapShellBounds.y = dispBounds.y;
    } else {
      String[] tokens = mapWindow.split(",");

      mapShellBounds =
          new Rectangle(
              new Integer(tokens[0]), // X value
              new Integer(tokens[1]), // Y value
              new Integer(tokens[2]), // Width
              new Integer(tokens[3]) // Height
              );
    }
    mapShell.setBounds(mapShellBounds);
  }
 @Override
 public boolean canPaste(Clipboard clipboard) {
   Display d = getSection().getDisplay();
   Control c = d.getFocusControl();
   if (c instanceof Text) return true;
   return false;
 }
Ejemplo n.º 6
0
  /**
   * Starts accessing the native graphics in the underlying OS, when accessing the native graphics
   * Codename One shouldn't be used! The native graphics is unclipped and untranslated by default
   * and its the responsibility of the caller to clip/translate appropriately.
   *
   * <p>When finished with the native graphics it is essential to <b>invoke
   * endNativeGraphicsAccess</b>
   *
   * @return an instance of the underlying native graphics object
   */
  public Object beginNativeGraphicsAccess() {
    if (nativeGraphicsState != null) {
      throw new IllegalStateException("beginNativeGraphicsAccess invoked twice in a row");
    }
    Boolean a = Boolean.FALSE, b = Boolean.FALSE;
    if (isAntiAliasedText()) {
      b = Boolean.TRUE;
    }
    if (isAntiAliased()) {
      a = Boolean.TRUE;
    }

    nativeGraphicsState =
        new Object[] {
          new Integer(getTranslateX()),
          new Integer(getTranslateY()),
          new Integer(getColor()),
          new Integer(getAlpha()),
          new Integer(getClipX()),
          new Integer(getClipY()),
          new Integer(getClipWidth()),
          new Integer(getClipHeight()),
          a,
          b
        };
    translate(-getTranslateX(), -getTranslateY());
    setAlpha(255);
    setClip(
        0, 0, Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight());
    return nativeGraphics;
  }
Ejemplo n.º 7
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new RowLayout());

    DateTime calendar = new DateTime(shell, SWT.CALENDAR);
    calendar.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println("calendar date changed");
          }
        });

    DateTime time = new DateTime(shell, SWT.TIME);
    time.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            System.out.println("time changed");
          }
        });

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Ejemplo n.º 8
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout());
    final ScrolledComposite sc =
        new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    Composite c = new Composite(sc, SWT.NONE);
    c.setLayout(new GridLayout(10, true));
    for (int i = 0; i < 300; i++) {
      Button b = new Button(c, SWT.PUSH);
      b.setText("Button " + i);
    }
    sc.setContent(c);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    sc.setShowFocusedControl(true);

    shell.setSize(300, 500);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Ejemplo n.º 9
0
  public void render() {
    // canvas
    bs = display.getCanvas().getBufferStrategy();
    if (bs == null) {
      display.getCanvas().createBufferStrategy(3);
      return;
    }
    g = bs.getDrawGraphics();

    // reset screen
    g.clearRect(0, 0, width, height);

    // draws background, player, wall
    try {
      imgBackground = ImageIO.read(new File("Background.PNG"));
    } catch (IOException e) {

      e.printStackTrace();
      System.exit(1);
    }

    g.drawImage(imgBackground, 0, 0, null);
    g.setColor(Color.WHITE);
    g.setFont(new Font("Serif", Font.BOLD, 50));

    // g.drawString("Score: " + getScore(), 100, 100);

    // displays image(buffered image)
    bs.show();
    g.dispose();
  }
Ejemplo n.º 10
0
  public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("SWT and Swing DND Example");
    GridLayout layout = new GridLayout(1, false);
    shell.setLayout(layout);

    Text swtText = new Text(shell, SWT.BORDER);
    swtText.setText("SWT Text");
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    swtText.setLayoutData(data);
    setDragDrop(swtText);

    Composite comp = new Composite(shell, SWT.EMBEDDED);
    java.awt.Frame frame = SWT_AWT.new_Frame(comp);
    JTextField swingText = new JTextField(40);
    swingText.setText("Swing Text");
    swingText.setDragEnabled(true);
    frame.add(swingText);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = swingText.getPreferredSize().height;
    comp.setLayoutData(data);

    shell.setSize(400, 200);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
Ejemplo n.º 11
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setText("StyledText with underline and strike through");
   shell.setLayout(new FillLayout());
   StyledText text = new StyledText(shell, SWT.BORDER);
   text.setText("0123456789 ABCDEFGHIJKLM NOPQRSTUVWXYZ");
   // make 0123456789 appear underlined
   StyleRange style1 = new StyleRange();
   style1.start = 0;
   style1.length = 10;
   style1.underline = true;
   text.setStyleRange(style1);
   // make ABCDEFGHIJKLM have a strike through
   StyleRange style2 = new StyleRange();
   style2.start = 11;
   style2.length = 13;
   style2.strikeout = true;
   text.setStyleRange(style2);
   // make NOPQRSTUVWXYZ appear underlined and have a strike through
   StyleRange style3 = new StyleRange();
   style3.start = 25;
   style3.length = 13;
   style3.underline = true;
   style3.strikeout = true;
   text.setStyleRange(style3);
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
Ejemplo n.º 12
0
  public static int readLine(
      InputStream in, OutputStream out, Display display, boolean echo, byte[] buf, int maxLen) {
    // get a line from the input stream into the buffer buf, of max length maxLen
    // line is terminated with a return character;
    // echo back to output stream
    // also write to line 0 of the display, up to 16 characters
    try {
      int data;
      int len = 0;
      maxLen--; // make room for a null byte
      while ((data = in.read()) != -1) {
        if (data == 0) continue;
        if (data == '\n') continue;
        if (echo) out.write(data); // echo it back
        byte ch = (byte) data;

        if (ch == '\r') {
          if (echo) out.write('\n');
          int dlen = len; // LCD panel display length
          if (dlen > 16) dlen = 16;
          byte[] screenBuf = new byte[dlen];
          for (int i = 0; i < dlen; i++) screenBuf[i] = buf[i];
          display.print(0, screenBuf); // echo it to the display
          buf[len] = 0;
          return len;
        } else if (len < maxLen) {
          buf[len++] = ch;
        }
      }
    } catch (Exception e) {
      display.print(0, "oops!");
    }
    return -1;
  }
Ejemplo n.º 13
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new RowLayout());
   Combo combo = new Combo(shell, SWT.NONE);
   combo.setItems(new String[] {"A-1", "B-1", "C-1"});
   Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
   text.setText("some text");
   combo.addListener(
       SWT.DefaultSelection,
       new Listener() {
         public void handleEvent(Event e) {
           System.out.println(e.widget + " - Default Selection");
         }
       });
   text.addListener(
       SWT.DefaultSelection,
       new Listener() {
         public void handleEvent(Event e) {
           System.out.println(e.widget + " - Default Selection");
         }
       });
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
Ejemplo n.º 14
0
  private void runSession() {
    while (true) {
      shell = arseGUI.open(display);
      initializeARSE();
      while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }

      if (gameMasterMode) {
        gameMasterSession = new GameMasterSession(display);
        gameMasterSession.open();

        gameMasterMode = false;
      } else if (playerMode) {
        playerLoginGUI = new PlayerLoginGUI();
        playerSession = new PlayerSession(display);
        shell = playerLoginGUI.open(display);
        initializePlayerLoginGUI();
        while (!shell.isDisposed()) {
          if (!display.readAndDispatch()) display.sleep();
        }

        if (playerSession.loggedIn()) {
          playerSession.open();
        }
        playerMode = false;
      } else break;
    }
  }
Ejemplo n.º 15
0
 void drawItem(GC gc, boolean drawFocus) {
   int headerHeight = parent.getBandHeight();
   Display display = getDisplay();
   gc.setForeground(display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND));
   gc.setBackground(display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
   gc.fillGradientRectangle(x, y, width, headerHeight, true);
   if (expanded) {
     gc.setForeground(display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
     gc.drawLine(x, y + headerHeight, x, y + headerHeight + height - 1);
     gc.drawLine(x, y + headerHeight + height - 1, x + width - 1, y + headerHeight + height - 1);
     gc.drawLine(x + width - 1, y + headerHeight + height - 1, x + width - 1, y + headerHeight);
   }
   int drawX = x;
   if (image != null) {
     drawX += ExpandItem.TEXT_INSET;
     if (imageHeight > headerHeight) {
       gc.drawImage(image, drawX, y + headerHeight - imageHeight);
     } else {
       gc.drawImage(image, drawX, y + (headerHeight - imageHeight) / 2);
     }
     drawX += imageWidth;
   }
   if (text.length() > 0) {
     drawX += ExpandItem.TEXT_INSET;
     Point size = gc.stringExtent(text);
     gc.setForeground(parent.getForeground());
     gc.drawString(text, drawX, y + (headerHeight - size.y) / 2, true);
   }
   int chevronSize = ExpandItem.CHEVRON_SIZE;
   drawChevron(gc, x + width - chevronSize, y + (headerHeight - chevronSize) / 2);
   if (drawFocus) {
     gc.drawFocus(x + 1, y + 1, width - 2, headerHeight - 2);
   }
 }
 static boolean runLoopTimer(final Display display, final Shell shell, final int seconds) {
   final boolean[] timeout = {false};
   new Thread() {
     public void run() {
       try {
         for (int i = 0; i < seconds; i++) {
           Thread.sleep(1000);
           if (display.isDisposed() || shell.isDisposed()) return;
         }
       } catch (Exception e) {
       }
       timeout[0] = true;
       /* wake up the event loop */
       if (!display.isDisposed()) {
         display.asyncExec(
             new Runnable() {
               public void run() {
                 if (!shell.isDisposed()) shell.redraw();
               }
             });
       }
     }
   }.start();
   while (!timeout[0] && !shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();
   return timeout[0];
 }
Ejemplo n.º 17
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setLayout(new RowLayout());
   Text text = new Text(shell, SWT.MULTI | SWT.BORDER);
   String modifier = SWT.MOD1 == SWT.CTRL ? "Ctrl" : "Command";
   text.setText("Hit " + modifier + "+Return\nto see\nthe default button\nrun");
   text.addTraverseListener(
       e -> {
         switch (e.detail) {
           case SWT.TRAVERSE_RETURN:
             if ((e.stateMask & SWT.MOD1) != 0) e.doit = true;
         }
       });
   Button button = new Button(shell, SWT.PUSH);
   button.pack();
   button.setText("OK");
   button.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(SelectionEvent e) {
           System.out.println("OK selected");
         }
       });
   shell.setDefaultButton(button);
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
Ejemplo n.º 18
0
  protected void runSootDirectly(String mainClass) {

    int length = getSootCommandList().getList().size();
    String temp[] = new String[length];

    getSootCommandList().getList().toArray(temp);

    sendSootOutputEvent(mainClass);
    sendSootOutputEvent(" ");

    final String[] cmdAsArray = temp;

    for (int i = 0; i < temp.length; i++) {

      sendSootOutputEvent(temp[i]);
      sendSootOutputEvent(" ");
    }
    sendSootOutputEvent("\n");

    IRunnableWithProgress op;
    try {
      newProcessStarting();
      op = new SootRunner(temp, Display.getCurrent(), mainClass);
      ((SootRunner) op).setParent(this);
      ModalContext.run(op, true, new NullProgressMonitor(), Display.getCurrent());
    } catch (InvocationTargetException e1) {
      // handle exception
      System.out.println("InvocationTargetException: " + e1.getMessage());
      System.out.println("InvocationTargetException: " + e1.getTargetException());
      System.out.println(e1.getStackTrace());
    } catch (InterruptedException e2) {
      // handle cancelation
      System.out.println("InterruptedException: " + e2.getMessage());
    }
  }
Ejemplo n.º 19
0
  @Override
  public void run() {
    if (Storage.samples != null) {
      display_.disableLoadSave();

      FlowCell flowCell = new FlowCell(Consts.LANE_CAPACITY);

      // add samples
      try {
        if (!flowCell.initialAddSamples(Storage.samples, display_)) {
          System.out.println("Cancelling shuffle!");
          display_.enableLoadSave();
          return;
        }
      } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
      }

      try {
        RandomShuffler.Shuffle(flowCell, display_);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      display_.enableLoadSave();
    }
  }
Ejemplo n.º 20
0
 static long /*int*/ MenuItemSelectedProc(long /*int*/ widget, long /*int*/ user_data) {
   Display display = Display.getCurrent();
   ToolItem item = (ToolItem) display.getWidget(user_data);
   if (item != null) {
     return item.getParent().menuItemSelected(widget, item);
   }
   return 0;
 }
Ejemplo n.º 21
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.setText("Hi there, SWT!"); // Title bar
   shell.open();
   while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep();
   display.dispose();
 }
Ejemplo n.º 22
0
/** Created by cout970 on 10/02/2016. */
public class GuiHandler implements InputHandler.IKeyboardCallback {

  private ConfigurationFile config = ConfigurationFile.INSTANCE;
  private Vect2i size = Display.getFrameBufferSize().copy();
  private Vect2i center = Display.getFrameBufferSize().copy().division(2);
  private Gui gui;

  public void init() {
    gui = new Gui();
    TopBar topBar;
    gui.addComponent(topBar = new TopBar());
    topBar.init(gui);
    InputHandler.registerKeyboardCallback(this);
    gui.addComponent(topBar.getCubeEditor());
    //        gui.addComponent(topBar.getModelTree());
    gui.addComponent(topBar.getTextureEditor());
    //        gui.addComponent(topBar.getGroupEditor());
  }

  public void update() {
    Display.setGuiProjection();
    TextureStorage.EMPTY.bind();
    if (InputHandler.isMouseButtonPress(InputHandler.MouseButton.MIDDLE)
        || InputHandler.isMouseButtonPress(InputHandler.MouseButton.RIGHT)) {
      drawCenter();
    }
    size = Display.getFrameBufferSize().copy();
    center = Display.getFrameBufferSize().copy().division(2);
    gui.render();
  }

  private void drawCenter() {
    float size = 50;
    TextureStorage.CENTER.bind();
    glBegin(GL_QUADS);
    glColor4f(1, 1, 1, 1);
    glTexCoord2d(0, 0);
    glVertex3d(center.getX() - size / 2, center.getY() - size / 2, 0);
    glTexCoord2d(0, 1);
    glVertex3d(center.getX() - size / 2, center.getY() + size / 2, 0);
    glTexCoord2d(1, 1);
    glVertex3d(center.getX() + size / 2, center.getY() + size / 2, 0);
    glTexCoord2d(1, 0);
    glVertex3d(center.getX() + size / 2, center.getY() - size / 2, 0);
    glEnd();
  }

  @Override
  public void onKeyPress(int key, int code, int action) {}

  public Vect2i getScreenSize() {
    return size.copy();
  }

  public Gui getGui() {
    return gui;
  }
}
Ejemplo n.º 23
0
  public void afterChirpMarked(final FeedDTO feed) {
    this.feed = feed;
    // BTW AWESOMENESS---------> mysql AUTOMATICALLY INSERTS TIMESTAMP WHEN QUERY FIRES!

    // Now the Chirp and Attachment option get availaible
    display.getChirpButton().setEnabled(true);

    display.getAttachFile().setEnabled(true);
  }
Ejemplo n.º 24
0
 public static void runInUI(@Nullable Shell shell, @NotNull Runnable runnable) {
   final Display display =
       shell == null || shell.isDisposed() ? Display.getDefault() : shell.getDisplay();
   if (display.getThread() != Thread.currentThread()) {
     display.syncExec(runnable);
   } else {
     runnable.run();
   }
 }
Ejemplo n.º 25
0
 /**
  * Constructs a new instance of this class given the display to create it on and a style value
  * describing its behavior and appearance.
  *
  * <p>The style value is either one of the style constants defined in class <code>SWT</code> which
  * is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together
  * (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style
  * constants. The class description lists the style constants that are applicable to the class.
  * Style bits are also inherited from superclasses.
  *
  * <p>Note: Currently, null can be passed in for the display argument. This has the effect of
  * creating the tracker on the currently active display if there is one. If there is no current
  * display, the tracker is created on a "default" display. <b>Passing in null as the display
  * argument is not considered to be good coding style, and may not be supported in a future
  * release of SWT.</b>
  *
  * @param display the display to create the tracker on
  * @param style the style of control to construct
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  *       <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
  *     </ul>
  *
  * @see SWT#LEFT
  * @see SWT#RIGHT
  * @see SWT#UP
  * @see SWT#DOWN
  */
 public Tracker(Display display, int style) {
   if (display == null) display = Display.getCurrent();
   if (display == null) display = Display.getDefault();
   if (!display.isValidThread()) {
     error(SWT.ERROR_THREAD_INVALID_ACCESS);
   }
   this.style = checkStyle(style);
   this.display = display;
 }
 public MainViewPresenter(Display display, DataServiceAsync ds) {
   mDisplay = display;
   mapWidget = display.getMapWidget();
   mDataService = ds;
   mDataModel = mDisplay.getDataModel();
   bind();
   bindMap(ds);
   bindMenu(ds);
 }
Ejemplo n.º 27
0
 public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display);
   shell.open();
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
Ejemplo n.º 28
0
 public static void main(String[] args) {
   Display display = new Display();
   AddressBook application = new AddressBook();
   Shell shell = application.open(display);
   while (!shell.isDisposed()) {
     if (!display.readAndDispatch()) display.sleep();
   }
   display.dispose();
 }
Ejemplo n.º 29
0
 /* (non-Javadoc)
  * @see org.eclipse.ui.IStartup#earlyStartup()
  */
 public void earlyStartup() {
   final Display display = Display.getDefault();
   display.syncExec(
       new AERunnable() {
         public void runSupport() {
           hookApplicationMenu(display);
         }
       });
 }
  @SuppressWarnings("deprecation")
  public void bind() {

    // modificar el menú de inicio de sesión para los visitantes que no han
    // iniciado sesión
    if (!AppController.getNivelAccesoActual().equals(NivelAcceso.VISITANTE)) {

      display.getEnlaceLogin().setText(AppController.getI18nConstantes().cerrar_sesion());
      display.getEnlaceLogin().setTargetHistoryToken("");

      display
          .getEnlaceLogin()
          .addClickHandler(
              new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {

                  rpcService.cerrarSesion(
                      new Fragmentos.ManejadorCierreSesion(rpcService, eventBus));
                }
              });

    } else {
      display.getEnlacePerfil().setText("");
    }

    // consultar los datos de la instancia

    display.getIndicadorDeCargaDePagina().agregarLlamada();

    rpcService.mIGetInstancia(
        idInstanciaDeseada,
        new AsyncCallback<Instancia>() {

          @Override
          public void onSuccess(final Instancia result) {

            display.getIndicadorDeCargaDePagina().quitarLlamada();

            procesarInstanciaLeida(result);
          }

          @Override
          public void onFailure(Throwable caught) {
            // no hay resultados...

            GWT.log("Falla, no hay instancia para esta sesión:", caught);

            display.getIndicadorDeCargaDePagina().quitarLlamada();

            // enviar a la página de error
            eventBus.fireEvent(new EventoPaginaError());
          }
        });
  }