From 46f677d0bd88a9d8023ca0db46ecedeb3d1d77ea Mon Sep 17 00:00:00 2001 From: Dieterich Lawson Date: Tue, 29 Mar 2011 22:26:45 -0500 Subject: [PATCH 1/2] Added "shouldClearRecipientField" to MessagePanelHandler shouldClearRecipientField is a boolean that indicates whether the recipient field of the message panel should be cleared after a message is sent. --- .../ui/handler/message/MessagePanelHandler.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java b/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java index 334db981..407ffee8 100644 --- a/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java +++ b/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java @@ -63,6 +63,8 @@ public class MessagePanelHandler implements ThinletUiEventHandler, SingleGroupSe private int numberToSend = 1; /** The boolean stipulating whether the recipient field should be displayed */ private boolean shouldDisplayRecipientField; + /** The boolean stipulating whether the recipient field should be cleared after a message is sent*/ + private boolean shouldClearRecipientField; /** The boolean stipulating whether we should check the length of the message (we don't in the auto-reply, for example) */ private boolean shouldCheckMaxMessageLength; /** The number of recipients, used to estimate the cost of the message */ @@ -75,6 +77,7 @@ public class MessagePanelHandler implements ThinletUiEventHandler, SingleGroupSe private MessagePanelHandler(UiGeneratorController uiController, boolean shouldDisplay, boolean shouldCheckMaxMessageLength, int numberOfRecipients) { this.uiController = uiController; this.shouldDisplayRecipientField = shouldDisplay; + this.shouldClearRecipientField = true; this.shouldCheckMaxMessageLength = shouldCheckMaxMessageLength; this.numberOfRecipients = numberOfRecipients; } @@ -146,7 +149,9 @@ public void send() { private void clearComponents() { // We clear the components - uiController.setText(find(COMPONENT_TF_RECIPIENT), ""); + if(shouldClearRecipientField){ + uiController.setText(find(COMPONENT_TF_RECIPIENT), ""); + } uiController.setText(find(COMPONENT_TF_MESSAGE), ""); uiController.setText(find(COMPONENT_LB_REMAINING_CHARS), String.valueOf(FrontlineMessage.SMS_LENGTH_LIMIT)); uiController.setText(find(COMPONENT_LB_MSG_NUMBER), "0"); @@ -362,6 +367,14 @@ public void updateCost() { LOG.trace("EXIT"); } + + public boolean shouldClearRecipientField(){ + return shouldClearRecipientField; + } + + public void setShouldClearRecipientField(boolean shouldClearRecipientField){ + this.shouldClearRecipientField = shouldClearRecipientField; + } //> INSTANCE HELPER METHODS From 1744956756e293b577f5ad2e9d0e4e4689cc5dce Mon Sep 17 00:00:00 2001 From: Dieterich Lawson Date: Fri, 1 Apr 2011 11:47:22 -0500 Subject: [PATCH 2/2] Updating MessagePanelHandler code. - changed shouldClearRecipientField -> clearRecipientFieldOnSend - removed useless getter - added space after parameter definition of setter to conform to style guidelines --- .../ui/handler/message/MessagePanelHandler.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java b/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java index 407ffee8..d8518cf3 100644 --- a/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java +++ b/src/main/java/net/frontlinesms/ui/handler/message/MessagePanelHandler.java @@ -64,7 +64,7 @@ public class MessagePanelHandler implements ThinletUiEventHandler, SingleGroupSe /** The boolean stipulating whether the recipient field should be displayed */ private boolean shouldDisplayRecipientField; /** The boolean stipulating whether the recipient field should be cleared after a message is sent*/ - private boolean shouldClearRecipientField; + private boolean clearRecipientFieldOnSend; /** The boolean stipulating whether we should check the length of the message (we don't in the auto-reply, for example) */ private boolean shouldCheckMaxMessageLength; /** The number of recipients, used to estimate the cost of the message */ @@ -77,7 +77,7 @@ public class MessagePanelHandler implements ThinletUiEventHandler, SingleGroupSe private MessagePanelHandler(UiGeneratorController uiController, boolean shouldDisplay, boolean shouldCheckMaxMessageLength, int numberOfRecipients) { this.uiController = uiController; this.shouldDisplayRecipientField = shouldDisplay; - this.shouldClearRecipientField = true; + this.clearRecipientFieldOnSend = true; this.shouldCheckMaxMessageLength = shouldCheckMaxMessageLength; this.numberOfRecipients = numberOfRecipients; } @@ -149,7 +149,7 @@ public void send() { private void clearComponents() { // We clear the components - if(shouldClearRecipientField){ + if(clearRecipientFieldOnSend){ uiController.setText(find(COMPONENT_TF_RECIPIENT), ""); } uiController.setText(find(COMPONENT_TF_MESSAGE), ""); @@ -368,12 +368,8 @@ public void updateCost() { LOG.trace("EXIT"); } - public boolean shouldClearRecipientField(){ - return shouldClearRecipientField; - } - - public void setShouldClearRecipientField(boolean shouldClearRecipientField){ - this.shouldClearRecipientField = shouldClearRecipientField; + public void setClearRecipientFieldOnSend(boolean clearRecipientFieldOnSend) { + this.clearRecipientFieldOnSend = clearRecipientFieldOnSend; } //> INSTANCE HELPER METHODS