Added auto-complete off

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@128970 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-06-01 14:57:33 +00:00
parent 9aa990a944
commit 1752abcd8e
3 changed files with 81 additions and 56 deletions

View File

@ -42,10 +42,6 @@ import com.google.gwt.user.client.ui.Label;
*/ */
public class DialogShareFolder extends Dialog { public class DialogShareFolder extends Dialog {
/**
*
*/
private int widthDialog = 535; private int widthDialog = 535;
private int heightTextArea = 100; private int heightTextArea = 100;
private TextField<String> txtName; private TextField<String> txtName;
@ -75,7 +71,6 @@ public class DialogShareFolder extends Dialog {
setWidth(widthDialog); setWidth(widthDialog);
setButtons(Dialog.OKCANCEL); setButtons(Dialog.OKCANCEL);
setHeading("Share folder: "+folder.getName()); setHeading("Share folder: "+folder.getName());
txtName = new TextField<String>(); txtName = new TextField<String>();
@ -95,9 +90,7 @@ public class DialogShareFolder extends Dialog {
textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION); textAreaDescription.setFieldLabel(ConstantsExplorer.DIALOG_DESCRIPTION);
textAreaDescription.setHeight(heightTextArea); textAreaDescription.setHeight(heightTextArea);
textAreaDescription.setWidth(380); textAreaDescription.setWidth(380);
textAreaDescription.setValue(folder.getDescription()); textAreaDescription.setValue(folder.getDescription());
// textAreaDescription.setReadOnly(true);
final LayoutContainer lc = new LayoutContainer(); final LayoutContainer lc = new LayoutContainer();
lc.setStyleAttribute("margin-top", "10px"); lc.setStyleAttribute("margin-top", "10px");

View File

@ -105,11 +105,9 @@ public class MultiDragContact extends Dialog {
setGropUserStoreSorter(storeSource); setGropUserStoreSorter(storeSource);
setGropUserStoreSorter(storeTarget); setGropUserStoreSorter(storeTarget);
ContentPanel cpAlreadyShared = new ContentPanel(); ContentPanel cpAlreadyShared = new ContentPanel();
cpAlreadyShared.setSize(WIDTH_CP, HEIGHT_CONTAINER_TEXT_AREA); cpAlreadyShared.setSize(WIDTH_CP, HEIGHT_CONTAINER_TEXT_AREA);
cpAlreadyShared.setHeaderVisible(false); cpAlreadyShared.setHeaderVisible(false);
cpAlreadyShared.setLayout(new FitLayout()); cpAlreadyShared.setLayout(new FitLayout());
VerticalPanel vpShared = new VerticalPanel(); VerticalPanel vpShared = new VerticalPanel();

View File

@ -22,11 +22,13 @@ import com.google.gwt.user.client.ui.MultiWordSuggestOracle;
import com.google.gwt.user.client.ui.SuggestBox; import com.google.gwt.user.client.ui.SuggestBox;
import com.google.gwt.user.client.ui.SuggestOracle; import com.google.gwt.user.client.ui.SuggestOracle;
import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.TextBox;
/** /**
* The Class MultiValuePanel.
*
* @author Massimiliano Assante, ISTI-CNR * @author Massimiliano Assante, ISTI-CNR
* @version 0.2 Gen 2013 modified by Francesco Mangiacrapa * @version 0.2 Gen 2013 modified by Francesco Mangiacrapa
* Facebook style autocompleter * Facebook style autocompleter
*
*/ */
public class MultiValuePanel extends Composite { public class MultiValuePanel extends Composite {
@ -41,6 +43,7 @@ public class MultiValuePanel extends Composite {
private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); private MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
/** /**
* Instantiates a new multi value panel.
* *
* @param userFetch the ContactFetcher * @param userFetch the ContactFetcher
*/ */
@ -51,9 +54,10 @@ public class MultiValuePanel extends Composite {
listBullet.setStyleName("multivalue-panel-suggest"); listBullet.setStyleName("multivalue-panel-suggest");
final ListItem item = new ListItem(); final ListItem item = new ListItem();
final TextBox itemBox = new TextBox(); final TextBox itemBox = new TextBox();
itemBox.getElement().setAttribute("autocomplete", "off");
itemBox.getElement().setAttribute("style", "outline-color: -moz-use-text-color; outline-style: none; outline-width: medium; border: none;"); itemBox.getElement().setAttribute("style", "outline-color: -moz-use-text-color; outline-style: none; outline-width: medium; border: none;");
box = new SuggestBox(getSuggestions(), itemBox);
box = new SuggestBox(getSuggestions(), itemBox);
item.add(box); item.add(box);
listBullet.add(item); listBullet.add(item);
@ -70,7 +74,7 @@ public class MultiValuePanel extends Composite {
if(li.getWidget(0) instanceof Paragraph){ if(li.getWidget(0) instanceof Paragraph){
Paragraph p = (Paragraph) li.getWidget(0); Paragraph p = (Paragraph) li.getWidget(0);
// GWT.log("p "+p.getText() +" is removable : " + p.isRemovable()); // GWT.log("p "+p.getText() +" is removable : " + p.isRemovable());
if (itemsSelected.contains(p.getText()) && (p.isRemovable()==true)) { if (itemsSelected.contains(p.getText()) && p.isRemovable()==true) {
itemsSelected.remove(p.getText()); itemsSelected.remove(p.getText());
GWT.log("Removing selected item: " + p.getText() + "'"); GWT.log("Removing selected item: " + p.getText() + "'");
listBullet.remove(li); listBullet.remove(li);
@ -93,22 +97,30 @@ public class MultiValuePanel extends Composite {
panel.add(listBullet); panel.add(listBullet);
box.getElement().setId("suggestion_box"); //needed for the focus on click box.getElement().setId("suggestion_box"); //needed for the focus on click
panel.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()"); panel.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()");
// box.setFocus(true);
} }
/**
* Box set focus.
*/
public void boxSetFocus(){ public void boxSetFocus(){
box.getElement().focus(); box.getElement().focus();
box.setFocus(true); box.setFocus(true);
// panel.getElement().setAttribute("onclick", "document.getElementById('suggestion_box').focus()");
} }
/**
* Gets the flow panel.
*
* @return the flow panel
*/
public FlowPanel getFlowPanel(){ public FlowPanel getFlowPanel(){
return panel; return panel;
} }
/** /**
* actually insert the contact in the flow panel * actually insert the contact in the flow panel.
* @param itemBox *
* @param list * @param itemBox the item box
* @param list the list
*/ */
private void chosenContactItem(final TextBox itemBox, final BulletList list) { private void chosenContactItem(final TextBox itemBox, final BulletList list) {
if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim())) { if (itemBox.getValue() != null && !"".equals(itemBox.getValue().trim())) {
@ -136,7 +148,9 @@ public class MultiValuePanel extends Composite {
itemBox.setFocus(true); itemBox.setFocus(true);
} }
} }
/** /**
* Gets the selected user.
* *
* @return the selected contacts (user logins e.g. pino.pini) * @return the selected contacts (user logins e.g. pino.pini)
*/ */
@ -156,6 +170,12 @@ public class MultiValuePanel extends Composite {
} }
} }
/**
* Removes the list item.
*
* @param displayItem the display item
* @param list the list
*/
private void removeListItem(ListItem displayItem, BulletList list) { private void removeListItem(ListItem displayItem, BulletList list) {
GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null); GWT.log("Removing: " + displayItem.getWidget(0).getElement().getInnerHTML(), null);
itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML()); itemsSelected.remove(displayItem.getWidget(0).getElement().getInnerHTML());
@ -163,28 +183,30 @@ public class MultiValuePanel extends Composite {
} }
/** /**
* Gets the suggestions.
* *
* @return names of possible contacts * @return names of possible contacts
*/ */
private MultiWordSuggestOracle getSuggestions() { private MultiWordSuggestOracle getSuggestions() {
userFetch.getListContact(contacts, false); userFetch.getListContact(contacts, false);
return oracle; return oracle;
} }
/**
* Update suggestions.
*
* @param result the result
*/
public void updateSuggestions(List<InfoContactModel> result) { public void updateSuggestions(List<InfoContactModel> result) {
oracle.clear(); oracle.clear();
for (InfoContactModel wsUser : result) { for (InfoContactModel wsUser : result) {
oracle.add(wsUser.getName()); oracle.add(wsUser.getName());
} }
} }
private AsyncCallback<List<InfoContactModel>> contacts = new AsyncCallback<List<InfoContactModel>>() { private AsyncCallback<List<InfoContactModel>> contacts = new AsyncCallback<List<InfoContactModel>>() {
@ -206,6 +228,9 @@ public class MultiValuePanel extends Composite {
} }
}; };
/**
* Reset item selected.
*/
public void resetItemSelected(){ public void resetItemSelected(){
listBullet.clear(); listBullet.clear();
@ -217,9 +242,10 @@ public class MultiValuePanel extends Composite {
/** /**
* Adds the recipient.
* *
* @param contact * @param fullName the full name
* @param displayRemoveItem * @param displayRemoveItem the display remove item
*/ */
public void addRecipient(String fullName, boolean displayRemoveItem) { public void addRecipient(String fullName, boolean displayRemoveItem) {
@ -263,10 +289,18 @@ public class MultiValuePanel extends Composite {
} }
/**
* Clear list.
*/
public void clearList() { public void clearList() {
listBullet.clear(); listBullet.clear();
} }
/**
* Gets the box.
*
* @return the box
*/
public SuggestBox getBox() { public SuggestBox getBox() {
return box; return box;