Skip to content

Commit f1750be

Browse files
committed
Added ExternalLibrary access to js dependencies for ease of access.
Masonry - reworked on main functionalities. (add/remove/insert/clear).
1 parent 1f6bf9b commit f1750be

File tree

17 files changed

+88
-34
lines changed

17 files changed

+88
-34
lines changed

.utility/update_demo_site.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
set -ev
3-
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "release_2.0" ]; then
3+
if [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "rework/mk_09/2017" ]; then
44

55
if [[ -z "$GH_TOKEN" ]]; then
66
echo -e "GH_TOKEN is not set"

src/main/java/gwt/material/design/demo/client/application/addins/avatar/AvatarView.ui.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<g:HTMLPanel>
2727
<m:MaterialRow addStyleNames="code">
2828
<m:MaterialTitle title="Usage" />
29+
<demo:ExternalLibrary text="JDenticon 1.3.2" link="https://github.com/dmester/jdenticon"/>
2930
<demo:PrettyPre addStyleNames="lang-xml">
3031
&emsp;&lt;!-- Addin Import --><br/>
3132
xmlns:ma="urn:import:gwt.material.design.addins.client"<br/><br/>

src/main/java/gwt/material/design/demo/client/application/addins/combobox/ComboBoxView.ui.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<m:MaterialPanel>
2626
<m:MaterialRow addStyleNames="code">
2727
<m:MaterialTitle title="Usage" />
28+
<demo:ExternalLibrary text="Select2 4.0.3" link="https://github.com/select2/select2" />
2829
<demo:PrettyPre addStyleNames="lang-xml">
2930
&emsp;&lt;!-- Addin Import --><br/>
3031
xmlns:ma="urn:import:gwt.material.design.addins.client"<br/><br/>

src/main/java/gwt/material/design/demo/client/application/addins/dnd/DndView.ui.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<m:MaterialPanel>
2626
<m:MaterialRow addStyleNames="code">
2727
<m:MaterialTitle title="Introduction" />
28+
<demo:ExternalLibrary text="InteractJs 1.2.6" link="https://github.com/taye/interact.js"/>
2829
<m:MaterialPanel backgroundColor="GREY_LIGHTEN_4" padding="10">
2930
<m:MaterialPanel ui:field="panel" margin="10" textAlign="CENTER" paddingTop="50" backgroundColor="WHITE" waves="DEFAULT" width="150px" height="150px" shadow="1">
3031
<m:MaterialIcon iconType="TOUCH_APP" iconSize="SMALL" />

src/main/java/gwt/material/design/demo/client/application/addins/fileuploader/FileUploaderView.ui.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<g:HTMLPanel>
2727
<m:MaterialRow addStyleNames="code">
2828
<m:MaterialTitle title="Usage" />
29+
<demo:ExternalLibrary text="DropzoneJs 4.3.0" link="https://github.com/enyo/dropzone" />
2930
<demo:PrettyPre addStyleNames="lang-xml">
3031
&emsp;&lt;!-- Addin Import --><br/>
3132
xmlns:ma="urn:import:gwt.material.design.addins.client"<br/><br/>

src/main/java/gwt/material/design/demo/client/application/addins/masonry/MasonryView.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.google.gwt.user.client.ui.Widget;
2929
import com.gwtplatform.mvp.client.ViewImpl;
3030
import gwt.material.design.addins.client.masonry.MaterialMasonry;
31+
import gwt.material.design.client.ui.MaterialToast;
3132
import gwt.material.design.demo.client.application.addins.autocomplete.base.User;
3233
import gwt.material.design.demo.client.application.addins.masonry.cards.UserCard;
3334
import gwt.material.design.demo.client.application.dto.DataHelper;
@@ -42,21 +43,43 @@ interface Binder extends UiBinder<Widget, MasonryView> {
4243
@UiField
4344
MaterialMasonry dynamicMasonry;
4445

46+
int totalItems;
47+
4548
@Inject
4649
MasonryView(Binder uiBinder) {
4750
initWidget(uiBinder.createAndBindUi(this));
4851
buildDynamicMasonry();
4952
}
5053

5154
private void buildDynamicMasonry() {
52-
dynamicMasonry.clear();
5355
for(User user : DataHelper.getAllUsers()) {
5456
dynamicMasonry.add(new UserCard(user, dynamicMasonry));
5557
}
58+
totalItems = dynamicMasonry.getWidgetCount();
59+
dynamicMasonry.reload();
5660
}
5761

5862
@UiHandler("btnAddItem")
5963
void onAddItem(ClickEvent e) {
64+
totalItems++;
6065
dynamicMasonry.add(new UserCard(DataHelper.getAllUsers().get(0), dynamicMasonry));
6166
}
67+
68+
@UiHandler("btnClearAll")
69+
void clearAll(ClickEvent e) {
70+
dynamicMasonry.clear();
71+
}
72+
73+
@UiHandler("btnInsertTo")
74+
void inserTo(ClickEvent e) {
75+
UserCard userCard = new UserCard(DataHelper.getAllUsers().get(0), dynamicMasonry);
76+
dynamicMasonry.insert(userCard, 2);
77+
}
78+
79+
@UiHandler("btnRemoveLast")
80+
void removeLast(ClickEvent e) {
81+
totalItems--;
82+
dynamicMasonry.remove(totalItems);
83+
}
84+
6285
}

