Skip to content

Commit 3ec77ef

Browse files
author
Korbel Daniel
committed
Merge remote-tracking branch
'GwtMaterialDesign/gwt-material-addins/release_1.6.0' into release_1.6.0 Conflicts: src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java
2 parents f9ffa60 + 63f8286 commit 3ec77ef

32 files changed

+2063
-50
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cache:
77
- $HOME/.m2
88
before_install:
99
# install the gwt-material library before we build the demo
10-
- git clone -b release_1.5.1 https://github.com/GwtMaterialDesign/gwt-material.git
10+
- git clone -b release_1.6.0 https://github.com/GwtMaterialDesign/gwt-material.git
1111
- cd gwt-material
1212
- mvn install -DskipTests=true -DdryRun=true
1313
- cd ..

.utility/deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -ev
3-
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_1.5.1" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_1.6.0" ]; then
44
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
55
mvn deploy --settings ~/settings.xml
6-
fi
6+
fi

src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import gwt.material.design.client.base.*;
3434
import gwt.material.design.client.base.mixin.CssTypeMixin;
3535
import gwt.material.design.client.base.mixin.ErrorMixin;
36+
import gwt.material.design.client.base.mixin.FocusableMixin;
3637
import gwt.material.design.client.base.mixin.ProgressMixin;
3738
import gwt.material.design.client.constants.IconType;
3839
import gwt.material.design.client.constants.ProgressType;
@@ -185,6 +186,9 @@ public class MaterialAutoComplete extends MaterialWidget implements HasError, Ha
185186

186187
private final ErrorMixin<MaterialAutoComplete, MaterialLabel> errorMixin = new ErrorMixin<>(this,
187188
lblError, list);
189+
190+
private FocusableMixin<MaterialWidget> focusableMixin;
191+
188192
public final CssTypeMixin<AutocompleteType, MaterialAutoComplete> typeMixin = new CssTypeMixin<>(this);
189193

