Issue #2699 require non blank handle

previously defaulted to userid if handle left blank
now reprompts for handle
preferences now default to userid to pre-fill handle


Former-commit-id: 0765451a9d [formerly 0765451a9d [formerly ae5f2d2b547241e7ba9c22aabaf64fceceb1b563]]
Former-commit-id: ddf5b2a3ef
Former-commit-id: fab4fea177
This commit is contained in:
Brian Clements 2014-02-11 16:45:05 -06:00
parent a7d8cfb651
commit 8e9f1136ae
3 changed files with 18 additions and 16 deletions

View file

@ -90,6 +90,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Jan 30, 2014 2698 bclement added handle to join room with
* Feb 3, 2014 2699 bclement added default handle preference
* Feb 7, 2014 2699 bclement removed handle validation
* Feb 11, 2014 2699 bclement require non-blank handle
*
* </pre>
*
@ -155,7 +156,7 @@ public class CreateSessionDialog extends CaveSWTDialog {
handleTF.setText(HandleUtil.getDefaultHandle());
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
handleTF.setLayoutData(gd);
handleTF.addVerifyListener(validNameListener);
handleTF.setToolTipText("Default handle configuration available in preferences.");
label = new Label(body, SWT.NONE);
label.setText("Subject: ");
@ -454,6 +455,12 @@ public class CreateSessionDialog extends CaveSWTDialog {
errorMessages.add(err);
}
String handle = handleTF.getText().trim();
if (handle.isEmpty()) {
if (focusField == null) {
focusField = handleTF;
}
errorMessages.add("Handle cannot be empty.");
}
if (focusField == null) {
CreateSessionData result = new CreateSessionData();
@ -504,8 +511,6 @@ public class CreateSessionDialog extends CaveSWTDialog {
}
errorMessage.setText(sb.toString());
errorMessage.setVisible(true);
statusHandler.handle(Priority.ERROR,
"Session Creation Error: " + sb.toString());
event.doit = false;
setReturnValue(null);
focusField.setFocus();

View file

@ -23,8 +23,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
@ -60,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
* Aug 14, 2012 lvenable Initial creation.
* Jan 30, 2014 2698 bclement added logic to join room and reprompt if failed
* Feb 3, 2014 2699 bclement added default handle preference
* Feb 11, 2014 2699 bclement require non-blank handle
*
* </pre>
*
@ -192,16 +191,9 @@ public class InviteDialog extends CaveSWTDialogBase {
handleText = new Text(labelTextComp, SWT.BORDER);
handleText.setText(HandleUtil.getDefaultHandle());
handleText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
handleText.addVerifyListener(new VerifyListener() {
handleText
.setToolTipText("Default handle configuration available in preferences.");
@Override
public void verifyText(VerifyEvent e) {
if (" \t\"&'/,<>@".indexOf(e.character) >= 0) {
e.doit = false;
// Toolkit.getDefaultToolkit().beep();
}
}
});
GridData gd = new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 2;
@ -264,8 +256,12 @@ public class InviteDialog extends CaveSWTDialogBase {
public void widgetSelected(SelectionEvent se) {
CollaborationConnection connection = CollaborationConnection
.getConnection();
String handle = handleText.getText();
String handle = handleText.getText().trim();
try {
if (handle.isEmpty()) {
throw new CollaborationException(
"Handle cannot be empty.");
}
if (sharedDisplay) {
session = connection.joinCollaborationVenue(event,
handle);

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.viz.collaboration.ui.Activator;
* Jan 14, 2014 2630 bclement added away on idle defaults
* Jan 27, 2014 2700 bclement added auto accept subscribe
* Feb 3, 2014 2699 bclement added handle preferences
* Feb 11, 2014 2699 bclement handle defaults to userid
*
* </pre>
*
@ -71,7 +72,7 @@ public class CollabPrefInitializer extends AbstractPreferenceInitializer {
CollabPrefConstants.AWAY_TIMEOUT_DEFAULT);
store.setDefault(CollabPrefConstants.AUTO_ACCEPT_SUBSCRIBE, false);
store.setDefault(CollabPrefConstants.DEFAULT_HANDLE,
CollabPrefConstants.HandleOption.BLANK.name());
CollabPrefConstants.HandleOption.USERNAME.name());
store.setDefault(CollabPrefConstants.CUSTOM_HANDLE, "");
}