TAGS WITH IN TEXT BOX
TAG.JAVA
package com.client;
import com.shared.FieldVerifier;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import java.util.ArrayList;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.widgets.layout.HorizontalLayout;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class tag implements EntryPoint {
Button button;
AbsolutePanel absolutePanel;
HorizontalPanel verticalPanel2;
final Button [] b2 =new Button[20];
final HorizontalPanel[] horizontalPanel=new HorizontalPanel[20];
final Button [] tagbutton=new Button[50];
final Label [] l2=new Label[20];
final Label[] l12=new Label[50];
final TextArea [] t=new TextArea[20];
AbsolutePanel absolutePanel_2;
RootPanel p;
ListBox listBox ;
int i=0;
String s2;
String s4[] = null;
boolean flag=false;
char c;
String gg1;
Boolean flag1;
int count=0;
int h;
String k1="";
Button button12;
int charCode;
TextBox textBox;
int i1=0;
int i13;
int h12;
int h123;
int taglen;
static int count12;
HorizontalPanel horizontalPanel_1 ;
String s12;
String tagtext;
String full;
private final GreetingServiceAsync a1 = GWT.create(GreetingService.class);
public void onModuleLoad() {
p=RootPanel.get();
p.setSize("100%", "100%");
verticalPanel2 = new HorizontalPanel();
verticalPanel2.setSize("404px", "34px");
listBox = new ListBox();
listBox.setStyleName("gwt-ListBox1");
p.add(listBox, 10, 400);
listBox.setSize("77px", "58px");
listBox.setVisibleItemCount(5);
textBox = new TextBox();
p.add(textBox, 10, 368);
textBox.setSize("545px", "24px");
horizontalPanel_1 = new HorizontalPanel();
p.add(horizontalPanel_1, 10, 335);
horizontalPanel_1.setSize("", "");
button12=new Button();
for(int i=0;i<50 ;i++)
{
tagbutton[i]=new Button();
tagbutton[i].setHeight("30px");
tagbutton[i].setStyleName("gwt-text1234");
}
for( i13=0;i13<50;i13++)
{
l12[i13]=new Label();
l12[i13].setHeight("28px");
l12[i13].setStyleName("gwt-Label1234");
l12[i13].setText("x");
}
textBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyDown(Widget sender, char keyCode, int modifiers)
{
String gg;
if ((keyCode == 40))
{
System.out.print("enter");
listBox.setSelectedIndex(listBox.getItemCount());
listBox.setVisible(true);
listBox.setFocus(true);
}
if ((keyCode == 38))
{
System.out.print("enter");
/*int jj= textBox.getText().length();
int ii= textBox.getText().lastIndexOf(",");
String gg= textBox.getText().substring(ii,jj);
tagbutton[count12].setText(gg);
horizontalPanel_1.add(tagbutton[count12]);
System.out.print("/nerhr");
horizontalPanel_1.add(l12[count12]);
System.out.print("/nerhr 123");
fun(count12);
count12++;*/
listBox.setSelectedIndex(listBox.getItemCount());
listBox.setVisible(true);
listBox.setFocus(true);
}
//int k= f.length();
//String b= f.substring(0,k-1 );
if ((keyCode == 46))
{
System.out.print("enter");
listBox.setVisible(false);
}
// Enter Key Coding
if ((keyCode == 13))
{
//System.out.print("monica enterx");
int jj= textBox.getText().length();
//System.out.print("\nmonica enterx nbxn jj"+jj);
int ii= textBox.getText().lastIndexOf(",");
//System.out.print("/n black hai , value of ii "+ii);
if(ii==-1)
{
gg= textBox.getText();
//System.out.print("/n black hai , ");
count++;
}
else
{
//System.out.print("\nmonica enterx nbxn iii"+ii);
gg= textBox.getText().substring(ii+1,jj);
//System.out.print("value of gg"+gg);
}
tagbutton[count12].setText(gg);
horizontalPanel_1.add(tagbutton[count12]);
//System.out.print("/nerhr");
horizontalPanel_1.add(l12[count12]);
//System.out.print("/nerhr 123");
fun(count12);
fun1(count12);
count12++;
gg1=textBox.getText();
System.out.print("\ngg1"+gg1);
textBox.setText(gg1+",");
}
}
});
textBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyUp(Widget sender, char keyCode, int modifiers)
{
String gg;
if(count12==-1)
{
count12=count12+1;
}
if ((keyCode == 13))
{
full= textBox.getText();
System.out.print("\nfull"+full);
}
if ((keyCode == 38))
{
System.out.print("enter up ");
}
String s1=textBox.getText();
//System.out.println("mon"+s1);
if(s1.isEmpty()&& textBox.getCursorPos()==0)
{
listBox.setVisible(false);
count=0;
}
else
{
listBox.setVisible(true);
// absolutePanel_1.setVisible(true);
}
if(count==0)
{
s2= textBox.getText();
//System.out.println("old s2" +s2);
}
else{
String s3=textBox.getText();
int j6=s3.lastIndexOf(",");
//System.out.println(j6);
StringBuilder s=new StringBuilder();
s.append(s3);
s.delete(0,j6+1);
// //System.out.println(" \nafter deleted portion " +s4);
s2=s.toString();
//System.out.println(" new s2" +s2);
}
a1.sign(s2,new AsyncCallback<String[]>()
{
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(String[] result) {
listBox.clear();
for(int i=0;i<result.length;i++)
{
try{
listBox.addItem(result[i]);
}
catch(Exception e){
System.out.println("hello" +e.toString());}
}
}
});
/*
if ((keyCode == 8)&& textBox.getText()=="" )
{
listBox.setVisible(false);
}
*/
if ((keyCode == 46) && textBox.getText()=="")
{
listBox.setVisible(false);
}
if ((keyCode == 8))
{
listBox.setVisible(false);
int jj=textBox.getText().length();
if(textBox.getCursorPos()<jj)
{
textBox.setText(full);
System.out.print("full text"+full);
textBox.setCursorPos(jj);
}
else
{
int jj1= textBox.getText().length()-1;
//System.out.print("\nmonica enterx nbxn jj"+jj);
int ii= textBox.getText().lastIndexOf(",");
//System.out.print("/n black hai , value of ii "+ii);
if(ii==-1)
{
gg= textBox.getText();
//System.out.print("/n black hai , ");
count++;
}
else
{
//System.out.print("\nmonica enterx nbxn iii"+ii);
gg= textBox.getText().substring(ii,jj1);
//System.out.print("value of gg"+gg);
}
tagbutton[count12].setText(gg);
String v=tagbutton[count12].getText();
System.out.print("\nvalue of v"+v);
//System.out.print("\n monica "+a.get(s3.length-1));
if(v.equals(""))
{
System.out.print("\nnull");
//Window.alert("blank");
tagbutton[count12-1].removeFromParent();
l12[count12-1].removeFromParent();
//System.out.print("\n remove");
count12--;
h123=h123-1;
}
}
}
}
});
textBox.addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
if(textBox.getCursorPos()==0)
{
listBox.setVisible(false);
}
if(textBox.getText()=="")
{
listBox.setVisible(false);
}
if(i==0)
{
listBox.setVisible(false);
}
}
});
textBox.addKeyUpHandler(new KeyUpHandler(){
public void onKeyUp(KeyUpEvent event) {
if(count12==-1)
{
count12=count12+1;
}
String s1=textBox.getText();
//System.out.println("mon"+s1);
if(s1.isEmpty()&& textBox.getCursorPos()==0)
{
listBox.setVisible(false);
count=0;
}
else
{
listBox.setVisible(true);
}
if(count==0)
{
s2= textBox.getText();
//System.out.println("old s2" +s2);
}
else{
String s3=textBox.getText();
int j6=s3.lastIndexOf(",");
//System.out.println(j6);
StringBuilder s=new StringBuilder();
s.append(s3);
s.delete(0,j6+1);
// //System.out.println(" \nafter deleted portion " +s4);
s2=s.toString();
//System.out.println(" new s2" +s2);
}
try{
a1.sign(s2,new AsyncCallback<String[]>()
{
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(String[] result) {
//ruc
listBox.clear();
for(int i=0;i<result.length;i++)
{
try{
listBox.addItem(result[i]);
}
catch(Exception e){
System.out.println("hello" +e.toString());}
}
}
});
}
catch(Exception e)
{
}
}
});
textBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
if(textBox.getText()==" ")
{
listBox.setVisible(false);
listBox.clear();
}
}
});
listBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyDown(Widget sender, char keyCode, int modifiers)
{
if(count12==-1)
{
count12=count12+1;
}
if(keyCode == 13)
{
String g=listBox.getValue(listBox.getSelectedIndex());
tagbutton[count12].setText(g);
horizontalPanel_1.add(tagbutton[count12]);
horizontalPanel_1.add(l12[count12]);
fun(count12);
fun1(count12);
count12++;
String s4=textBox.getText();
int j=s4.lastIndexOf(",");
//System.out.println("las index of comma " +j);
if(j==-1)
{
String m3=listBox.getValue(listBox.getSelectedIndex());
String ss=textBox.getText();
String replace=ss.replace(ss, m3);
textBox.setText(replace + ",");
textBox.setFocus(true);
}
else
{
int i=s4.length();
//System.out.println("monica1" +i);
int k= i-j;
//System.out.println("monica1" +k);
String m3=listBox.getValue(listBox.getSelectedIndex());
//System.out.println("monica1 list box " +m3);
int m=s4.lastIndexOf(",");
String s8=(String) s4.subSequence(0,m+1);
//System.out.println("monica1 subsequence" +s8);
String s9=s8.concat(m3);
//System.out.println("monica1" +s9+",");
textBox.setText(s9+",");
textBox.setFocus(true);
}
}
}
});
listBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(count12==-1)
{
count12=count12+1;
}
String g=listBox.getValue(listBox.getSelectedIndex());
////System.out.print("\n monica bubna "+g+"\n");
tagbutton[count12].setText(g);
horizontalPanel_1.add(tagbutton[count12]);
System.out.print("/nerhr");
horizontalPanel_1.add(l12[count12]);
System.out.print("/nerhr 123");
fun(count12);
fun1(count12);
count12++;
count++;
listBox.setVisible(false);
String s3=textBox.getText();
if(s3.isEmpty())
{
listBox.setVisible(false);
}
String s4=textBox.getText();
int j=s4.lastIndexOf(",");
//System.out.println("las index of comma " +j);
if(j==-1)
{
String m3=listBox.getValue(listBox.getSelectedIndex());
String ss=textBox.getText();
String replace=ss.replace(ss, m3);
textBox.setText(replace + ",");
}
else
{
int i=s4.length();
//System.out.println("monica1" +i);
int k= i-j;
//System.out.println("monica1" +k);
String m3=listBox.getValue(listBox.getSelectedIndex());
//System.out.println("monica1 list box " +m3);
int m=s4.lastIndexOf(",");
String s8=(String) s4.subSequence(0,m+1);
//System.out.println("monica1 subsequence" +s8);
String s9=s8.concat(m3);
//System.out.println("monica1" +s9+",");
textBox.setText(s9+",");
}
}
});
listBox.addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
}
});
/*
textBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyDown(Widget sender, char keyCode, int modifiers)
{
if(keyCode == 13)
{
m++;
if(m==1)
{
verticalPanel1.remove(textArea);
}
String g=textArea.getText();
b2[i]=new Button();
b2[i].setText(g);
int r=b2[i].getOffsetHeight();
l2[i]=new Label();
l2[i].setText("x");
t[i]=new TextArea();
//l2[i].setHeight(String.valueOf(r));
horizontalPanel[i]=new HorizontalPanel();
horizontalPanel[i].setSize("","");
horizontalPanel[i].add(b2[i]);
horizontalPanel[i].add(l2[i]);
// horizontalPanel[i].add(textArea);
fun(i);
int g2= horizontalPanel[i].getOffsetWidth();
verticalPanel1.add(horizontalPanel[i]);
verticalPanel2.setCellWidth(horizontalPanel[i],"0%");
//int g2= horizontalPanel[i].getOffsetWidth();
////System.out.print("\nhgm"+g2);
//textArea.setWidth("100px");
verticalPanel1.add(textArea);
//textArea.setWidth("50px");
i++;
textArea.setText("");
//int g23= absolutePanel_1.getOffsetWidth();
////System.out.print("absolte"+g23);
int b= verticalPanel1.getOffsetWidth();
//System.out.print("\nb aaj jaa"+b);
if(b>890)
{
verticalPanel2 = new HorizontalPanel();
// absolutePanel_1.add(verticalPanel1, 0, 0);
verticalPanel2.setSize("398px", "128px");
verticalPanel2.setStyleName("gwt-text12");
//System.out.print("wehew"+b);
//absolutePanel_1.add(verticalPanel2,0,30);
}
//if if(b413
//textArea.setCursorPos(0);
////System.out.print("posion"+textArea.getCursorPos());
}}
});
*/
/* Button button_1 = new Button("New button");
button_1.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
verticalPanel1.add(new Button());
verticalPanel1.add(new Label("x"));
}
});
p.add(button_1, 138, 394);
button_1.setSize("100px", "28px");*/
}
public void fun(final int a)
{
l12[a].addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
tagbutton[a].removeFromParent();
l12[a].removeFromParent();
String g1=tagbutton[a].getText();
System.out.print("\nvalue of g1"+g1);
String g2=textBox.getText();
System.out.print("\nvalue of g2"+g2);
String hello=g2.replace(g1+"," , "");
System.out.print("\nvalue of heloo"+hello);
textBox.setText(hello);
System.out.print("\nvalue of check box"+hello);
System.out.print("\nvalue of check box");
}
});
}
public void fun1(final int a)
{
l12[a].addMouseOverHandler(new MouseOverHandler() {
public void onMouseOver(MouseOverEvent event) {
l12[a].setStyleName("gwt-Label1234");
}
});
}
}
GREETINGSERVICEASYNC.JAVA
package com.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The async counterpart of <code>GreetingService</code>.
*/
public interface GreetingServiceAsync {
void sign(String s1,AsyncCallback<String[]> callback);
}
GREETINGSERVICE.JAVA
package com.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
public String[] sign(String s1);
}
TAG.JAVA
package com.client;
import com.shared.FieldVerifier;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import java.util.ArrayList;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.widgets.layout.HorizontalLayout;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.event.dom.client.MouseOverHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class tag implements EntryPoint {
Button button;
AbsolutePanel absolutePanel;
HorizontalPanel verticalPanel2;
final Button [] b2 =new Button[20];
final HorizontalPanel[] horizontalPanel=new HorizontalPanel[20];
final Button [] tagbutton=new Button[50];
final Label [] l2=new Label[20];
final Label[] l12=new Label[50];
final TextArea [] t=new TextArea[20];
AbsolutePanel absolutePanel_2;
RootPanel p;
ListBox listBox ;
int i=0;
String s2;
String s4[] = null;
boolean flag=false;
char c;
String gg1;
Boolean flag1;
int count=0;
int h;
String k1="";
Button button12;
int charCode;
TextBox textBox;
int i1=0;
int i13;
int h12;
int h123;
int taglen;
static int count12;
HorizontalPanel horizontalPanel_1 ;
String s12;
String tagtext;
String full;
private final GreetingServiceAsync a1 = GWT.create(GreetingService.class);
public void onModuleLoad() {
p=RootPanel.get();
p.setSize("100%", "100%");
verticalPanel2 = new HorizontalPanel();
verticalPanel2.setSize("404px", "34px");
listBox = new ListBox();
listBox.setStyleName("gwt-ListBox1");
p.add(listBox, 10, 400);
listBox.setSize("77px", "58px");
listBox.setVisibleItemCount(5);
textBox = new TextBox();
p.add(textBox, 10, 368);
textBox.setSize("545px", "24px");
horizontalPanel_1 = new HorizontalPanel();
p.add(horizontalPanel_1, 10, 335);
horizontalPanel_1.setSize("", "");
button12=new Button();
for(int i=0;i<50 ;i++)
{
tagbutton[i]=new Button();
tagbutton[i].setHeight("30px");
tagbutton[i].setStyleName("gwt-text1234");
}
for( i13=0;i13<50;i13++)
{
l12[i13]=new Label();
l12[i13].setHeight("28px");
l12[i13].setStyleName("gwt-Label1234");
l12[i13].setText("x");
}
textBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyDown(Widget sender, char keyCode, int modifiers)
{
String gg;
if ((keyCode == 40))
{
System.out.print("enter");
listBox.setSelectedIndex(listBox.getItemCount());
listBox.setVisible(true);
listBox.setFocus(true);
}
if ((keyCode == 38))
{
System.out.print("enter");
/*int jj= textBox.getText().length();
int ii= textBox.getText().lastIndexOf(",");
String gg= textBox.getText().substring(ii,jj);
tagbutton[count12].setText(gg);
horizontalPanel_1.add(tagbutton[count12]);
System.out.print("/nerhr");
horizontalPanel_1.add(l12[count12]);
System.out.print("/nerhr 123");
fun(count12);
count12++;*/
listBox.setSelectedIndex(listBox.getItemCount());
listBox.setVisible(true);
listBox.setFocus(true);
}
//int k= f.length();
//String b= f.substring(0,k-1 );
if ((keyCode == 46))
{
System.out.print("enter");
listBox.setVisible(false);
}
// Enter Key Coding
if ((keyCode == 13))
{
//System.out.print("monica enterx");
int jj= textBox.getText().length();
//System.out.print("\nmonica enterx nbxn jj"+jj);
int ii= textBox.getText().lastIndexOf(",");
//System.out.print("/n black hai , value of ii "+ii);
if(ii==-1)
{
gg= textBox.getText();
//System.out.print("/n black hai , ");
count++;
}
else
{
//System.out.print("\nmonica enterx nbxn iii"+ii);
gg= textBox.getText().substring(ii+1,jj);
//System.out.print("value of gg"+gg);
}
tagbutton[count12].setText(gg);
horizontalPanel_1.add(tagbutton[count12]);
//System.out.print("/nerhr");
horizontalPanel_1.add(l12[count12]);
//System.out.print("/nerhr 123");
fun(count12);
fun1(count12);
count12++;
gg1=textBox.getText();
System.out.print("\ngg1"+gg1);
textBox.setText(gg1+",");
}
}
});
textBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyUp(Widget sender, char keyCode, int modifiers)
{
String gg;
if(count12==-1)
{
count12=count12+1;
}
if ((keyCode == 13))
{
full= textBox.getText();
System.out.print("\nfull"+full);
}
if ((keyCode == 38))
{
System.out.print("enter up ");
}
String s1=textBox.getText();
//System.out.println("mon"+s1);
if(s1.isEmpty()&& textBox.getCursorPos()==0)
{
listBox.setVisible(false);
count=0;
}
else
{
listBox.setVisible(true);
// absolutePanel_1.setVisible(true);
}
if(count==0)
{
s2= textBox.getText();
//System.out.println("old s2" +s2);
}
else{
String s3=textBox.getText();
int j6=s3.lastIndexOf(",");
//System.out.println(j6);
StringBuilder s=new StringBuilder();
s.append(s3);
s.delete(0,j6+1);
// //System.out.println(" \nafter deleted portion " +s4);
s2=s.toString();
//System.out.println(" new s2" +s2);
}
a1.sign(s2,new AsyncCallback<String[]>()
{
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(String[] result) {
listBox.clear();
for(int i=0;i<result.length;i++)
{
try{
listBox.addItem(result[i]);
}
catch(Exception e){
System.out.println("hello" +e.toString());}
}
}
});
/*
if ((keyCode == 8)&& textBox.getText()=="" )
{
listBox.setVisible(false);
}
*/
if ((keyCode == 46) && textBox.getText()=="")
{
listBox.setVisible(false);
}
if ((keyCode == 8))
{
listBox.setVisible(false);
int jj=textBox.getText().length();
if(textBox.getCursorPos()<jj)
{
textBox.setText(full);
System.out.print("full text"+full);
textBox.setCursorPos(jj);
}
else
{
int jj1= textBox.getText().length()-1;
//System.out.print("\nmonica enterx nbxn jj"+jj);
int ii= textBox.getText().lastIndexOf(",");
//System.out.print("/n black hai , value of ii "+ii);
if(ii==-1)
{
gg= textBox.getText();
//System.out.print("/n black hai , ");
count++;
}
else
{
//System.out.print("\nmonica enterx nbxn iii"+ii);
gg= textBox.getText().substring(ii,jj1);
//System.out.print("value of gg"+gg);
}
tagbutton[count12].setText(gg);
String v=tagbutton[count12].getText();
System.out.print("\nvalue of v"+v);
//System.out.print("\n monica "+a.get(s3.length-1));
if(v.equals(""))
{
System.out.print("\nnull");
//Window.alert("blank");
tagbutton[count12-1].removeFromParent();
l12[count12-1].removeFromParent();
//System.out.print("\n remove");
count12--;
h123=h123-1;
}
}
}
}
});
textBox.addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
if(textBox.getCursorPos()==0)
{
listBox.setVisible(false);
}
if(textBox.getText()=="")
{
listBox.setVisible(false);
}
if(i==0)
{
listBox.setVisible(false);
}
}
});
textBox.addKeyUpHandler(new KeyUpHandler(){
public void onKeyUp(KeyUpEvent event) {
if(count12==-1)
{
count12=count12+1;
}
String s1=textBox.getText();
//System.out.println("mon"+s1);
if(s1.isEmpty()&& textBox.getCursorPos()==0)
{
listBox.setVisible(false);
count=0;
}
else
{
listBox.setVisible(true);
}
if(count==0)
{
s2= textBox.getText();
//System.out.println("old s2" +s2);
}
else{
String s3=textBox.getText();
int j6=s3.lastIndexOf(",");
//System.out.println(j6);
StringBuilder s=new StringBuilder();
s.append(s3);
s.delete(0,j6+1);
// //System.out.println(" \nafter deleted portion " +s4);
s2=s.toString();
//System.out.println(" new s2" +s2);
}
try{
a1.sign(s2,new AsyncCallback<String[]>()
{
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(String[] result) {
//ruc
listBox.clear();
for(int i=0;i<result.length;i++)
{
try{
listBox.addItem(result[i]);
}
catch(Exception e){
System.out.println("hello" +e.toString());}
}
}
});
}
catch(Exception e)
{
}
}
});
textBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
if(textBox.getText()==" ")
{
listBox.setVisible(false);
listBox.clear();
}
}
});
listBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyDown(Widget sender, char keyCode, int modifiers)
{
if(count12==-1)
{
count12=count12+1;
}
if(keyCode == 13)
{
String g=listBox.getValue(listBox.getSelectedIndex());
tagbutton[count12].setText(g);
horizontalPanel_1.add(tagbutton[count12]);
horizontalPanel_1.add(l12[count12]);
fun(count12);
fun1(count12);
count12++;
String s4=textBox.getText();
int j=s4.lastIndexOf(",");
//System.out.println("las index of comma " +j);
if(j==-1)
{
String m3=listBox.getValue(listBox.getSelectedIndex());
String ss=textBox.getText();
String replace=ss.replace(ss, m3);
textBox.setText(replace + ",");
textBox.setFocus(true);
}
else
{
int i=s4.length();
//System.out.println("monica1" +i);
int k= i-j;
//System.out.println("monica1" +k);
String m3=listBox.getValue(listBox.getSelectedIndex());
//System.out.println("monica1 list box " +m3);
int m=s4.lastIndexOf(",");
String s8=(String) s4.subSequence(0,m+1);
//System.out.println("monica1 subsequence" +s8);
String s9=s8.concat(m3);
//System.out.println("monica1" +s9+",");
textBox.setText(s9+",");
textBox.setFocus(true);
}
}
}
});
listBox.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(count12==-1)
{
count12=count12+1;
}
String g=listBox.getValue(listBox.getSelectedIndex());
////System.out.print("\n monica bubna "+g+"\n");
tagbutton[count12].setText(g);
horizontalPanel_1.add(tagbutton[count12]);
System.out.print("/nerhr");
horizontalPanel_1.add(l12[count12]);
System.out.print("/nerhr 123");
fun(count12);
fun1(count12);
count12++;
count++;
listBox.setVisible(false);
String s3=textBox.getText();
if(s3.isEmpty())
{
listBox.setVisible(false);
}
String s4=textBox.getText();
int j=s4.lastIndexOf(",");
//System.out.println("las index of comma " +j);
if(j==-1)
{
String m3=listBox.getValue(listBox.getSelectedIndex());
String ss=textBox.getText();
String replace=ss.replace(ss, m3);
textBox.setText(replace + ",");
}
else
{
int i=s4.length();
//System.out.println("monica1" +i);
int k= i-j;
//System.out.println("monica1" +k);
String m3=listBox.getValue(listBox.getSelectedIndex());
//System.out.println("monica1 list box " +m3);
int m=s4.lastIndexOf(",");
String s8=(String) s4.subSequence(0,m+1);
//System.out.println("monica1 subsequence" +s8);
String s9=s8.concat(m3);
//System.out.println("monica1" +s9+",");
textBox.setText(s9+",");
}
}
});
listBox.addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
}
});
/*
textBox.addKeyboardListener(new KeyboardListenerAdapter()
{
public void onKeyDown(Widget sender, char keyCode, int modifiers)
{
if(keyCode == 13)
{
m++;
if(m==1)
{
verticalPanel1.remove(textArea);
}
String g=textArea.getText();
b2[i]=new Button();
b2[i].setText(g);
int r=b2[i].getOffsetHeight();
l2[i]=new Label();
l2[i].setText("x");
t[i]=new TextArea();
//l2[i].setHeight(String.valueOf(r));
horizontalPanel[i]=new HorizontalPanel();
horizontalPanel[i].setSize("","");
horizontalPanel[i].add(b2[i]);
horizontalPanel[i].add(l2[i]);
// horizontalPanel[i].add(textArea);
fun(i);
int g2= horizontalPanel[i].getOffsetWidth();
verticalPanel1.add(horizontalPanel[i]);
verticalPanel2.setCellWidth(horizontalPanel[i],"0%");
//int g2= horizontalPanel[i].getOffsetWidth();
////System.out.print("\nhgm"+g2);
//textArea.setWidth("100px");
verticalPanel1.add(textArea);
//textArea.setWidth("50px");
i++;
textArea.setText("");
//int g23= absolutePanel_1.getOffsetWidth();
////System.out.print("absolte"+g23);
int b= verticalPanel1.getOffsetWidth();
//System.out.print("\nb aaj jaa"+b);
if(b>890)
{
verticalPanel2 = new HorizontalPanel();
// absolutePanel_1.add(verticalPanel1, 0, 0);
verticalPanel2.setSize("398px", "128px");
verticalPanel2.setStyleName("gwt-text12");
//System.out.print("wehew"+b);
//absolutePanel_1.add(verticalPanel2,0,30);
}
//if if(b413
//textArea.setCursorPos(0);
////System.out.print("posion"+textArea.getCursorPos());
}}
});
*/
/* Button button_1 = new Button("New button");
button_1.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
verticalPanel1.add(new Button());
verticalPanel1.add(new Label("x"));
}
});
p.add(button_1, 138, 394);
button_1.setSize("100px", "28px");*/
}
public void fun(final int a)
{
l12[a].addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
tagbutton[a].removeFromParent();
l12[a].removeFromParent();
String g1=tagbutton[a].getText();
System.out.print("\nvalue of g1"+g1);
String g2=textBox.getText();
System.out.print("\nvalue of g2"+g2);
String hello=g2.replace(g1+"," , "");
System.out.print("\nvalue of heloo"+hello);
textBox.setText(hello);
System.out.print("\nvalue of check box"+hello);
System.out.print("\nvalue of check box");
}
});
}
public void fun1(final int a)
{
l12[a].addMouseOverHandler(new MouseOverHandler() {
public void onMouseOver(MouseOverEvent event) {
l12[a].setStyleName("gwt-Label1234");
}
});
}
}
GREETINGSERVICEASYNC.JAVA
package com.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The async counterpart of <code>GreetingService</code>.
*/
public interface GreetingServiceAsync {
void sign(String s1,AsyncCallback<String[]> callback);
}
GREETINGSERVICE.JAVA
package com.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
public String[] sign(String s1);
}
No comments:
Post a Comment