@Override
 public void initialize(final URL url, final ResourceBundle resourceBundle) {
   final ObservableList<Node> children = content.getChildren();
   views.addAll(children);
   children.removeAll(views);
   children.add(views.get(0));
 }
Example #2
0
  public void initialize() {
    txtAPIKey
        .textProperty()
        .addListener(
            (obs, ov, nv) -> {
              ObservableList<String> styleClass = txtAPIKey.getStyleClass();
              if (!APIKey.isValid(nv)) {
                styleClass.removeAll("field-ok");
                if (!styleClass.contains("field-error")) styleClass.add("field-error");
              } else {
                styleClass.removeAll("field-error");
                if (!styleClass.contains("field-ok")) styleClass.add("field-ok");
              }
            });

    String apiKey = GW2Tools.inst().getAppSettings().apiKey.getValue();
    if (apiKey != null && apiKey.length() > 0) {
      txtAPIKey.setText(apiKey);
      chkbxRememberKey.setSelected(true);
    }

    GW2Tools.inst().getAssets().updateGW2Assets(this);
  }
 @Test
 public void testItemsRemovedAtAndBetween() {
   int[] indices = new int[] {1, 3, 5, 7};
   indicesList.addIndices(indices);
   report.clear();
   //        new PrintingListChangeListener("Items removed at 2/4", indicesList);
   items.removeAll(items.get(3), items.get(6));
   indices = new int[] {1, 4, 5};
   assertEquals(indices.length, indicesList.size());
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
   assertTrue(
       "expected single replaced but was" + report.getLastChange(),
       wasSingleReplaced(report.getLastChange()));
 }
  /**
   * Populate the ListView and TreeView (left and right window respectively) with content returned
   * by TaskieLogic.
   *
   * @param mainList ArrayList to be displayed on left window wrapped in LogicOutput class returned
   *     by Logic
   * @param allList 2D ArrayList to be displayed on right window wrapped in LogicOutput class
   *     returned by Logic
   */
  private void populate(ArrayList<String> mainList, ArrayList<ArrayList<String>> allList) {
    clearNode();
    populateNode(overdueNode, allList.get(OVERDUE_LOGICOUT_INDEX));
    populateNode(todayNode, allList.get(TODAY_LOGICOUT_INDEX));
    populateNode(tomorrowNode, allList.get(TOMORROW_LOGICOUT_INDEX));
    populateNode(everythingElseNode, allList.get(EVERYTHING_ELSE_LOGICOUT_INDEX));

    String mainFeedback = mainList.get(FEEDBACK_LOGICOUT_INDEX);
    ArrayList<String> mainRemovedFirst = mainList;

    // Extract the first element of mainList and display it on the mainListFeedbackLabel
    // Display the rest of the list on mainListView
    mainRemovedFirst.remove(FEEDBACK_LOGICOUT_INDEX);
    obeservableMainList.removeAll(obeservableMainList);
    obeservableMainList.addAll(mainRemovedFirst);
    mainListFeedbackLabel.setText(mainFeedback);
    mainListView.setItems(obeservableMainList);
  }
 /** Remove items in between selected. */
 @Test
 public void testItemsRemovedBetweenReally() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   items.removeAll(items.get(2), items.get(4));
   assertEquals(indices.length, indicesList.size());
   indices = new int[] {1, 2, 3};
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
   assertTrue(
       "expected single replaced but was" + report.getLastChange(),
       wasSingleReplaced(report.getLastChange()));
   Change c = report.getLastChange();
   c.next();
   assertEquals(2, c.getAddedSize());
   assertEquals(c.getAddedSize(), c.getRemovedSize());
   //        report.prettyPrint();
 }
 @Test
 public void testItemsRemovedBeforeAndWithFirst() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   //        new PrintingListChangeListener("Items removed at 0/1", indicesList);
   items.removeAll(items.get(0), items.get(1));
   assertEquals(indices.length - 1, indicesList.size());
   Arrays.sort(indices);
   indices = Arrays.copyOfRange(indices, 1, 3);
   for (int i = 0; i < indices.length; i++) {
     indices[i] = indices[i] - 2;
   }
   for (int i = 0; i < indices.length; i++) {
     assertEquals("expected value at " + i, indices[i], indicesList.get(i).intValue());
   }
   assertEquals(1, report.getEventCount());
   assertTrue(
       "expected single replaced, but was " + report.getLastChange(),
       wasSingleReplaced(report.getLastChange()));
 }