Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2 from gwtbootstrap3/master
Browse files Browse the repository at this point in the history
sync to master
  • Loading branch information
mharray committed Apr 30, 2015
2 parents a867e4a + 390e278 commit a576cbb
Show file tree
Hide file tree
Showing 272 changed files with 9,926 additions and 452 deletions.
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
sudo: false

language: java

jdk:
- oraclejdk8
- oraclejdk7

branches:
only:
- master

cache:
directories:
- $HOME/.m2

before_install:
# install the gwtbootstrap3 library before we build the extras
- git clone https://github.com/gwtbootstrap3/gwtbootstrap3.git
- cd gwtbootstrap3
- mvn install -DskipTests=true -DdryRun=true
- cd ..

install: true

script:
- mvn clean install -DdryRun=true -Dlicense.failOnMissingHeader=true -Dlicense.failOnNotUptodateHeader=true

after_success:
- ./deploy.sh
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ To use the widgets defined here, you will need to add this dependency.
</dependency>
```

If you have any questions, please ask them on our [Google Group](https://groups.google.com/forum/?fromgroups#!forum/gwtbootstrap3)
* Want to see the demo as the v1.0-SNAPSHOT is worked on? Visit the 1.0-SNAPSHOT demo [here](http://gwtbootstrap3.github.io/gwtbootstrap3-demo/snapshot).
* The API docs for the v1.0-SNAPSHOT can be found [here](http://gwtbootstrap3.github.io/gwtbootstrap3-demo/snapshot/apidocs) as well.

If you have any questions, please ask them on our [Google Group](https://groups.google.com/forum/?fromgroups#!forum/gwtbootstrap3)
6 changes: 6 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -ev
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
echo "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy --settings ~/settings.xml
fi
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.gwtbootstrap3</groupId>
<artifactId>gwtbootstrap3-parent</artifactId>
<version>0.9-SNAPSHOT</version>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>gwtbootstrap3-extras</artifactId>
Expand Down
177 changes: 177 additions & 0 deletions src/main/java/org/gwtbootstrap3/extras/bootbox/client/Bootbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
* #L%
*/

import com.google.gwt.core.client.JavaScriptObject;
import org.gwtbootstrap3.extras.bootbox.client.callback.AlertCallback;
import org.gwtbootstrap3.extras.bootbox.client.callback.ConfirmCallback;
import org.gwtbootstrap3.extras.bootbox.client.callback.PromptCallback;
import org.gwtbootstrap3.extras.bootbox.client.constants.BootboxSize;

/**
* Created by kyle on 2013/12/11.
Expand Down Expand Up @@ -75,4 +77,179 @@ public static native void prompt(String msg, PromptCallback callback) /*-{
callback.@org.gwtbootstrap3.extras.bootbox.client.callback.PromptCallback::callback(Ljava/lang/String;)(result);
});
}-*/;

/**
* Displays a completely customisable dialog in a modal dialog box.
*
* @param dialog the dialog configuration.
*/
public static native void dialog(Dialog dialog) /*-{
$wnd.bootbox.dialog(dialog);
}-*/;

/**
* Hide all currently active bootbox dialogs.
* <p>Individual dialogs can be closed as per normal Bootstrap dialogs: dialog.modal('hide').
*/
public static native void hideAll() /*-{
$wnd.bootbox.hideAll();
}-*/;

/**
* Creates a Defaults object.
*/
public static Defaults createDefaults() {
return Defaults.create();
}

/**
* Used to provide defaults configurations to Bootbox.
*
* @author Tercio Gaudencio Filho (terciofilho [at] gmail.com)
*/
public static class Defaults extends JavaScriptObject {

protected Defaults() {
}

public static final Defaults create() {
return JavaScriptObject.createObject().cast();
}

public final native Defaults setLocale(final String locale) /*-{
this.locale = locale;
return this;
}-*/;

public final native Defaults setShow(final boolean show) /*-{
this.show = show;
return this;
}-*/;

public final native Defaults setBackdrop(final boolean backdrop) /*-{
this.backdrop = backdrop;
return this;
}-*/;

public final native Defaults setCloseButton(final boolean closeButton) /*-{
this.closeButton = closeButton;
return this;
}-*/;

public final native Defaults setAnimate(final boolean animate) /*-{
this.animate = animate;
return this;
}-*/;

public final native Defaults setClassName(final String className) /*-{
this.className = className;
return this;
}-*/;

/**
* Define Bootbox defaults. Call this method to set the defaults in Bootbox.
*/
public final native void setDefaults() /*-{
$wnd.bootbox.setDefaults(this);
}-*/;

}

/**
* Used to provide a Dialog configuration.
*
* @author Tercio Gaudencio Filho (terciofilho [at] gmail.com)
*/
public static class Dialog extends JavaScriptObject {

protected Dialog() {
}

public static final Dialog create() {
return JavaScriptObject.createObject().cast();
}

public final native Dialog setMessage(final String message) /*-{
this.message = message;
return this;
}-*/;

public final native Dialog setTitle(final String title) /*-{
this.title = title;
return this;
}-*/;

public final native Dialog setOnEscape(final AlertCallback callback) /*-{
this.onEscape = function() {
callback.@org.gwtbootstrap3.extras.bootbox.client.callback.AlertCallback::callback()();
};
return this;
}-*/;

public final native Dialog setBackdrop(final boolean backdrop) /*-{
this.backdrop = backdrop;
return this;
}-*/;

public final native Dialog setCloseButton(final boolean closeButton) /*-{
this.closeButton = closeButton;
return this;
}-*/;

public final native Dialog setAnimate(final boolean animate) /*-{
this.animate = animate;
return this;
}-*/;

public final native Dialog setClassName(final String className) /*-{
this.className = className;
return this;
}-*/;

public final native Dialog setSize(final BootboxSize size) /*-{
this.size = size.@org.gwtbootstrap3.extras.bootbox.client.constants.BootboxSize::getSize()();
return this;
}-*/;

public final native Dialog addButton(String label , String className, AlertCallback callback) /*-{
this.buttons = this.buttons || {};
this.buttons[label] = {
className: className,
callback: function() {
callback.@org.gwtbootstrap3.extras.bootbox.client.callback.AlertCallback::callback()();
}
};
return this;
}-*/;

public final native Dialog addButton(String label , String className) /*-{
this.buttons = this.buttons || {};
this.buttons[label] = {
className: className
};
return this;
}-*/;

public final native Dialog addButton(String label , AlertCallback callback) /*-{
this.buttons = this.buttons || {};
this.buttons[label] = {
callback: function() {
callback.@org.gwtbootstrap3.extras.bootbox.client.callback.AlertCallback::callback()();
}
};
return this;
}-*/;

public final native Dialog addButton(String label) /*-{
this.buttons = this.buttons || {};
this.buttons[label] = {};
return this;
}-*/;

public final void show() {
Bootbox.dialog(this);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ interface BootboxClientBundle extends ClientBundle {

static final BootboxClientBundle INSTANCE = GWT.create(BootboxClientBundle.class);

@Source("resource/js/bootbox-4.1.0.min.cache.js")
@Source("resource/js/bootbox-4.4.0.min.cache.js")
TextResource bootbox();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.gwtbootstrap3.extras.bootbox.client.constants;

/*
* #%L
* GwtBootstrap3
* %%
* Copyright (C) 2013 - 2014 GwtBootstrap3
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/

/**
* Bootbox window size.
*
* @author Tercio Gaudencio Filho (terciofilho [at] gmail.com)
*/
public enum BootboxSize {

LARGE("large"), SMALL("small");

private String size;

private BootboxSize(String size) {
this.size=size;
}

public String getSize() {
return size;
}

}
Loading

0 comments on commit a576cbb

Please sign in to comment.