190194
/**
@@ -215,7 +219,7 @@ public MaterialAutoComplete(SuggestOracle suggestions) {
215219
/**
216220
* Generate and build the List Items to be set on Auto Complete box.
217221
*/
218-
private void generateAutoComplete(SuggestOracle suggestions) {
222+
protected void generateAutoComplete(SuggestOracle suggestions) {
219223
list.setStyleName("multiValueSuggestBox-list");
220224
this.suggestions = suggestions;
221225
final ListItem item = new ListItem();
@@ -431,6 +435,12 @@ public void clear() {
431435
clearErrorOrSuccess();
432436
}
433437

438+
@Override
439+
protected FocusableMixin<MaterialWidget> getFocusableMixin() {
440+
if(focusableMixin == null) { focusableMixin = new FocusableMixin<>(new MaterialWidget(itemBox.getElement())); }
441+
return focusableMixin;
442+
}
443+
434444
/**
435445
* @return the item values on autocomplete
436446
* @see #getValue()
@@ -531,6 +541,11 @@ public void setError(String error) {
531541
public void setSuccess(String success) {
532542
errorMixin.setSuccess(success);
533543
}
544+
545+
@Override
546+
public void setHelperText(String helperText) {
547+
errorMixin.setHelperText(helperText);
548+
}
534549

535550
@Override
536551
public void clearErrorOrSuccess() {
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
package gwt.material.design.addins.client.avatar;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 GwtMaterialDesign
8+
* %%
9+
* Licensed under the Apache License, Version 2.0 (the "License");
10+
* you may not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS,
17+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
* #L%
21+
*/
22+
23+
import com.google.gwt.dom.client.Document;
24+
import gwt.material.design.addins.client.MaterialAddins;
25+
import gwt.material.design.addins.client.dnd.MaterialDndClientBundle;
26+
import gwt.material.design.addins.client.dnd.MaterialDndDebugClientBundle;
27+
import gwt.material.design.client.MaterialDesignBase;
28+
import gwt.material.design.client.base.MaterialWidget;
29+
30+
//@formatter:off
31+
32+
/**
33+
* Generated avatar based on @link(https://jdenticon.com/)
34+
* provides a unique avatar based on unique name.
35+
*
36+
* <h3>XML Namespace Declaration</h3>
37+
* <pre>
38+
* {@code
39+
* xmlns:ma='urn:import:gwt.material.design.addins.client'
40+
* }
41+
* </pre>
42+
*
43+
* <h3>UiBinder Usage:</h3>
44+
* <pre>
45+
* {@code
46+
*
47+
* <ma:avatar.MaterialAvatar name="kevzlou7979" width="80" height="80"/>
48+
*
49+
* }
50+
* </pre>
51+
*
52+
* @author kevzlou7979
53+
* @see <a href="http://gwtmaterialdesign.github.io/gwt-material-demo/#avatar">Material Avatar</a>
54+
*/
55+
//@formatter:on
56+
public class MaterialAvatar extends MaterialWidget {
57+
58+
static {
59+
if(MaterialAddins.isDebug()) {
60+
MaterialDesignBase.injectDebugJs(MaterialAvatarDebugClientBundle.INSTANCE.jdenticonDebugJs());
61+
MaterialDesignBase.injectDebugJs(MaterialAvatarDebugClientBundle.INSTANCE.jdenticonDebugJs());
62+
} else {
63+
MaterialDesignBase.injectJs(MaterialAvatarClientBundle.INSTANCE.jdenticonJs());
64+
MaterialDesignBase.injectJs(MaterialAvatarClientBundle.INSTANCE.md5Js());
65+
}
66+
67+
}
68+
69+
private String name;
70+
71+
public MaterialAvatar() {
72+
super(Document.get().createCanvasElement());
73+
}
74+
75+
public MaterialAvatar(String name) {
76+
this();
77+
setName(name);
78+
}
79+
80+
@Override
81+
protected void onLoad() {
82+
super.onLoad();
83+
if(getName() != null) {
84+
initialize();
85+
}
86+
}
87+
88+
/**
89+
* Get the name of the avatar
90+
* @return
91+
*/
92+
public String getName() {
93+
return name;
94+
}
95+
96+
/**
97+
* Set the name of the avatar and hashed it using md5 js library to
98+
* pass it into jdenticon avatar process
99+
* @param name
100+
*/
101+
public void setName(String name) {
102+
this.name = name;
103+
}
104+
105+
@Override
106+
public void setWidth(String width) {
107+
getElement().setAttribute("width", width);
108+
}
109+
110+
@Override
111+
public void setHeight(String height) {
112+
getElement().setAttribute("height", height);
113+
}
114+
115+
/**
116+
* Generate hash code - needed by jdenticon to generate avatar
117+
* @param value
118+
* @return
119+
*/
120+
protected native String generateHashCode(String value) /*-{
121+
return $wnd.md5(value);
122+
}-*/;
123+
124+
/**
125+
* Initialize the avatar process - useful when trying to update your avatar
126+
*/
127+
public void initialize() {
128+
getElement().setAttribute("data-jdenticon-hash", generateHashCode(getName()));
129+
update();
130+
}
131+
132+
protected native void update() /*-{
133+
$wnd.jdenticon();
134+
}-*/;
135+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package gwt.material.design.addins.client.avatar;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 - 2016 GwtMaterialDesign
8+
* %%
9+
* Licensed under the Apache License, Version 2.0 (the "License");
10+
* you may not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS,
17+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
* #L%
21+
*/
22+
23+
24+
import com.google.gwt.core.client.GWT;
25+
import com.google.gwt.resources.client.ClientBundle;
26+
import com.google.gwt.resources.client.TextResource;
27+
28+
/**
29+
* Client Bundle for Avatar component
30+
* @author kevzlou7979
31+
*/
32+
public interface MaterialAvatarClientBundle extends ClientBundle {
33+
34+
MaterialAvatarClientBundle INSTANCE = GWT.create(MaterialAvatarClientBundle.class);
35+
36+
@Source("resources/js/jdenticon-1.3.2.min.js")
37+
TextResource jdenticonJs();
38+
39+
@Source("resources/js/md5.min.js")
40+
TextResource md5Js();
41+
42+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package gwt.material.design.addins.client.avatar;
2+
3+
/*
4+
* #%L
5+
* GwtMaterial
6+
* %%
7+
* Copyright (C) 2015 - 2016 GwtMaterialDesign
8+
* %%
9+
* Licensed under the Apache License, Version 2.0 (the "License");
10+
* you may not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS,
17+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
* #L%
21+
*/
22+
23+
24+
import com.google.gwt.core.client.GWT;
25+
import com.google.gwt.resources.client.ClientBundle;
26+
import com.google.gwt.resources.client.TextResource;
27+
28+
/**
29+
* Client Bundle for Avatar component
30+
* @author kevzlou7979
31+
*/
32+
public interface MaterialAvatarDebugClientBundle extends ClientBundle {
33+
34+
MaterialAvatarDebugClientBundle INSTANCE = GWT.create(MaterialAvatarDebugClientBundle.class);
35+
36+
@Source("resources/js/jdenticon-1.3.2.js")
37+
TextResource jdenticonDebugJs();
38+
39+
@Source("resources/js/md5.js")
40+
TextResource md5DebugJs();
41+
}

src/main/java/gwt/material/design/addins/client/bubble/MaterialBubble.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected void onLoad() {
9292
* @param color - color of the bubble
9393
* @param type - type of the bubble (RIGHT, TOP, LEFT, BOTTOM)
9494
*/
95-
private native void initBubble(Element element, String color, String type) /*-{
95+
protected native void initBubble(Element element, String color, String type) /*-{
9696
$wnd.jQuery(document).ready(function() {
9797
$wnd.jQuery(element).bubble({
9898
position: type,

src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public void closeCutOut(boolean autoClosed) {
391391
/**
392392
* Setups the cut out position when the screen changes size or is scrolled.
393393
*/
394-
private native void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle)/*-{
394+
protected native void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle)/*-{
395395
var rect = relativeTo.getBoundingClientRect();
396396
397397
var top = rect.top;
@@ -429,7 +429,7 @@ private native void setupCutOutPosition(Element cutOut, Element relativeTo, int
429429
* Configures a resize handler and a scroll handler on the window to
430430
* properly adjust the Cut Out.
431431
*/
432-
private void setupWindowHandlers(){
432+
protected void setupWindowHandlers(){
433433
if (resizeHandler != null){
434434
resizeHandler.removeHandler();
435435
}
@@ -449,8 +449,8 @@ public void onWindowScroll(ScrollEvent event) {
449449
}
450450
});
451451
}
452-
453-
private void setupTransition(){
452+
453+
protected void setupTransition(){
454454
if (animated){
455455
focus.getStyle().setProperty("WebkitTransition", "box-shadow " + animationDuration + " " + animationTimingFunction);
456456
focus.getStyle().setProperty("transition", "box-shadow " + animationDuration + " " + animationTimingFunction);
@@ -465,7 +465,7 @@ private void setupTransition(){
465465
* Gets the computed background color, based on the backgroundColor CSS
466466
* class.
467467
*/
468-
private void setupComputedBackgroundColor() {
468+
protected void setupComputedBackgroundColor() {
469469
// temp is just a widget created to evaluate the computed background
470470
// color
471471
MaterialWidget temp = new MaterialWidget(Document.get().createDivElement());

src/main/java/gwt/material/design/addins/client/dnd/MaterialDnd.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void onAttachOrDetach(AttachEvent event) {
109109
* Initialize the draggable widget and it's properties
110110
* @param target
111111
*/
112-
private native void initDraggable(Element target, boolean inertia, String restriction, boolean endOnly,
112+
protected native void initDraggable(Element target, boolean inertia, String restriction, boolean endOnly,
113113
double top, double left, double bottom, double right) /*-{
114114
var that = this;
115115
$wnd.jQuery(document).ready(function() {
@@ -189,14 +189,14 @@ public void onAttachOrDetach(AttachEvent event) {
189189
/**
190190
* Initialize the ignoreFrom function as selector to exclude any widget from dragging
191191
*/
192-
private native void initIgnoreFrom(Element target, String selector) /*-{
192+
protected native void initIgnoreFrom(Element target, String selector) /*-{
193193
$wnd.interact(target).ignoreFrom(selector);
194194
}-*/;
195195

196196
/**
197197
* Initialize the ignoreFrom function to exclude any widget from dragging
198198
*/
199-
private native void initIgnoreFrom(Element target, Element ignoreFrom) /*-{
199+
protected native void initIgnoreFrom(Element target, Element ignoreFrom) /*-{
200200
$wnd.interact(target).ignoreFrom(ignoreFrom);
201201
}-*/;
202202

@@ -227,7 +227,7 @@ public void onDragStart(DragStartEvent event) {
227227
}, DragStartEvent.TYPE);
228228
}
229229

230-
private void fireDragStartEvent() {
230+
protected void fireDragStartEvent() {
231231
DragStartEvent.fire(this);
232232
}
233233

@@ -243,7 +243,7 @@ public void onDragMove(DragMoveEvent event) {
243243
}, DragMoveEvent.TYPE);
244244
}
245245

246-
private void fireDragMoveEvent() {
246+
protected void fireDragMoveEvent() {
247247
DragMoveEvent.fire(this);
248248
}
249249

@@ -259,7 +259,7 @@ public void onDragEnd(DragEndEvent event) {
259259
}, DragEndEvent.TYPE);
260260
}
261261

262-
private void fireDragEndEvent() {
262+
protected void fireDragEndEvent() {
263263
DragEndEvent.fire(this);
264264
}
265265
}

0 commit comments

Comments
 (0)