Skip to content
Permalink
Browse files

tweak update

  • Loading branch information...
icklesteve committed Jul 26, 2019
1 parent cfdd33a commit a9bbd199b8468fb2a7f582eb50ba835a519c24f7
Showing with 295 additions and 331 deletions.
  1. +0 −3 java/src/jmri/jmrix/can/cbus/CbusPreferences.java
  2. +8 −16 java/src/jmri/jmrix/can/cbus/node/CbusNode.java
  3. +1 −7 java/src/jmri/jmrix/can/cbus/node/CbusNodeEventTableDataModel.java
  4. +13 −15 java/src/jmri/jmrix/can/cbus/node/CbusNodeFromBackup.java
  5. +37 −31 java/src/jmri/jmrix/can/cbus/node/CbusNodeNVTableDataModel.java
  6. +24 −9 java/src/jmri/jmrix/can/cbus/node/CbusNodeTableDataModel.java
  7. +34 −5 java/src/jmri/jmrix/can/cbus/node/CbusNodeXml.java
  8. +41 −59 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeBackupsPane.java
  9. +50 −43 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeEditNVarPane.java
  10. +7 −19 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeInfoPane.java
  11. +0 −6 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeNVEditTablePane.java
  12. +0 −6 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeNVTablePane.java
  13. +0 −9 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeRestoreFcuFrame.java
  14. +1 −7 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeSetupPane.java
  15. +0 −14 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeTablePane.java
  16. +0 −1 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeUserCommentsPane.java
  17. +78 −49 java/src/jmri/jmrix/can/cbus/swing/nodeconfig/NodeConfigToolPane.java
  18. +1 −3 java/test/jmri/jmrix/can/cbus/node/CbusNodeNVTableDataModelTest.java
  19. +0 −8 java/test/jmri/jmrix/can/cbus/node/CbusNodeTableDataModelTest.java
  20. +0 −8 java/test/jmri/jmrix/can/cbus/node/CbusNodeTest.java
  21. +0 −13 java/test/jmri/jmrix/can/cbus/swing/nodeconfig/CbusNodeEditNVarPaneTest.java
@@ -49,10 +49,8 @@ private void readPreferences(Preferences sharedPreferences) {
"searchForNodesBackupXmlOnStartup",this.getSearchForNodesBackupXmlOnStartup() );
this.minimumNumBackupsToKeep = sharedPreferences.getInt(
"minimumNumBackupsToKeep",this.getMinimumNumBackupsToKeep() );

this._saveRestoreEventTable = sharedPreferences.getBoolean(
"saveRestoreEventTable",this.getSaveRestoreEventTable() );

}

