Pregunta

Trato de uso resultado se obtiene de un API denominada j-Calais, y luego fuera a poner el resultado en una página web, escribo todo el código en el cliente, pero no puedo compilar derecha, saber por qué no haga ??? por favor ayuda. el código fuente, como a continuación:

no surge ningún error obvio, pero no puedo ser de compilación con éxito ..... muchas gracias:

pública onModuleLoad void () { // Crear una tabla de datos de saldos. stocksFlexTable.setText (0, 0, "Type"); stocksFlexTable.setText (0, 1, "Nombre");

// Assemble Add Stock panel.
addPanel.add(newSymbolTextBox);
addPanel.add(addStockButton);

// Assemble Main panel.
mainPanel.add(stocksFlexTable);
mainPanel.add(addPanel);
mainPanel.add(lastUpdatedLabel);

// Associate the Main panel with the HTML host page.
RootPanel.get("stockList").add(mainPanel);

// Move cursor focus to the input box.
newSymbolTextBox.setFocus(true);

// detectar eventos del ratón sobre el botón Añadir. addStockButton.addClickHandler (nueva clickHandler () { public void onClick (evento ClickEvent) {

                        try {
                            addStock();
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

  }
});
// Listen for keyboard events in the input box.
newSymbolTextBox.addKeyPressHandler(new KeyPressHandler() {
  public void onKeyPress(KeyPressEvent event) {
    if (event.getCharCode() == KeyCodes.KEY_ENTER) {  
            try {
                addStock();
            } catch (Exception e) {
                e.printStackTrace();
            }
  }
  }
});

}

private void addStock() throws Exception {
  final String url_s = newSymbolTextBox.getText().toUpperCase().trim();
  newSymbolTextBox.setFocus(true);
  newSymbolTextBox.setText("");
  int row = stocksFlexTable.getRowCount();


  CalaisClient client = new CalaisRestClient("ysw5rx69jkvdnzqf6sgjduqj");
    System.out.print("read success...\n");
     URL url = new URL(url_s);    
     CalaisResponse response = client.analyze(url);         
        for (CalaisObject entity : response.getEntities()) {
            System.out.println(entity.getField("_type") + ":" 
                               + entity.getField("name"));
            stocks.add(entity.getField("_type"));
            stocksFlexTable.setText(row, 0, entity.getField("_type"));
            stocksFlexTable.setText(row, 1, entity.getField("name"));
          }

        for (CalaisObject topic : response.getTopics()) {
            System.out.println(topic.getField("categoryName"));
          }

}

}

¿Fue útil?

Solución

GWT sólo mangos excepciones sin marcar para que pueda tirar Las excepciones de tiempo de ejecución

o escribir su propio excepción de que extiende Tiempo de ejecución de Excepción a continuación, que no causa ningún problema en tiempo de compilación

void f() throws NullPointerException // will not cause any problem because it is Runtime exception so unchecked

void f() throws IllegalAccessException // it is checked exception so there will be problem at compile time
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top