package votorola.a.count.gwt; // Copyright 2011, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. import com.google.gwt.regexp.shared.*; import com.google.gwt.view.client.*; import votorola.g.web.gwt.*; /** The selection of a superaccount. */ public interface SacSelection extends SelectionModel { /** The value pattern of an 'a' superaccount selection switch. It takes one of two * equivalent forms, as shown in this example: * * * *

"v" is the {@linkplain CountingMethodJS.SwitchMnemonic mnemonic} for the * counting method, and "Votes" is the {@linkplain SacJS#accountName() account name}. * Either form is acceptable in this case. The apostrophe form * (v'Votes) is required only if the account name begins with an ASCII * lower case letter a-z (example below), digit 0-9 or apostrophe:

* * * *

A match against the pattern sets group 1 to the counting method mnemonic ("q" * in this case) and 2 to the account name ("my account").

*/ public static final RegExp A_PATTERN = RegExp.compile( "^([a-z][a-z0-9]*)'?(.+)$" ); // - S a c - S e l e c t i o n -------------------------------------------------------- /** The 'a' superaccount selection switch (which ought not to be a switch). It * directly controls which superaccount is selected. The form of the switch value is * defined by {@linkplain #A_PATTERN A_PATTERN}. * * This ought not to be a switch and should be recoded when work resumes on the RAC. * Account selection is not really a structural change to the UI and should not be * stored as navigable state. See {@linkplain votorola.s.gwt.scene.Scenes Scenes} * for the reason. * * @see #getSac() */ public Switch aSacSwitch(); /** The count that is currently shown, or null if none is shown. The value is bound * via the {@linkplain GWTX#bus() event bus} to property name count. */ public CountJS count(); /** The superaccount that is currently selected, or null if none is selected. Null * occurs only if no count is shown. * * @see #setSac(SacJS) */ public SacJS getSac(); /** Sets the superaccount that is currently selected. It is equivalent to:
          *
          *     setSelected( newSac, true );
* *

Setting the superaccount to null, or explicitly deselecting it, does not * have the effect of actual deselection. Rather it selects the {@linkplain * CountJS#nullSuperaccount() null superaccount}.

* * @see #getSac() */ public void setSac( SacJS newSac ); }