Showing posts with label smartgwt. Show all posts
Showing posts with label smartgwt. Show all posts

Wednesday, December 4, 2013

Creating a Facebook-style Autocomplete with GWT in SmartGWT project

The example of how to Creat a Facebook-style Autocomplete with GWT http://raibledesigns.com/rd/entry/creating_a_facebook_style_autocomplete needs some additional coding and styling if you want to use it your SmartGWT project. Why and what you have to change:

1. There could be a wrong z-index for a PopupBox taht has list of suggestions for a SuggestBox.

  • In InputListWidget class create instance of DefaultSuggestionDisplay, set its default GWT style (e.g. all styles related to gwt-SuggestBoxPopup) and add proper z-index attribut to it. 
  • Then use another constructor for a SuggestBox that has additional parameter for DefaultSuggestionDisplay and pass to it the styled instance of DefaultSuggestionDisplay you have just created.


Example:
DefaultSuggestionDisplay defaultSuggestionDisplay = new DefaultSuggestionDisplay();
defaultSuggestionDisplay.setPopupStyleName("gwt-SuggestBoxPopup");

final SuggestBox box = new SuggestBox(getSuggestions(), itemBox, defaultSuggestionDisplay);

Example of CSS with styles for InputListWidget including gwt-SuggestBoxPopup:
.token-input-list-facebook {
list-style-type: none;
}

ul.token-input-list-facebook {
overflow: hidden; 
height: auto !important; 
height: 1%;
width: 400px;
border: 1px solid #8496ba;
cursor: text;
font-size: 12px;
font-family: Verdana, sans-serif;
min-height: 1px;
z-index: 999;
margin: 0;
padding: 0;
background-color: #fff;
list-style-type: none;
clear: left;
}

ul.token-input-list-facebook li input {

border: 0;
width: 100px;
padding: 3px 8px;
background-color: white;
margin: 2px 0;
-webkit-appearance: caret;

}

li.token-input-token-facebook {

overflow: hidden; 
height: auto !important; 
height: 15px;
margin: 3px;
padding: 1px 3px;
background-color: #eff2f7;
color: #000;
cursor: default;
border: 1px solid #ccd5e4;
font-size: 11px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
float: left;
white-space: nowrap;

}

li.token-input-token-facebook p {

display: inline;
padding: 0;
margin: 0;

}

li.token-input-token-facebook span {

color: #a6b3cf;
margin-left: 5px;
font-weight: bold;
cursor: pointer;

}

li.token-input-selected-token-facebook {

background-color: #5670a6;
border: 1px solid #3b5998;
color: #fff;

}

li.token-input-input-token-facebook {

float: left;
margin: 0;
padding: 0;
list-style-type: none;

}

.gwt-SuggestBoxPopup { 
   border: thin 1px solid green; 
   width: 200px;
   z-index: 999999 !important;
}
.gwt-SuggestBoxPopup.item { 
   color: red; 
}
.gwt-SuggestBoxPopup .item-selected { 
   color: gray;
}
.gwt-SuggestBoxPopup .suggestPopupTopLeft { 
   border: thin 1px solid green; 
}
.gwt-SuggestBoxPopup .suggestPopupTopLeftInner { 
   border: thin 1px solid green; 
}
.gwt-SuggestBoxPopup .suggestPopupTopCenter { 
   border: thin 1px solid green; 
}
.gwt-SuggestBoxPopup .suggestPopupTopCenterInner { 
   border: thin 1px solid green; 
}
.gwt-SuggestBoxPopup .suggestPopupTopRight {
   border: thin 1px solid green; 
}
.gwt-SuggestBoxPopup .suggestPopupTopRightInner {
   border: thin 1px solid green; 
}
.gwt-SuggestBoxPopup .suggestPopupMiddleLeft { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupMiddleLeftInner { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupMiddleCenter { 
   border: thin 1px solid green; width:200px;
}
.gwt-SuggestBoxPopup .suggestPopupMiddleCenterInner { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupMiddleRight { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupMiddleRightInner { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupBottomLeft {
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupBottomLeftInner { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupBottomCenter {
   border: thin 1px solid green;
 }
.gwt-SuggestBoxPopup .suggestPopupBottomCenterInner { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupBottomRight { 
   border: thin 1px solid green;
}
.gwt-SuggestBoxPopup .suggestPopupBottomRightInner { 
   border: thin 1px solid green;
}

2. The fix above will correct only style of PopupBox and its z-index, but there could be a wrong styling for other InputListWidget components as well if your project does not inherit any GWT skins.

  • So be sure to use proper inheritance of it in your *.gwt.xml file e.g.:
    <inherits name='com.google.gwt.user.theme.standard.Standard' />
  • Or add related missed styles to your CSS along with gwt-SuggestBoxPopup styles.









Friday, November 22, 2013

How to wrapp GWT component into SmartGWT

Suppouse that InputListWidget is a component that extends Composite GWT class. The rest of the code snippet is a SmartGWT.

//SmartGWT
Canvas inputListWidgetWrapper = new Canvas(); 
inputListWidgetWrapper.setWidth(360);
inputListWidgetWrapper.setHeight(70);
inputListWidgetWrapper.addChild(new InputListWidget());

DynamicForm form = new DynamicForm();        
form.addChild(inputListWidgetWrapper);

Thursday, September 13, 2012

How to change page for debugging in GWT/SmartGWT hosted mode

In order to change plugging in GWT/SmartGWT hosted mode is enough to do small changes in generated URL.

EXAMPLE
If there is a need to show HELP page you have to do this:

FROM THIS http://127.0.0.1:8888/trinity_cust.html?gwt.codesvr=127.0.0.1:9997
TO THIS http://127.0.0.1:8888/help.htm?gwt.codesvr=127.0.0.1:9997


This file is located inside of help folder of ui-branding module: ui-branding... /webapp-... /help

Friday, November 11, 2011

How to use Eclipse plugin for Maven

Read this post:
http://googlewebtoolkit.blogspot.com/2010/08/how-to-use-google-plugin-for-eclipse.html

Wednesday, May 11, 2011

How to install GWT SDK and SmartGWT on Mac

Install GWT on Mac like this:
1. Download GWT SDK from this site http://code.google.com/intl/uk-UA/webtoolkit/download.html

2. Unzip it and move it to Applications folder on your Mac.

Install SmartGWT on Mac like this:
1. Download  SmartGWT from this site http://www.smartclient.com/product/download.jsp

2. Unzip it and move it to Applications folder on your Mac.

In Terminal set GWT_HOME and GST_HOME like this:
Open in Terminal with Vim .profile: vi ~/.profile
Add these lines:
export GWT_HOME=/Applications/gwt-2.1.1 (put here your version of gwt)
export GST_HOME=/Applications/smartgwt-2.4 (put here your version of smartgwt)
Restart your Mac and in Terminal check path to GWT_HOME and GST_HOME:
echo $GWT_HOME
echo $GST_HOME


That's all.