Esempio n. 1
0
 /** Return a button that invokes javascript when clicked. */
 Input jsButton(String label, String js) {
   Input btn = new Input("button", null);
   btn.attribute("value", label);
   setTabOrder(btn);
   btn.attribute("onClick", js);
   return btn;
 }
Esempio n. 2
0
 /**
  * Return a labelled rasio button
  *
  * @param label appears to right of circle if non null
  * @param value value assigned to key if box checked
  * @param key form key to which value is assigned
  * @param checked if true, is initially checked
  * @return a readio button Element
  */
 protected Element radioButton(String label, String value, String key, boolean checked) {
   Composite c = new Composite();
   Input in = new Input(Input.Radio, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   c.add(in);
   c.add(label);
   return c;
 }
Esempio n. 3
0
 /**
  * Return a (possibly labelled) checkbox.
  *
  * @param label appears to right of checkbox if non null
  * @param value value included in result set if box checked
  * @param key form key to which result set is assigned
  * @param checked if true, box is initially checked
  * @return a checkbox Element
  */
 Element checkBox(String label, String value, String key, boolean checked) {
   Input in = new Input(Input.Checkbox, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   if (StringUtil.isNullString(label)) {
     return in;
   } else {
     Composite c = new Composite();
     c.add(in);
     c.add(" ");
     c.add(label);
     return c;
   }
 }
Esempio n. 4
0
 /**
  * Return a button that invokes the javascript submit routine with the specified action, first
  * storing the value in the specified form prop.
  */
 protected Element submitButton(String label, String action, String prop, String value) {
   StringBuilder sb = new StringBuilder(40);
   sb.append("lockssButton(this, '");
   sb.append(action);
   sb.append("'");
   if (prop != null && value != null) {
     sb.append(", '");
     sb.append(prop);
     sb.append("', '");
     sb.append(value);
     sb.append("'");
   }
   sb.append(")");
   Input btn = jsButton(label, sb.toString());
   btn.attribute("id", "lsb." + (++submitButtonNumber));
   return btn;
 }
Esempio n. 5
0
  private static Input generateInput() {
    int m = 10;
    int n = 5;
    Input input = new Input();

    // generate element for A and B in alternative pattern,
    // i.e. A contains odd number, B contains even number
    input.m = m;
    input.A = new int[m + n]; // reverse enough buffer for B
    for (int i = 0; i < m; i++) input.A[i] = 2 * i + 1; // odd number

    input.n = n;
    input.B = new int[n];
    for (int i = 0; i < n; i++) input.B[i] = 2 * i; // even number

    return input;
  }
Esempio n. 6
0
 public Input copy() {
   Input clone = new Input();
   clone.method = this.method;
   clone.taglet = this.taglet;
   clone.tagId = this.tagId;
   clone.tag = this.tag;
   clone.isFirstSentence = this.isFirstSentence;
   clone.isInheritDocTag = this.isInheritDocTag;
   clone.isTypeVariableParamTag = this.isTypeVariableParamTag;
   return clone;
 }
Esempio n. 7
0
  /**
   * Search for the requested comments in the given method. If it does not have comments, return
   * documentation from the overriden method if possible. If the overriden method does not exist or
   * does not have documentation to inherit, search for documentation to inherit from implemented
   * methods.
   *
   * @param input the input object used to perform the search.
   * @return an Output object representing the documentation that was found.
   */
  public static Output search(Input input) {
    Output output = new Output();
    if (input.isInheritDocTag) {
      // Do nothing because "method" does not have any documentation.
      // All it has it {@inheritDoc}.
    } else if (input.taglet == null) {
      // We want overall documentation.
      output.inlineTags =
          input.isFirstSentence ? input.method.firstSentenceTags() : input.method.inlineTags();
      output.holder = input.method;
    } else {
      input.taglet.inherit(input, output);
    }

    if (output.inlineTags != null && output.inlineTags.length > 0) {
      return output;
    }
    output.isValidInheritDocTag = false;
    Input inheritedSearchInput = input.copy();
    inheritedSearchInput.isInheritDocTag = false;
    if (input.method.overriddenMethod() != null) {
      inheritedSearchInput.method = input.method.overriddenMethod();
      output = search(inheritedSearchInput);
      output.isValidInheritDocTag = true;
      if (output != null && output.inlineTags.length > 0) {
        return output;
      }
    }
    // NOTE:  When we fix the bug where ClassDoc.interfaceTypes() does
    //       not pass all implemented interfaces, we will use the
    //       appropriate method here.
    MethodDoc[] implementedMethods = (new ImplementedMethods(input.method, null)).build(false);
    for (int i = 0; i < implementedMethods.length; i++) {
      inheritedSearchInput.method = implementedMethods[i];
      output = search(inheritedSearchInput);
      output.isValidInheritDocTag = true;
      if (output != null && output.inlineTags.length > 0) {
        return output;
      }
    }
    return output;
  }
  public static Desporto atSAltimetria(String atividade, Utilizador user) {
    Desporto novo;
    System.out.println("Quando foi praticada essa atividade (dd mm aaaa)?");
    GregorianCalendar data = Input.LerData();

    System.out.println("Quanto tempo durou a atividade física (hh mm ss)");
    Tempo t = Input.lerTempo();

    String weather = Input.lerClima();
    System.out.println("Quantos quilómetros percorreu?");
    double distancia = Input.lerDouble();
    System.out.println("Qual foi a velocidade máxima atingida?");
    double vel_max = Input.lerDouble();
    System.out.println("Qual foi a velocidade mínima atingida?");
    double vel_min = Input.lerDouble();

    if (atividade.equals("Futsal")) {
      novo = new Futsal(user.getPeso(), data, atividade, weather, t, distancia, vel_max, vel_min);
      return novo;
    } else if (atividade.equals("Tenis")) {
      novo = new Tenis(user.getPeso(), data, atividade, weather, t, distancia, vel_max, vel_min);
      return novo;
    } else if (atividade.equals("Futebol")) {
      novo = new Futebol(user.getPeso(), data, atividade, weather, t, distancia, vel_max, vel_min);
      return novo;
    } else if (atividade.equals("Basquetebol")) {
      novo =
          new Basquetebol(user.getPeso(), data, atividade, weather, t, distancia, vel_max, vel_min);
      return novo;
    }
    return null;
  }
  public static Desporto atSDistancia(String atividade, Utilizador user) {
    Desporto novo;
    System.out.println("Quando foi praticada essa atividade (dd mm aaaa)?");
    GregorianCalendar data = Input.LerData();

    String weather = Input.lerClima();
    System.out.println("Quanto tempo durou a atividade física (hh mm ss)");
    Tempo t = Input.lerTempo();

    if (atividade.equals("Musculacao")) {
      novo = new Musculacao(user.getPeso(), data, atividade, weather, t);
      return novo;
    }
    if (atividade.equals("Zumba")) {
      novo = new Zumba(user.getPeso(), data, atividade, weather, t);
      return novo;
    }
    if (atividade.equals("Boxe")) {
      novo = new Boxe(user.getPeso(), data, atividade, weather, t);
      return novo;
    }
    return null;
  }
Esempio n. 10
0
  public static Desporto atCAltimetria(String atividade, Utilizador user) {
    Desporto novo;
    System.out.println("Quando foi praticada essa atividade (dd mm aaaa)?");
    GregorianCalendar data = Input.LerData();

    System.out.println("Quanto tempo durou a atividade física (hh mm ss)");
    Tempo t = Input.lerTempo();

    String weather = Input.lerClima();
    System.out.println("Quantos quilómetros percorreu?");
    double distancia = Input.lerDouble();
    System.out.println("Qual foi a velocidade máxima atingida?");
    double vel_max = Input.lerDouble();
    System.out.println("Qual foi a velocidade mínima atingida?");
    double vel_min = Input.lerDouble();

    System.out.println("Qual foi a altitude máxima atingida?");
    double alt_max = Input.lerDouble();
    System.out.println("Qual foi a altitude mínima atingida?");
    double alt_min = Input.lerDouble();
    System.out.println("Quantos quilómetros percorreu de forma ascendente?");
    double t_asc = Input.lerDouble();
    System.out.println("Quantos quilómetros percorreu de forma descendente?");
    double t_desc = Input.lerDouble();

    if (atividade.equals("Running")) {
      novo =
          new Running(
              user.getPeso(),
              data,
              atividade,
              weather,
              t,
              distancia,
              vel_max,
              vel_min,
              alt_min,
              alt_max,
              t_desc,
              t_asc);
      return novo;
    }
    if (atividade.equals("Ciclismo")) {
      novo =
          new Ciclismo(
              user.getPeso(),
              data,
              atividade,
              weather,
              t,
              distancia,
              vel_max,
              vel_min,
              alt_min,
              alt_max,
              t_desc,
              t_asc);
      return novo;
    }
    if (atividade.equals("Alpinismo")) {
      novo =
          new Alpinismo(
              user.getPeso(),
              data,
              atividade,
              weather,
              t,
              distancia,
              vel_max,
              vel_min,
              alt_min,
              alt_max,
              t_desc,
              t_asc);
      return novo;
    }
    return null;
  }
Esempio n. 11
0
  private Element makeForm() {
    Composite comp = new Composite();
    Form frm = new Form(srvURL(myServletDescr()));
    frm.method("POST");

    frm.add("<br><center>");
    Input reload = new Input(Input.Submit, KEY_ACTION, ACTION_RELOAD_CONFIG);
    setTabOrder(reload);
    frm.add(reload);
    frm.add(" ");
    Input backup = new Input(Input.Submit, KEY_ACTION, ACTION_MAIL_BACKUP);
    setTabOrder(backup);
    frm.add(backup);
    frm.add(" ");
    Input crawlplug = new Input(Input.Submit, KEY_ACTION, ACTION_CRAWL_PLUGINS);
    setTabOrder(crawlplug);
    frm.add(crawlplug);
    frm.add("</center>");
    ServletDescr d1 = AdminServletManager.SERVLET_HASH_CUS;
    if (isServletRunnable(d1)) {
      frm.add("<br><center>" + srvLink(d1, d1.heading) + "</center>");
    }
    Input findUrl = new Input(Input.Submit, KEY_ACTION, ACTION_FIND_URL);
    Input findUrlText = new Input(Input.Text, KEY_URL);
    findUrlText.setSize(50);
    setTabOrder(findUrl);
    setTabOrder(findUrlText);
    frm.add("<br><center>" + findUrl + " " + findUrlText + "</center>");

    Input thrw = new Input(Input.Submit, KEY_ACTION, ACTION_THROW_IOEXCEPTION);
    Input thmsg = new Input(Input.Text, KEY_MSG);
    setTabOrder(thrw);
    setTabOrder(thmsg);
    frm.add("<br><center>" + thrw + " " + thmsg + "</center>");

    frm.add("<br><center>AU Actions: select AU</center>");
    Composite ausel = ServletUtil.layoutSelectAu(this, KEY_AUID, formAuid);
    frm.add("<br><center>" + ausel + "</center>");
    setTabOrder(ausel);

    Input v3Poll =
        new Input(
            Input.Submit,
            KEY_ACTION,
            (showForcePoll ? ACTION_FORCE_START_V3_POLL : ACTION_START_V3_POLL));
    Input crawl =
        new Input(
            Input.Submit,
            KEY_ACTION,
            (showForceCrawl ? ACTION_FORCE_START_CRAWL : ACTION_START_CRAWL));

    frm.add("<br><center>");
    frm.add(v3Poll);
    frm.add(" ");
    frm.add(crawl);
    if (CurrentConfig.getBooleanParam(PARAM_ENABLE_DEEP_CRAWL, DEFAULT_ENABLE_DEEP_CRAWL)) {
      Input deepCrawl =
          new Input(
              Input.Submit,
              KEY_ACTION,
              (showForceCrawl ? ACTION_FORCE_START_DEEP_CRAWL : ACTION_START_DEEP_CRAWL));
      Input depthText = new Input(Input.Text, KEY_REFETCH_DEPTH, formDepth);
      depthText.setSize(4);
      setTabOrder(depthText);
      frm.add(" ");
      frm.add(deepCrawl);
      frm.add(depthText);
    }
    Input checkSubstance = new Input(Input.Submit, KEY_ACTION, ACTION_CHECK_SUBSTANCE);
    frm.add("<br>");
    frm.add(checkSubstance);
    if (metadataMgr != null) {
      Input reindex =
          new Input(
              Input.Submit,
              KEY_ACTION,
              (showForceReindexMetadata ? ACTION_FORCE_REINDEX_METADATA : ACTION_REINDEX_METADATA));
      frm.add(" ");
      frm.add(reindex);
      Input disableIndexing = new Input(Input.Submit, KEY_ACTION, ACTION_DISABLE_METADATA_INDEXING);
      frm.add(" ");
      frm.add(disableIndexing);
    }
    frm.add("</center>");

    comp.add(frm);
    return comp;
  }
Esempio n. 12
0
  public void display(GLAutoDrawable gLDrawable) {
    key = Input.keysPressed();

    double dt = (System.currentTimeMillis() - dt_timer) / 1000.0;
    dt_timer = System.currentTimeMillis();

    // Start 3d Rendering
    GL gl = gLDrawable.getGL();

    gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);

    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    gl.glLoadIdentity();

    GLU glu = new GLU();

    // Code to adjust camera
    if (input.getKey(KeyEvent.VK_UP)) z -= .5 * dt;
    if (input.getKey(KeyEvent.VK_DOWN)) z += .5 * dt;

    if (input.getKey(KeyEvent.VK_LEFT)) y -= .5 * dt;
    if (input.getKey(KeyEvent.VK_RIGHT)) y += .5 * dt;
    if (input.getKey(KeyEvent.VK_SPACE)) System.out.println(y + " " + z);

    glu.gluLookAt(0, y, z, 0, 0, -3, 0, 1, 0);

    // orangeNote.drawBar(gLDrawable, zTest);
    // redNote.draw(gLDrawable, -3f, -4f, zTest);
    // yellowNote.draw(gLDrawable, -1.5f, -4f, zTest);
    // blueNote.draw(gLDrawable, 0f, -4f, zTest);
    // greenNote.draw(gLDrawable, 1.5f, -4f, zTest);
    zTest += 0.005f;
    if (zTest > -2f) zTest = -10f;

    gl.glPushMatrix();
    gl.glEnable(GL.GL_BLEND);
    // gl.glRotatef(70,1,-2,1);

    gl.glBegin(GL.GL_QUADS);
    // Draw the Board
    // x goes basically from -1 to 1(camera changed tho)
    // y stays same
    // board length is -z
    gl.glColor4f(40 / 256f, 100 / 256f, 150 / 256f, 1f); // R,G,B,A
    gl.glVertex3f(-3f, -4f, 0f); // x,y,z

    gl.glColor4f(40 / 256f, 100 / 256f, 150 / 256f, 1f);
    gl.glVertex3f(3f, -4f, 0f);

    gl.glColor4f(60 / 256f, 150 / 256f, 200 / 256f, 0f);
    gl.glVertex3f(3f, -4f, -10f);

    gl.glColor4f(60 / 256f, 150 / 256f, 200 / 256f, 0f);
    gl.glVertex3f(-3f, -4f, -10f);

    // All y values on top of the Board must have at least
    // 0.0001f added for some reason
    // Bottom bar - Orange
    gl.glColor4f(255 / 256f, 165 / 256f, 0 / 256f, 1f);
    gl.glVertex3f(-3f, -4f + .0001f, -2.15f); // close left
    gl.glVertex3f(3f, -4f + .0001f, -2.15f); // close right
    gl.glVertex3f(3f, -4f + .0001f, -2.85f); // far right
    gl.glVertex3f(-3f, -4f + .0001f, -2.85f); // far left
    // RedNote
    gl.glColor4f(1f, 0f, 0f, 1f);
    gl.glVertex3f(-3f, -4f + .001f, -2.25f);
    gl.glVertex3f(-1.5f, -4f + .001f, -2.25f);
    gl.glVertex3f(-1.5f, -4f + .001f, -2.75f);
    gl.glVertex3f(-3f, -4f + .001f, -2.75f);
    // YellowNote
    gl.glColor4f(1f, 1f, 0f, 1f);
    gl.glVertex3f(-1.5f, -4f + .001f, -2.25f);
    gl.glVertex3f(0f, -4f + .001f, -2.25f);
    gl.glVertex3f(0f, -4f + .001f, -2.75f);
    gl.glVertex3f(-1.5f, -4f + .001f, -2.75f);
    // BlueNote
    gl.glColor4f(0f, 0f, 1f, 1f);
    gl.glVertex3f(0f, -4f + .001f, -2.25f);
    gl.glVertex3f(1.5f, -4f + .001f, -2.25f);
    gl.glVertex3f(1.5f, -4f + .001f, -2.75f);
    gl.glVertex3f(0f, -4f + .001f, -2.75f);
    // GreenNote
    gl.glColor4f(0f, 1f, 0f, 1f);
    gl.glVertex3f(1.5f, -4f + .001f, -2.25f);
    gl.glVertex3f(3f, -4f + .001f, -2.25f);
    gl.glVertex3f(3f, -4f + .001f, -2.75f);
    gl.glVertex3f(1.5f, -4f + .001f, -2.75f);
    // End Bottom Bar

    this.renderNotes(gLDrawable, dt);

    /////////////////////////////////////
    gl.glEnd();

    gl.glDisable(GL.GL_BLEND);
    gl.glPopMatrix();

    try {
      Thread.sleep(1);
    } catch (Exception e) {
    }
  }
 @Test
 public void testDate() {
   new TypeScriptGenerator(settings(DateMapping.asDate, "AsDate"))
       .generateTypeScript(Input.from(Dates.class), Output.to(new File("target/test-date.d.ts")));
 }