public void savePreferences() {
@@ -69,7 +67,6 @@ public void savePreferences() {

sharedPreferences.putBoolean("searchForNodesBackupXmlOnStartup", this.getSearchForNodesBackupXmlOnStartup() );
sharedPreferences.putInt("minimumNumBackupsToKeep", this.getMinimumNumBackupsToKeep() );

sharedPreferences.putBoolean("saveRestoreEventTable", this.getSaveRestoreEventTable() );

try {
@@ -417,22 +417,18 @@ public int getOutstandingParams(){
*
*/
protected void sendRequestNextParam(){

if ( hasActiveTimers() ){
return;
}

if ( _parameters == null ) {
requestParam(0);
return;
}
if ( getParameter(1) < 0 ) {
// log.info("requesting param 1");
requestParam(1);
return;
}
if ( getParameter(3) < 0 ) {
// log.info("requesting param 3");
requestParam(3);
return;
}
@@ -562,11 +558,9 @@ public float floatPercentageRemaining(){
*/
protected void checkNodeFinishedLoad(){

if (totalRemainingNodeBytes() == 0) {
if (!backupStarted) {
if (!thisNodeBackupFile.doStore(true) ) {
log.error("Unable to save to Node Backup File");
}
if ((!backupStarted) && totalRemainingNodeBytes() == 0) {
if (!thisNodeBackupFile.doStore(true) ) {
log.error("Unable to save to Node Backup File");
}
}
// reset value if node comes online after being offline
@@ -873,7 +867,6 @@ public void setNV( int index, int newnv ) {
* so Index 1 is NV1 .. Index 255 is NV255
*
* @return Array of NV's, first in index is Total NV's
*
*/
public int[] getNvArray() {
return _nvArray;
@@ -882,7 +875,6 @@ public void setNV( int index, int newnv ) {
/**
* Number of Node Variables on the node.
* @return 0 if number of NV's unknown, else number of NV's.
*
*/
public int getTotalNVs() {
if ( _nvArray==null){
@@ -1044,7 +1036,6 @@ private void setEvIndexValid( boolean newval ) {
}

private CbusNodeEditEventFrame evEditFrame;

private ArrayList<CbusNodeEvent> eventsToTeachArray;
private int nextEvInArray;
private int nextEvVar;
@@ -1062,7 +1053,7 @@ public void sendNewEvSToNode( ArrayList<CbusNodeEvent> evArray,
CbusNodeEditEventFrame frame,
NodeConfigToolPane mainPane ){

// log.info("send new events to node");
// log.info("send new events to node");
_mainPane = mainPane;
evEditFrame = frame;
eventsToTeachArray = evArray;
@@ -1600,7 +1591,6 @@ private void clearAllParamTimeout(){
* Start timer for a Parameter request
* If 10 timeouts are counted, aborts loop, sets 8 parameters to 0
* and node events array to 0
*
*/
private void setAllParamTimeout( int index) {
clearAllParamTimeout(); // resets if timer already running
@@ -1621,6 +1611,10 @@ public void run() {
TimerUtil.schedule(allParamTask, ( SINGLE_MESSAGE_TIMEOUT_TIME ) );
}

/**
* Set node on network
* @param isFound false if not on network
*/
protected void nodeOnNetwork( boolean isFound ) {

if (!isFound) {
@@ -2173,9 +2167,7 @@ else if ( opc == CbusConstants.CBUS_EVLRNI ) {
if (m.getElement(3)==5){
// node reporting that last requested and further event variables for single event
// are not required by the node, no need to request them

remainingEvVarsNotNeeded();

}
else {
if ((m.getElement(3) > 0 ) && (m.getElement(3) < 13 )) {
@@ -241,14 +241,8 @@ public void setNode( CbusNode node){
}

/**
* To close window after testing
* Receive update from CbusNode that table has changed
*/
// protected void disposeEvFrame(){
// if ( _mainpane.getEditEvFrame() != null ) {
// _mainpane.getEditEvFrame().dispose();
// }
// }

public void updateFromNode( int arrayid, int col){

ThreadingUtil.runOnGUI( ()->{
@@ -14,36 +14,36 @@
// import org.slf4j.LoggerFactory;

/**
* Class to represent a node imported from FCU file.
* Class to represent a node imported from FCU file or CbusNodeXml.
*
* @author Steve Young Copyright (C) 2019
*/
public class CbusNodeFromBackup extends CbusNode implements Comparable<CbusNodeFromBackup> {

private Date _timeStamp;
private String _backupComment="";
private String _backupComment;
private BackupType _backupType;

/**
* Create a new CbusNodeFrommBackup by connection type and Node Number
* <p>
*
* @param connmemo CAN Connection
* @param nodenumber Node Number between 1 and 65535
*/
public CbusNodeFromBackup ( CanSystemConnectionMemo connmemo, int nodenumber ){
super( connmemo, nodenumber );
_backupComment = "";
}

/**
* Create a new CbusNodeFrommBackup from an existing Node
* <p>
*
* @param node The Node to make a copy of
* @param timeStamp to set the Backup TimeStamp
*/
public CbusNodeFromBackup ( CbusNode node, Date timeStamp) {
super( null, node.getNodeNumber() );
_backupComment = "";
setBackupResult(BackupType.INCOMPLETE);
_timeStamp = timeStamp;
if (node.getParameters()!=null) {
@@ -71,15 +71,14 @@ public CbusNodeFromBackup ( CbusNode node, Date timeStamp) {

/**
* Set the Backup DateTime
*
* @param thisDate Timestamp
*/
protected void setBackupTimeStamp( Date thisDate){
_timeStamp = thisDate;
}

/**
* Get the Backup DateTime
*
* @return DateTime in format
*/
public Date getBackupTimeStamp(){
@@ -88,8 +87,6 @@ public Date getBackupTimeStamp(){

/**
* Set the Backup Result
* <p>
*
* @param type Backup Type Enum
*/
protected void setBackupResult(BackupType type) {
@@ -98,7 +95,6 @@ protected void setBackupResult(BackupType type) {

/**
* Get the Backup Result
*
* @return enum
*/
public BackupType getBackupResult() {
@@ -107,7 +103,6 @@ public BackupType getBackupResult() {

/**
* Set the backup comment
*
* @param backupComment text representation of the single backup state
*/
public void setBackupComment(String backupComment) {
@@ -116,7 +111,6 @@ public void setBackupComment(String backupComment) {

/**
* Get the Backup Comment
* <p>
* eg. Completed No Issues, 9 NVs, 12 Events with 4 EVs
*
* @return index number, -1 if unset
@@ -137,6 +131,12 @@ public void addBupEvent(int nn, int en, String evVars){
addNewEvent(buildEv);
}

/**
* Get a String comparison with another CbusNodeFromBackup
*
* @param toTest The CbusNodeFromBackup to test against
* @return eg. "Parameters Changed"
*/
public String compareWithString( CbusNodeFromBackup toTest) {

if (toTest==null){
@@ -185,7 +185,8 @@ public int compareTo(CbusNodeFromBackup o) {
* <p>
* Used for highlighting changes to Node Backups,
* so the Date Time Stamp does NOT need to be equal.
* checking for Node Number, Parameters, NVs, Events
* checking for Node Number, Parameters, NVs, Events.
* Events can be in any order, are sorted mid comparison.
*/
@Override
public boolean equals(Object obj) {
@@ -227,7 +228,6 @@ public boolean equals(Object obj) {

/**
* Get a Hashcode for the Event Array
*
* @return 0 if event array null
*/
public int getEventArrayHash(){
@@ -240,9 +240,7 @@ public int getEventArrayHash(){

/**
* toString reports the Node Number Name and backup timestamp
* <p>
* @return string eg "1234 UserName Backup Sun Jul 07 22:41:22".
*
* {@inheritDoc}
*/
@Override

0 comments on commit a9bbd19

Please sign in to comment.
You can’t perform that action at this time.