src/main/java/gwt/material/design/demo/client/application/addins/masonry/MasonryView.ui.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<m:MaterialPanel>
2626
<m:MaterialRow addStyleNames="code">
2727
<m:MaterialTitle title="Usage" />
28+
<demo:ExternalLibrary text="Masonry 4.0.0" link="https://github.com/desandro/masonry" />
2829
<demo:PrettyPre addStyleNames="lang-xml">
2930
&emsp;&lt;!-- Addin Import --><br/>
3031
xmlns:ma="urn:import:gwt.material.design.addins.client"<br/><br/>
@@ -274,32 +275,34 @@
274275
&lt;/ma:masonry.MaterialMasonry><br/>
275276
</demo:PrettyPre>
276277
</m:MaterialRow>
277-
278278
<m:MaterialRow addStyleNames="code">
279279
<m:MaterialRow>
280280
<m:MaterialTitle title="Dynamic Adding and Removing" description="You can easily add / remove items with transition animations and reload the masonry easily."/>
281281
<m:MaterialButton ui:field="btnAddItem" margin="12" text="Add New Item" />
282-
<ma:masonry.MaterialMasonry ui:field="dynamicMasonry" />
282+
<m:MaterialButton ui:field="btnClearAll" margin="12" text="Clear" />
283+
<m:MaterialButton ui:field="btnInsertTo" margin="12" text="Insert to second slot" />
284+
<m:MaterialButton ui:field="btnRemoveLast" margin="12" text="Remove Last" />
285+
<ma:masonry.MaterialMasonry ui:field="dynamicMasonry" originTop="true" />
283286
</m:MaterialRow>
284-
287+
285288
<demo:PrettyPre addStyleNames="lang-java">
286289
&emsp;//Populate your data source to masonry using UserCard<br/>
287290
masonry.clear();<br/>
288291
for(User user : DataHelper.getAllUsers()) {<br/>
289292
&emsp;masonry.add(new UserCard(user));<br/>
290293
}
291294
</demo:PrettyPre>
292-
295+
293296
<demo:PrettyPre addStyleNames="lang-java">
294297
&emsp;// Dynamic adding<br/>
295298
masonry.add(new UserCard(user));<br/>
296299
</demo:PrettyPre>
297-
300+
298301
<demo:PrettyPre addStyleNames="lang-java">
299302
&emsp;// Dynamic inserting<br/>
300303
masonry.insert(new UserCard(user), 3));<br/>
301304
</demo:PrettyPre>
302-
305+
303306
<demo:PrettyPre addStyleNames="lang-java">
304307
&emsp;// Dynamic Removing<br/>
305308
masonry.remove(usercard);<br/>

src/main/java/gwt/material/design/demo/client/application/addins/masonry/cards/UserCard.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.gwt.uibinder.client.UiBinder;
2828
import com.google.gwt.uibinder.client.UiField;
2929
import com.google.gwt.uibinder.client.UiHandler;
30+
import com.google.gwt.user.client.Random;
3031
import com.google.gwt.user.client.ui.Composite;
3132
import com.google.gwt.user.client.ui.Widget;
3233
import gwt.material.design.addins.client.masonry.MaterialMasonry;
@@ -49,12 +50,19 @@ interface UserCardUiBinder extends UiBinder<Widget, UserCard> {
4950

5051
private MaterialMasonry rowCards;
5152

53+
private int[] items = new int[]{200,100,150};
54+
55+
public int getRandomHeight(){
56+
return items[Random.nextInt(items.length)];
57+
}
58+
5259
public UserCard(User user, final MaterialMasonry rowCards) {
5360
initWidget(uiBinder.createAndBindUi(this));
5461
imgUser.setUrl(user.getPicture());
5562
lblName.setText(user.getName());
5663
lblEmail.setText(user.getEmail());
5764
this.rowCards = rowCards;
65+
setHeight(getRandomHeight() + "px");
5866
}
5967

6068
@UiHandler("btnRemove")

src/main/java/gwt/material/design/demo/client/application/addins/pathanimator/PathAnimatorView.ui.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<g:HTMLPanel>
3434
<m:MaterialRow addStyleNames="code">
3535
<m:MaterialTitle title="Markup Definition" description="FIRST , Set your source and target components."/>
36+
<demo:ExternalLibrary text="CTAJs 0.3.2" link="https://github.com/chinchang/cta.js" />
3637
<demo:PrettyPre addStyleNames="lang-xml">
3738
&emsp;&lt;!-- Source Component --><br/>
3839
&lt;m:MaterialButton ui:field="btnSource" text="Meaningful Transitions" backgroundColor="BLUE" size="LARGE" /><br/><br/>

src/main/java/gwt/material/design/demo/client/application/addins/richeditor/RichEditorView.ui.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<g:HTMLPanel>
3030
<m:MaterialRow addStyleNames="code">
3131
<m:MaterialTitle title="Usage" />
32+
<demo:ExternalLibrary text="MaterialNote 1.2.1" link="https://github.com/Cerealkillerway/materialNote" />
3233
<demo:PrettyPre addStyleNames="lang-xml">
3334
&emsp;&lt;!-- Addin Import --><br/>
3435
xmlns:ma="urn:import:gwt.material.design.addins.client"<br/><br/>

0 commit comments

Comments
 (0)