/** * Adds information used by proxy/server * @param row {@link org.apache.karaf.shell.support.table.ShellTable}'s row to add information to * @param id2Password mapping of ids (servers/proxies to decrypted passwords) * @param id ID of proxy or server from <code>settings.xml</code> * @param password password to use if decryption failed */ protected void addPasswordInfo(Row row, Map<String, String> id2Password, String id, String password) { if (id2Password.containsKey(id)) { row.addContent(id2Password.get(id)); } else { if (cipher.isEncryptedString(password)) { row.addContent(password + " (can't decrypt)"); } else { row.addContent(password == null ? "" : password); } } }
var Row = function () { this.a = 1; } var myRow = new Row(); myRow.a // this will give you your 'a'
private static Triangle generateTriangle() { Triangle triangle = new Triangle(); Random random = new Random(); for (int i = 0; i < TRIANGLE_HEIGHT; i++) { Row row = new Row(); int maxTemp=0; for (int j = 0; j <= i; j++) { int rand=random.nextInt(100); row.add(rand); if(rand>maxTemp) maxTemp=rand; //will get max value for the row } maxRowVal.add(maxTemp); triangle.add(row); } return triangle; }
public int doStartTag() throws JspException { // some code here ArrayList<Row> rowList = new ArrayList<>(); while(set.next()){ //pageContext.getOut().print("<br>" + set.getString("empName")); Row currRow = new Row(); currRow.setValue(set.getString("empName")); rowList.add(currRow); } pageContext.setAttribute("result", rowList); // some more code }
List<Row> list = new ArrayList<>(); try { JSONObject json = new JSONObject(result); JSONArray jArray = json.getJSONArray("DATA"); for (int i = 0; i < jArray.length(); i++) { JSONObject json_data = jArray.getJSONObject(i); Row data = new Row(); // Create Object Here data.setRow(json_data.getInt("Row")); JSONArray arr = json_data.getJSONArray("Data"); for(int j = 0; j < arr.length(); j++) { JSONObject innerData = arr.getJSONObject(j); DataObj dataObj = new DataObj(); // Create Object here dataObj.setShowTitle(innerData.getString("ShowTitle")); data.setDataObj(dataObj); // setting the dataObj //Add the DataObj to a list in the Row object data.addDataObject(dataObj); } list.add(data); // Finally adding the model to List } } catch (JSONException e) { e.printStackTrace(); }
List<Row> list = new ArrayList<>(); try { JSONObject json = new JSONObject(result); JSONArray jArray = json.getJSONArray("DATA"); for (int i = 0; i < jArray.length(); i++) { JSONObject json_data = jArray.getJSONObject(i); JSONArray arr = json_data.getJSONArray("Data"); for(int j = 0; j < arr.length(); j++) { Row data = new Row(); // Create Object Here data.setRow(json_data.getInt("Row")); JSONObject innerData = arr.getJSONObject(j); DataObj dataObj = new DataObj(); // Create Object here dataObj.setShowTitle(innerData.getString("ShowTitle")); data.setDataObj(dataObj); // setting the dataObj list.add(data); } // Finally adding the model to List } } catch (JSONException e) { e.printStackTrace(); }
Row headerRow = new Row(cols); headerRow.formatContent(cols); for (Row row : rows) { row.formatContent(cols); String headerLine = headerRow.getContent(cols, separator); out.println(headerLine); int iCol = 0; if (!format) { if (separator == null || separator.equals(DEFAULT_SEPARATOR)) out.println(row.getContent(cols, DEFAULT_SEPARATOR_NO_FORMAT)); else out.println(row.getContent(cols, separator)); } else { out.println(row.getContent(cols, separator));
final List<Row> rows = new ArrayList<>(); addTableField.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { HBox box = new HBox(10); ComboBox<String> combo = new ComboBox<String>(fieldTypes); combo.setPromptText("type"); TextField field = new TextField(); field.setPromptText("field label"); box.getChildren().addAll(field, combo); fieldContainer.getChildren().addAll(box); Row row = new Row(); rows.add(row); row.labelProperty().bind(field.textProperty()); row.typeProperty().bind(combo.valueProperty()); // might need to worry about null values... window.sizeToScene(); } });
public List<Row> list() throws SQLException { Connection connection = null; Statement statement = null; ResultSet resultSet = null; List<Row> rows = new ArrayList<Row>(); try { connection = database.getConnection(); statement = connection.createStatement(); resultSet = statement.executeQuery(SQL_LIST); while (resultSet.next()) { Row row = new Row(); row.setName(resultSet.getString("name")); // ... rows.add(row); } } finally { if (resultSet != null) try { resultSet.close(); } catch (SQLException logOrIgnore) {} if (statement != null) try { statement.close(); } catch (SQLException logOrIgnore) {} if (connection != null) try { connection.close(); } catch (SQLException logOrIgnore) {} } return rows; }
/** * Helper to add row to {@link ShellTable} * @param table * @param label * @param value * @param descriptionText */ private <T> void addRow(ShellTable table, String label, SourceAnd<T> value, String descriptionText) { Row row = table.addRow(); row.addContent(label, value.val()); if (source) { row.addContent(value.source); } if (description) { row.addContent(descriptionText); } }
abstract public class Table<RowClass extends Row>{ public List<RowClass> fetchAll() { //Fetch the stuff here //In the while class to add each row to the array RowClass row = (RowClass) new Row(); } }
private List<String> displayGroupRoles(BackingEngine engine, String userName, GroupPrincipal group, ShellTable table) { List<String> names = new ArrayList<>(); List<RolePrincipal> roles = engine.listRoles(group); if (roles != null && roles.size() >= 1) { for (RolePrincipal role : roles) { String roleName = role.getName(); names.add(roleName); table.addRow().addContent(userName, group.getName(), roleName); } } return names; }
while (result.next()) { Row row = new Row(); row.internalCode = (((result_data = result.getObject("internal_code"))==null || result.wasNull())?" ":result_data.toString()); row.externalRepresentation = (((result_data = result.getObject("external_representation"))==null || result.wasNull())?" ":result_data.toString()); row.sorter = (((result_data = result.getObject("sorter"))==null || result.wasNull())?" ":result_data.toString()); row.sDate = (((result_data = result.getObject("sDate"))==null || result.wasNull())?" ":result_data.toString()); }
private List<String> displayGroupRoles(BackingEngine engine, String userName, GroupPrincipal group, ShellTable table) { List<String> names = new ArrayList<>(); List<RolePrincipal> roles = engine.listRoles(group); if (roles != null && roles.size() >= 1) { for (RolePrincipal role : roles) { String roleName = role.getName(); names.add(roleName); table.addRow().addContent(userName, group.getName(), roleName); } } return names; }
while ((line = br.readLine()) != null) { String[] row = line.split("\\s+"); Row row = new Row(); row.setId(row[0]); row.setFirstName(row[1]); row.setSecondName(row[2]); row.setDateOfbrth(row[3]); InfoList.add(row); }
@Override public Object execute() throws Exception { ShellTable table = new ShellTable(); Map<String, List<String>> map = this.getJdbcService().tables(datasource); int rowCount = 0; for (String column : map.keySet()) { table.column(column); rowCount = map.get(column).size(); } for (int i = 0; i < rowCount; i++) { Row row = table.addRow(); for (String column : map.keySet()) { row.addContent(map.get(column).get(i)); } } table.print(System.out); return null; }