Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2010 JBoss Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.drools.guvnor.client;
  * Copyright 2005 JBoss Inc
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
 import  org.drools.guvnor.client.common.FormStylePopup;
 import  org.drools.guvnor.client.common.GenericCallback;
 import  org.drools.guvnor.client.common.LoadingPopup;
 import  org.drools.guvnor.client.rpc.RepositoryServiceFactory;
 import  org.drools.guvnor.client.messages.Constants;
 import  com.gwtext.client.core.EventObject;
 import  com.gwtext.client.widgets.event.KeyListener;
 import  com.gwtext.client.widgets.form.TextField;

Used for logging in, obviously !

Michael Neale
 public class LoginWidget {
     Constants messages = GWT.create(Constants.class);
 	private Command loggedInEvent;
 	public void show() {
 		final FormStylePopup pop = new FormStylePopup("images/login.gif".Login());
 		final TextField userName = new TextField("username");
 		pop.addAttribute(.UserName(), userName);
 		final TextField password = new TextField("password" );
 		pop.addAttribute(.Password(), password);
         KeyListener kl = new KeyListener() {
           	public void onKey(int key, EventObject e) {
 				if (key == KeyboardListener.KEY_ENTER) {
         userName.addKeyListener(KeyboardListener.KEY_ENTER, kl);
         password.addKeyListener(KeyboardListener.KEY_ENTER, kl);
 		Button b = new Button(.OK());
 		b.addClickListener(new ClickListener() {
 			public void onClick(Widget arg0) {
         pop.setAfterShow(new Command() {
             public void execute() {
    private void doLogin(final TextField userName, TextField passwordfinal FormStylePopup pop) {
        RepositoryServiceFactory.login( userName.getText(), password.getText(), new GenericCallback() {
            public void onSuccess(Object o) {
                 = userName.getText();
                Boolean success = (Booleano;
                if (!success.booleanValue()) {
                } else {

Return the name that was entered.
    public String getUserName() {
        return ;

This is required for a callback after a successful login.
    public void setLoggedInEvent(Command loggedInEvent) {
        this. = loggedInEvent;
New to GrepCode? Check out our FAQ X