コード例 #1
0
ファイル: RoutesTableModel.java プロジェクト: NomDInet/JMRI
  private synchronized void updateList() {
    // first, remove listeners from the individual objects
    removePropertyChangeRoutes();

    if (_sort == SORTBYID) {
      sysList = manager.getRoutesByIdList();
    } else {
      sysList = manager.getRoutesByNameList();
    }
    // and add them back in
    for (Route route : sysList) {
      route.addPropertyChangeListener(this);
    }
  }
コード例 #2
0
  public SetTrainIconRouteFrame(String routeName) {
    super(Bundle.getMessage("MenuSetTrainIcon"));

    // create route
    if (routeName == null) {
      return;
    }
    _route = RouteManager.instance().getRouteByName(routeName);
    _route.addPropertyChangeListener(this);

    // general GUI config
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    // set tool tips
    placeButton.setToolTipText(Bundle.getMessage("TipPlaceButton") + " " + Setup.getPanelName());
    applyButton.setToolTipText(Bundle.getMessage("TipApplyButton"));
    saveButton.setToolTipText(Bundle.getMessage("TipSaveButton"));

    // Set up the panels
    JPanel pRoute = new JPanel();
    pRoute.setBorder(
        BorderFactory.createTitledBorder(Bundle.getMessage("Route") + " " + _route.getName()));
    pRoute.setLayout(new GridBagLayout());
    addItem(pRoute, previousButton, 0, 0);
    addItem(pRoute, routeLocationName, 1, 0);
    addItem(pRoute, nextButton, 2, 0);

    JPanel pSpin = new JPanel();
    pSpin.setLayout(new GridBagLayout());
    pSpin.setBorder(BorderFactory.createTitledBorder(Bundle.getMessage("TrainIcon")));
    addItem(pSpin, textX, 0, 0);
    addItem(pSpin, spinTrainIconX, 1, 0);
    addItem(pSpin, textY, 2, 0);
    addItem(pSpin, spinTrainIconY, 3, 0);

    JPanel pControl = new JPanel();
    pControl.setLayout(new GridBagLayout());
    pControl.setBorder(BorderFactory.createTitledBorder(""));
    addItem(pControl, placeButton, 0, 0);
    addItem(pControl, applyButton, 1, 0);
    addItem(pControl, saveButton, 2, 0);

    getContentPane().add(pRoute);
    getContentPane().add(pSpin);
    getContentPane().add(pControl);

    // add help menu to window
    addHelpMenu("package.jmri.jmrit.operations.Operations_SetTrainIconCoordinates", true); // NOI18N

    // setup buttons
    addButtonAction(previousButton);
    addButtonAction(nextButton);
    addButtonAction(placeButton);
    addButtonAction(applyButton);
    addButtonAction(saveButton);

    // start off with save button disabled
    saveButton.setEnabled(false);

    updateRoute();

    // setup spinners
    addSpinnerChangeListerner(spinTrainIconX);
    addSpinnerChangeListerner(spinTrainIconY);

    initMinimumSize(new Dimension(Control.panelWidth400, Control.panelHeight400));
  }