Esempio n. 1
0
  /** Reinitializes widgets to display selected DataNode. */
  protected void refreshView(DataNodeDescriptor node) {
    this.node = node;

    if (node == null) {
      getView().setVisible(false);
      return;
    }

    refreshLocalDataSources();

    for (ObjectBinding binding : bindings) {
      binding.updateView();
    }

    showDataSourceSubview(getFactoryName());
  }
Esempio n. 2
0
  protected void refreshLocalDataSources() {
    localDataSources.clear();

    Map sources =
        getApplication()
            .getCayenneProjectPreferences()
            .getDetailObject(DBConnectionInfo.class)
            .getChildrenPreferences();

    int len = sources.size();
    Object[] keys = new Object[len + 1];

    // a slight chance that a real datasource is called NO_LOCAL_DATA_SOURCE...
    keys[0] = NO_LOCAL_DATA_SOURCE;

    Object[] dataSources = sources.keySet().toArray();
    localDataSources.add(dataSources);
    for (int i = 0; i < dataSources.length; i++) {
      keys[i + 1] = dataSources[i];
    }

    view.getLocalDataSources().setModel(new DefaultComboBoxModel(keys));
    localDataSourceBinding.updateView();
  }