private void saveColumnVisibility() {
    final boolean[] columnVisibility = new boolean[treeTableView.getColumns().size()];

    for (int i = 0; i < columnVisibility.length; i++) {
      columnVisibility[i] = treeTableView.getColumns().get(i).isVisible();
    }

    preferences.put(COLUMN_VISIBILITY, EncodeDecode.encodeBooleanArray(columnVisibility));
  }
  private void restoreColumnVisibility() {
    final String result = preferences.get(COLUMN_VISIBILITY, null);

    if (result != null) {
      boolean[] columnVisibility = EncodeDecode.decodeBooleanArray(result);

      if (columnVisibility.length == treeTableView.getColumns().size()) {
        for (int i = 0; i < columnVisibility.length; i++) {
          treeTableView.getColumns().get(i).setVisible(columnVisibility[i]);
        }
      }
    }
  }