/** Instantiates a new audit pop up panel. */ public AuditPopup() { super(false); AbstractField.CSS.ensureInjected(); CSS.ensureInjected(); setStylePrimaryName(AbstractField.CSS.cbtAbstractPopup()); createActions(); setWidget(createContent()); }
/* * Creates the command bar. * * @return the command bar. */ private HorizontalPanel createCommands() { final HorizontalPanel bar = new HorizontalPanel(); bar.addStyleName(AbstractField.CSS.cbtAbstractCommand()); bar.addStyleName(CSS.commandBar()); LocalRequest cancelRequest = new LocalRequest() { protected void perform() { hide(); ; } }; // ----------------------------------------------- // Save button // ----------------------------------------------- final CommandButton saveButton = new CommandButton(this, AbstractField.CONSTANTS.allSave(), auditUpdate, tab++); saveButton.addStyleName(AbstractField.CSS.cbtGradientBlue()); saveButton.setTitle(CONSTANTS.saveHelp()); bar.add(saveButton); // ----------------------------------------------- // Delete button // ----------------------------------------------- final CommandButton deleteButton = new CommandButton( this, AccessControl.DELETE_PERMISSION, AbstractField.CONSTANTS.allDelete(), auditDelete, tab++); deleteButton.addStyleName(AbstractField.CSS.cbtGradientRed()); deleteButton.setTitle(AbstractField.CONSTANTS.helpDelete()); bar.add(deleteButton); // ----------------------------------------------- // Cancel button // ----------------------------------------------- final CommandButton cancelButton = new CommandButton(this, AbstractField.CONSTANTS.allCancel(), cancelRequest, tab++); cancelButton.addStyleName(AbstractField.CSS.cbtGradientRed()); cancelButton.setTitle(CONSTANTS.cancelHelp()); bar.add(cancelButton); // ----------------------------------------------- // Transition array to define the finite state machine // ----------------------------------------------- fsm = new ArrayList<Transition>(); fsm.add(new Transition(Audit.INITIAL, saveButton, Audit.CREATED)); fsm.add(new Transition(Audit.INITIAL, cancelButton, Audit.CREATED)); fsm.add(new Transition(Audit.CREATED, saveButton, Audit.CREATED)); fsm.add(new Transition(Audit.CREATED, deleteButton, Audit.FINAL)); return bar; }
/* * Creates the panel of audit fields. * * @return the panel of audit fields. */ public VerticalPanel createContent() { final VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); add(panel); final Label auditLabel = new Label(CONSTANTS.auditLabel()); auditLabel.addStyleName(AbstractField.CSS.cbtAbstractPopupLabel()); panel.add(auditLabel); final Label closeButton = new Label(); closeButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); closeButton.addStyleName(AbstractField.CSS.cbtAbstractPopupClose()); panel.add(closeButton); final HorizontalPanel content = new HorizontalPanel(); content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); panel.add(content); final VerticalPanel form = new VerticalPanel(); content.add(form); // ----------------------------------------------- // Audit Date field // ----------------------------------------------- dateField = new DateField(this, null, CONSTANTS.dateLabel(), tab++); dateField.setHelpText(CONSTANTS.dateHelp()); form.add(dateField); // ----------------------------------------------- // Audit Name field // ----------------------------------------------- nameField = new SuggestField( this, null, new NameIdAction(Service.ATTRIBUTE), CONSTANTS.nameLabel(), 20, tab++); nameField.setState(AbstractRoot.getOrganizationid()); nameField.setType(Value.Type.AuditName.name()); nameField.setHelpText(CONSTANTS.nameHelp()); final Image nameButton = new Image(AbstractField.BUNDLE.plus()); nameButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (AbstractRoot.noOrganizationid()) { AbstractField.addMessage( Level.ERROR, AbstractField.CONSTANTS.errOrganizationid(), nameField); } else { ValuePopup.getInstance() .show( Value.Type.AuditName, CONSTANTS.nameLabel(), AbstractRoot.getOrganizationid(), nameField); } } }); nameButton.setTitle(CONSTANTS.namebuttonHelp()); nameField.addButton(nameButton); form.add(nameField); // ----------------------------------------------- // Rating range with one anchor slider // ----------------------------------------------- ratingField = new RatingField(this, null, CONSTANTS.ratingLabel(), 10, tab++) {}; ratingField.setLo(CONSTANTS.ratingLo()); ratingField.setHi(CONSTANTS.ratingHi()); ratingField.setDefaultValue(5); ratingField.setHelpText(CONSTANTS.ratingHelp()); form.add(ratingField); // ----------------------------------------------- // Comment field // ----------------------------------------------- notesField = new TextAreaField(this, null, CONSTANTS.notesLabel(), tab++); notesField.setFieldStyle(CSS.notesField()); notesField.setMaxLength(255); notesField.setHelpText(CONSTANTS.notesHelp()); form.add(notesField); form.add(createCommands()); onRefresh(); return panel; }
/** Instantiates a new license pop up panel. */ public LicensePopup() { super(true); createActions(); setWidget(createContent()); setStylePrimaryName(AbstractField.CSS.cbtAbstractPopup()); }
/* * Creates the command bar. * * @return the command bar. */ private HorizontalPanel createCommands() { final HorizontalPanel bar = new HorizontalPanel(); bar.addStyleName(AbstractField.CSS.cbtAbstractCommand()); final LocalRequest resetRequest = new LocalRequest() { protected void perform() { hide(); } }; // ----------------------------------------------- // Save button // ----------------------------------------------- final CommandButton saveButton = new CommandButton(this, AbstractField.CONSTANTS.allSave(), licenseUpdate, tab++); saveButton.addStyleName(AbstractField.CSS.cbtGradientBlue()); saveButton.setTitle(AbstractField.CONSTANTS.helpSave()); bar.add(saveButton); // ----------------------------------------------- // Restore button // ----------------------------------------------- final CommandButton restoreButton = new CommandButton(this, AbstractField.CONSTANTS.allRestore(), licenseUpdate, tab++); restoreButton.addStyleName(AbstractField.CSS.cbtGradientBlue()); restoreButton.setTitle(AbstractField.CONSTANTS.helpRestore()); bar.add(restoreButton); // ----------------------------------------------- // Suspend button // ----------------------------------------------- final CommandButton suspendButton = new CommandButton(this, AbstractField.CONSTANTS.allSuspend(), licenseUpdate, tab++); suspendButton.addStyleName(AbstractField.CSS.cbtGradientBlue()); suspendButton.setTitle(AbstractField.CONSTANTS.helpSuspend()); bar.add(suspendButton); // ----------------------------------------------- // Delete button // ----------------------------------------------- final CommandButton deleteButton = new CommandButton(this, AbstractField.CONSTANTS.allDelete(), licenseDelete, tab++); deleteButton.addStyleName(AbstractField.CSS.cbtGradientRed()); deleteButton.setTitle(AbstractField.CONSTANTS.helpDelete()); bar.add(deleteButton); // ----------------------------------------------- // Cancel button // ----------------------------------------------- final CommandButton cancelButton = new CommandButton(this, AbstractField.CONSTANTS.allCancel(), resetRequest, tab++); cancelButton.addStyleName(AbstractField.CSS.cbtGradientRed()); cancelButton.setTitle(AbstractField.CONSTANTS.helpCancel()); bar.add(cancelButton); // ----------------------------------------------- // Transition array that defines the finite state machine // ----------------------------------------------- fsm = new ArrayList<Transition>(); fsm.add(new Transition(License.INITIAL, cancelButton, License.CREATED)); fsm.add(new Transition(License.INITIAL, saveButton, License.CREATED)); fsm.add(new Transition(License.INITIAL, suspendButton, License.SUSPENDED)); fsm.add(new Transition(License.CREATED, saveButton, License.CREATED)); fsm.add(new Transition(License.CREATED, suspendButton, License.SUSPENDED)); fsm.add(new Transition(License.CREATED, deleteButton, License.CREATED)); fsm.add(new Transition(License.SUSPENDED, saveButton, License.SUSPENDED)); fsm.add(new Transition(License.SUSPENDED, restoreButton, License.CREATED)); fsm.add(new Transition(License.SUSPENDED, cancelButton, License.SUSPENDED)); return bar; }
/* * Creates the panel of license fields. * * @return the panel of license fields. */ private VerticalPanel createContent() { final VerticalPanel form = new VerticalPanel(); final Label title = new Label(CONSTANTS.licenseLabel()); title.addStyleName(AbstractField.CSS.cbtAbstractPopupLabel()); form.add(title); final Label closeButton = new Label(); closeButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { LicensePopup.this.hide(); } }); closeButton.addStyleName(AbstractField.CSS.cbtAbstractPopupClose()); form.add(closeButton); // ----------------------------------------------- // Agent field // ----------------------------------------------- downstreamidField = new SuggestField( this, null, new NameIdAction(Service.PARTY), CONSTANTS.agentLabel(), 20, tab++); downstreamidField.setType(Party.Type.Agent.name()); downstreamidField.setHelpText(CONSTANTS.agentHelp()); form.add(downstreamidField); // ----------------------------------------------- // Product field // ----------------------------------------------- productField = new ListField( this, null, new NameIdAction(Service.PRODUCT), CONSTANTS.productLabel(), true, tab++); productField.setType(Product.Type.Accommodation.name()); productField.setHelpText(CONSTANTS.productHelp()); form.add(productField); // ----------------------------------------------- // Type field // ----------------------------------------------- typeField = new ListField( this, null, NameId.getList(CONSTANTS.types(), License.TYPES), CONSTANTS.typeLabel(), false, tab++); typeField.setDefaultValue(License.Type.All.name()); typeField.setFieldHalf(); typeField.setHelpText(CONSTANTS.typeHelp()); // ----------------------------------------------- // Alert Wait field // ----------------------------------------------- waitField = new IntegerField(this, null, CONSTANTS.waitLabel(), tab++); waitField.setDefaultValue(1000); waitField.setRange(0, 60000); waitField.setEnabled(AbstractRoot.hasPermission(AccessControl.SUPERUSER)); waitField.setHelpText(CONSTANTS.waitHelp()); HorizontalPanel ts = new HorizontalPanel(); form.add(ts); ts.add(typeField); ts.add(waitField); // ----------------------------------------------- // Date span field // ----------------------------------------------- fromtodateField = new DatespanField(this, null, CONSTANTS.fromtodateLabel(), tab++); fromtodateField.setHelpText(CONSTANTS.fromtodateHelp()); form.add(fromtodateField); // ----------------------------------------------- // Subscription field // ----------------------------------------------- subscriptionField = new DoubleField(this, null, CONSTANTS.subscriptionLabel(), AbstractField.IF, tab++); subscriptionField.setHelpText(CONSTANTS.subscriptionHelp()); subscriptionField.setDefaultValue(5.0); subscriptionField.setRange(0.0, 10000.0); subscriptionField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.LICENSE)); // ----------------------------------------------- // Transaction field // ----------------------------------------------- transactionField = new DoubleField(this, null, CONSTANTS.transactionLabel(), AbstractField.AF, tab++); transactionField.setHelpText(CONSTANTS.transactionHelp()); transactionField.setDefaultValue(2.0); transactionField.setRange(0.0, 100.0); transactionField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.LICENSE)); HorizontalPanel st = new HorizontalPanel(); form.add(st); st.add(subscriptionField); st.add(transactionField); // ----------------------------------------------- // Upstream field // ----------------------------------------------- upstreamField = new DoubleField(this, null, CONSTANTS.upstreamLabel(), AbstractField.AF, tab++); upstreamField.setHelpText(CONSTANTS.upstreamHelp()); upstreamField.setDefaultValue(0.0); upstreamField.setRange(0.0, 100.0); upstreamField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.UPSTREAM)); // ----------------------------------------------- // Transaction field // ----------------------------------------------- downstreamField = new DoubleField(this, null, CONSTANTS.downstreamLabel(), AbstractField.AF, tab++); downstreamField.setHelpText(CONSTANTS.downstreamHelp()); downstreamField.setDefaultValue(0.0); downstreamField.setRange(0.0, 100.0); downstreamField.setEnabled(AbstractRoot.getSession().hasPermission(AccessControl.DOWNSTREAM)); HorizontalPanel ud = new HorizontalPanel(); form.add(ud); ud.add(upstreamField); ud.add(downstreamField); // ----------------------------------------------- // Notes field // ----------------------------------------------- notesField = new TextAreaField( this, null, CONSTANTS.notesLabel(), // new LanguageNameId(), tab++); notesField.setMaxLength(255); notesField.setHelpText(CONSTANTS.notesHelp()); form.add(notesField); form.add(createCommands()); onRefresh(); onReset(License.CREATED); return form; }
public LoadingPopup() { super(true); setWidget(new Image(AbstractField.BUNDLE.loader())); setStylePrimaryName(AbstractField.CSS.cbtAbstractLoading()); }