示例#1
0
 /**
  * Constructor used by a server to let the client know what types of gestures the server can
  * receive. This constructor automatically writes out the header and descriptor to the link. It
  * does not call the link.end() method to end the transmission, since this will probably be sent
  * along with other sections in a communication to the client.
  *
  * @param link the link to write to.
  * @param descriptor a masked integer (see constants) describing the event to receive.
  * @param sectionEnder the endType string to use for this description, either Link.END_TOTAL if
  *     this is the last section to the client, or END_SECTION if there are more sections
  *     following.
  */
 public LinkActionRequest(Link link, int descriptor, String sectionEnder) throws IOException {
   link.start(Link.ACTION_REQUEST_HEADER);
   link.dos.writeFloat(version);
   descriptor = LinkUtil.setMask(descriptor, CLIENT_NOTIFICATION_MASK);
   link.dos.writeInt(descriptor);
   link.end(sectionEnder);
 }
示例#2
0
  /**
   * Write a MouseEvent on the link to the server.
   *
   * @param descriptor the MASK that describes the event.
   * @param me the MouseEvent
   * @param latPoint the latitude of the mouse event.
   * @param lonPoint the longitude of the mouse event.
   * @param props an array of strings representing key-value pairs.
   * @param link the link to write the gesture to.
   */
  public static void write(
      int descriptor,
      MouseEvent me,
      float latPoint,
      float lonPoint,
      LinkProperties props,
      Link link)
      throws IOException {

    if (props.getProperty(LPC_GRAPHICID) != null) {
      descriptor = LinkUtil.setMask(descriptor, GRAPHIC_ID_MASK);
    }

    link.start(Link.ACTION_REQUEST_HEADER);
    link.dos.writeFloat(version);
    link.dos.writeInt(descriptor);
    link.dos.writeInt(me.getX());
    link.dos.writeInt(me.getY());
    link.dos.writeInt(me.getClickCount());
    link.dos.writeInt(me.getModifiers());
    link.dos.writeFloat(latPoint);
    link.dos.writeFloat(lonPoint);

    props.write(link);

    link.end(Link.END_TOTAL);
  }
示例#3
0
  /**
   * Write a KeyEvent on the link to the server.
   *
   * @param descriptor the MASK that describes the event.
   * @param ke the KeyEvent
   * @param props Properties representing attributes.
   * @param link the Link to write the gesture to.
   */
  public static void write(int descriptor, KeyEvent ke, LinkProperties props, Link link)
      throws IOException {

    link.start(Link.ACTION_REQUEST_HEADER);
    link.dos.writeFloat(version);
    link.dos.writeInt(descriptor);
    link.dos.writeChar(ke.getKeyChar());
    link.dos.writeInt(ke.getModifiers());

    props.write(link);

    link.end(Link.END_TOTAL);
  }
示例#4
0
 /**
  * If a request is not handled, or not understood, reply with this.
  *
  * @throws IOException
  */
 public void huh(Link link) throws IOException {
   link.start(Link.HUH_HEADER);
   link.end(Link.END_TOTAL);
 }