aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/updatePushVersion.sh
blob: d2e83e045423d2499a3c57f6142fd077e2c5eb1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

if [ "$#" != "2" ]
then
    echo "Usage: $0 <runtime version> <js version>"
    echo "If the runtime version contains the string 'vaadin', then a vaadin atmosphere version will be assumed, otherwise an upstream atmosphere version".
    echo "If a version is set to -, the version will not be updated"
    exit 1
fi

pushd `dirname $0`/.. > /dev/null
basedir=`pwd`
popd > /dev/null

currentRuntime=`grep ENTITY "$basedir"/push/ivy.xml|grep runtime.version|cut -d\" -f 2`
currentJs=`grep ENTITY "$basedir"/push/ivy.xml|grep js.version|cut -d\" -f 2`

sed=`which sed`

uname|grep Darwin > /dev/null
if [ "$?" = "0" ]
then
	# Mac if uname output contains Darwin
	sed=`which gsed`
	if [ "$sed" = "" ]
	then
		echo "Install gnu sed (gsed) using e.g. brew install gnu-sed"
		exit 2
	fi
fi

echo "Currently using runtime $currentRuntime and JS $currentJs"

newRuntime=$1
newJs=$2

if [ "$newRuntime" != "-" ]
then
    echo "Updating runtime to $newRuntime..."
    $sed -i "s#$currentRuntime#$newRuntime#" "$basedir"/push/ivy.xml
    $sed -i "s/$currentRuntime/$newRuntime/g" "$basedir"/push/build.xml
    $sed -i "s/$currentRuntime/$newRuntime/g" "$basedir"/server/src/com/vaadin/server/Constants.java
    if [[ $newRuntime == *"vaadin"* ]]
    then
        $sed -i "s/org.atmosphere/com.vaadin.external.atmosphere/g" "$basedir"/push/ivy.xml
    else
        $sed -i "s/com.vaadin.external.atmosphere/org.atmosphere/g" "$basedir"/push/ivy.xml
    fi
fi

if [ "$newJs" != "-" ]
then
    echo "Updating JS to $newJs..."
    $sed -i "s/$currentJs/$newJs/g" "$basedir"/push/ivy.xml
fi
layout.addComponent(button); // A thread to do some work class WorkThread extends Thread { // Volatile because read in another thread in access() volatile double current = 0.0; @Override public void run() { // Count up until 1.0 is reached while (current < 1.0) { current += 0.01; // Do some "heavy work" try { sleep(50); // Sleep for 50 milliseconds } catch (InterruptedException e) {} // Update the UI thread-safely UI.getCurrent().access(new Runnable() { @Override public void run() { progress.setValue(new Float(current)); if (current < 1.0) status.setValue("" + ((int)(current*100)) + "% done"); else status.setValue("all done"); } }); } // Show the "all done" for a while try { sleep(2000); // Sleep for 2 seconds } catch (InterruptedException e) {} // Update the UI thread-safely UI.getCurrent().access(new Runnable() { @Override public void run() { // Restore the state to initial progress.setValue(new Float(0.0)); progress.setEnabled(false); // Stop polling UI.getCurrent().setPollInterval(-1); button.setEnabled(true); status.setValue("not running"); } }); } } // Clicking the button creates and runs a work thread button.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final WorkThread thread = new WorkThread(); thread.start(); // Enable polling and set frequency to 0.5 seconds UI.getCurrent().setPollInterval(500); // Disable the button until the work is done progress.setEnabled(true); button.setEnabled(false); status.setValue("running..."); } }); ---- The example is illustrated in <<figure.components.progressbar.thread>>. [[figure.components.progressbar.thread]] .Doing heavy work image::img/progressbar-thread.png[width=40%, scaledwidth=70%] endif::web[] [[components.progressbar.css]] == CSS Style Rules [source, css] ---- .v-progressbar, v-progressbar-indeterminate {} .v-progressbar-wrapper {} .v-progressbar-indicator {} ---- The progress bar has a [literal]#++v-progressbar++# base style. The progress is an element with [literal]#++v-progressbar-indicator++# style inside the wrapper, and therefore displayed on top of it. When the progress element grows, it covers more and more of the animated background. The progress bar can be animated (some themes use that). Animation is done in the element with the [literal]#v-progressbar-wrapper# style, by having an animated GIF as the background image. In the indeterminate mode, the top element also has the [literal]#++v-progressbar-indeterminate++# style. The built-in themes simply display the animated GIF in the top element and have the inner elements disabled.