Skip to content

Commit

Permalink
Merge pull request #19 from ceari/feature/travis-ci-support
Browse files Browse the repository at this point in the history
Travis CI support & enabled JSLint tests
  • Loading branch information
bentolor committed Jul 17, 2013
2 parents d30dcaa + 665e98c commit da951d9
Show file tree
Hide file tree
Showing 40 changed files with 4,140 additions and 4,092 deletions.
1 change: 1 addition & 0 deletions .travis.yml
@@ -0,0 +1 @@
language: java
24 changes: 18 additions & 6 deletions echolot-webcontainer/build.xml
Expand Up @@ -66,16 +66,28 @@
</copy>
</target>

<target name="test" depends="jslint">

</target>

<target name="jslint" description="Verifies jslint doesn't complain.">
<taskdef name="jslint"
classname="com.googlecode.jslint4java.ant.JSLintTask"
classpath="${dir.lib}/test/jslint4java-1.4.2.jar" />

<jslint encoding="UTF-8" options="laxbreak">
<formatter type="plain"/>
<formatter type="junit" destfile="${dir.build}/test-reports" />
<fileset dir="${dir.src.res}/js" includes="**/*.js"/>
</jslint>

<!-- TODO: fix excluded JavaScript sources instead of ignoring them -->

<jslint encoding="UTF-8" options="laxbreak,evil,forin,browser">
<formatter type="plain"/>
<formatter type="junit" destfile="${dir.build}/test-reports" />
<fileset dir="${dir.src.res}/js" includes="**/*.js" excludes="**/jquery*.js raphael/*.js **/flexigrid*.js **/datepicker*.js"/>
</jslint>

<jslint encoding="UTF-8" options="laxbreak,evil,forin,browser">
<formatter type="plain"/>
<formatter type="junit" destfile="${dir.build}/test-reports" />
<fileset dir="${basedir}/src/test/web/testscreen" includes="**/*.js" excludes="OverviewContent.js SuggestFieldTest.js TestButton.js TestComponentListColumn.js"/>
</jslint>
</target>

</project>
38 changes: 19 additions & 19 deletions echolot-webcontainer/src/main/resources/js/ComponentsCommon.js
Expand Up @@ -11,45 +11,45 @@
*/
exxcellent =
{
/**
* Maintains a unique id for the exxcellent namespace.
*
* @type Number
*/
uniqueId: 20090526
/**
* Maintains a unique id for the exxcellent namespace.
*
* @type Number
*/
uniqueId: 20090526
};

/**
* The exxcellent namespace contains all components and rendering peers.
*/
exxcellent.model =
{
/**
* Maintains a unique id for the exxcellent model namespace.
*
* @type Number
*/
uniqueId: 20090609
/**
* Maintains a unique id for the exxcellent model namespace.
*
* @type Number
*/
uniqueId: 20090609
};

/**
* The exxcellent namespace contains all components and rendering peers.
*/
exxcellent.config =
{
/**
* Maintains a unique id for the exxcellent config namespace.
*
* @type Number
*/
uniqueId: 20090610
/**
* Maintains a unique id for the exxcellent config namespace.
*
* @type Number
*/
uniqueId: 20090610
};

/**
* The Contrib namespace contains all components from the echo3 contribution forum.
*/
Contrib = {
uniqueId: 20090525
uniqueId: 20090525
};


30 changes: 15 additions & 15 deletions echolot-webcontainer/src/main/resources/js/ContainerComponent.js
@@ -1,13 +1,13 @@
/**
* Here's another trivial free client-side component. This one allows you to create a button with
* Here's another trivial free client-side component. This one allows you to create a button with
* rollover effects that contains children. License for this component is public domain (use it however you like).
* @see http://echo.nextapp.com/site/node/5146
*/
Contrib.ContainerButton = Core.extend(Echo.Component, {

componentType: "Contrib.ContainerButton",

doAction: function() {
doAction: function () {
this.fireEvent({ type: "action", source: this, actionCommand: this.render("actionCommand") });
}
});
Expand All @@ -17,30 +17,30 @@ Contrib.ContainerButton = Core.extend(Echo.Component, {
*/
Contrib.ContainerButtonSync = Core.extend(Echo.Render.ComponentSync, {

$load: function() {
$load: function () {
Echo.Render.registerPeer("Contrib.ContainerButton", this);
},

_div: null,
_processRolloverEnter: function(e) {

_processRolloverEnter: function (e) {
var backgroundImage = Echo.Sync.getEffectProperty(this.component, "backgroundImage", "rolloverBackgroundImage", true);
Echo.Sync.FillImage.renderClear(backgroundImage, this._div);
Echo.Sync.Color.renderClear(this.component.render("rolloverForeground"), this._div, "color");
Echo.Sync.Color.renderClear(this.component.render("rolloverBackground"), this._div, "backgroundColor");
},
_processRolloverExit: function(e) {

_processRolloverExit: function (e) {
Echo.Sync.FillImage.renderClear(this.component.render("backgroundImage"), this._div);
Echo.Sync.Color.renderClear(this.component.render("foreground"), this._div, "color");
Echo.Sync.Color.renderClear(this.component.render("background"), this._div, "backgroundColor");
},
_processClick: function(e) {

_processClick: function (e) {
this.component.doAction();
},

renderAdd: function(update, parentElement) {
renderAdd: function (update, parentElement) {
this._div = document.createElement("div");
this._div.style.cssText = "cursor: pointer;";
Echo.Sync.Insets.render(this.component.render("insets"), this._div, "padding");
Expand All @@ -51,25 +51,25 @@ Contrib.ContainerButtonSync = Core.extend(Echo.Render.ComponentSync, {

if (this.component.children.length == 1) {
Echo.Render.renderComponentAdd(update, this.component.children[0], this._div);
} else if (this.component.children.length != 0) {
} else if (this.component.children.length !== 0) {
throw new Error("Too many children in ContainerButton (max is 1).");
}

Core.Web.Event.add(this._div, "click", Core.method(this, this._processClick), false);

if (this.component.render("rolloverEnabled")) {
Core.Web.Event.add(this._div, "mouseover", Core.method(this, this._processRolloverEnter), false);
Core.Web.Event.add(this._div, "mouseout", Core.method(this, this._processRolloverExit), false);
}
parentElement.appendChild(this._div);
},

renderDispose: function(update) {
renderDispose: function (update) {
Core.Web.Event.removeAll(this._div);
this._div = null;
},
renderUpdate: function(update) {

renderUpdate: function (update) {
var element = this._div;
var containerElement = element.parentNode;
this.renderDispose(update);
Expand Down
75 changes: 39 additions & 36 deletions echolot-webcontainer/src/main/resources/js/ScrollPane.js
@@ -1,10 +1,10 @@
Contrib.ScrollPane = Core.extend(Echo.Component, {

$load: function() {
$load: function () {
Echo.ComponentFactory.registerType("Contrib.ScrollPane", this);
},

componentType: "Contrib.ScrollPane",
componentType: "Contrib.ScrollPane",

cellElementNodeName: "div",
prevFocusKey: 38,
Expand All @@ -16,14 +16,15 @@ Contrib.ScrollPane = Core.extend(Echo.Component, {

Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {

$load: function() {
$load: function () {
Echo.Render.registerPeer("Contrib.ScrollPane", this);
},

$abstract: {
cellElementNodeName: true,

renderChildLayoutData: function(child, cellElement) { }
renderChildLayoutData: function (child, cellElement) {
}
},

element: null,
Expand All @@ -32,40 +33,41 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
cellSpacing: null,
_childIdToElementMap: null,

processKeyPress: function(e) {
processKeyPress: function (e) {
switch (e.keyCode) {
case this.prevFocusKey:
case this.nextFocusKey:
var focusPrevious = e.keyCode == this.prevFocusKey;
var focusedComponent = this.component.application.getFocusedComponent();
if (focusedComponent && focusedComponent.peer && focusedComponent.peer.getFocusFlags) {
var focusFlags = focusedComponent.peer.getFocusFlags();
if ((focusPrevious && focusFlags & this.prevFocusFlag) || (!focusPrevious && focusFlags & this.nextFocusFlag)) {
var focusChild = this.component.application.focusManager.findInParent(this.component, focusPrevious);
if (focusChild) {
this.component.application.setFocusedComponent(focusChild);
Core.Web.DOM.preventEventDefault(e);
return false;
case this.prevFocusKey:
case this.nextFocusKey:
var focusPrevious = e.keyCode == this.prevFocusKey;
var focusedComponent = this.component.application.getFocusedComponent();
if (focusedComponent && focusedComponent.peer && focusedComponent.peer.getFocusFlags) {
var focusFlags = focusedComponent.peer.getFocusFlags();
if ((focusPrevious && focusFlags & this.prevFocusFlag) || (!focusPrevious && focusFlags & this.nextFocusFlag)) {
var focusChild = this.component.application.focusManager.findInParent(this.component, focusPrevious);
if (focusChild) {
this.component.application.setFocusedComponent(focusChild);
Core.Web.DOM.preventEventDefault(e);
return false;
}
}
}
}
break;
break;
}
return true;
},

renderAdd: function(update, parentElement) {
renderAdd: function (update, parentElement) {


this.element = this.containerElement = document.createElement("div");
this.element.id = "scrollPane" + this.component.renderId;
this.element.style.overflow = "auto";
this.element.style.outlineStyle = "none";
this.element.tabIndex = "-1";
var layoutData = this.component.render("layoutData");
if(layoutData) {
if(layoutData.height)
this.element.style.height = Echo.Sync.Extent.toPixels(layoutData.height, false) + "px";
var layoutData = this.component.render("layoutData");
if (layoutData) {
if (layoutData.height) {
this.element.style.height = Echo.Sync.Extent.toPixels(layoutData.height, false) + "px";
}
Echo.Sync.Insets.render(layoutData.insets, parentElement, "padding");
}

Expand All @@ -87,7 +89,7 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
parentElement.appendChild(this.element);
},

renderChildLayoutData: function(child, cellElement) {
renderChildLayoutData: function (child, cellElement) {
var layoutData = child.render("layoutData");
if (layoutData) {
Echo.Sync.Color.render(layoutData.background, cellElement, "backgroundColor");
Expand All @@ -100,14 +102,14 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
}
},

renderAddChild: function(update, child, index) {
renderAddChild: function (update, child, index) {
var cellElement = document.createElement(this.cellElementNodeName);
this._childIdToElementMap[child.renderId] = cellElement;
Echo.Render.renderComponentAdd(update, child, cellElement);

this.renderChildLayoutData(child, cellElement);

if (index != null) {
if (index !== null) {
var currentChildCount;
if (this.containerElement.childNodes.length >= 3 && this.cellSpacing) {
currentChildCount = (this.containerElement.childNodes.length + 1) / 2;
Expand All @@ -118,7 +120,7 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
index = null;
}
}
if (index == null || !this.containerElement.firstChild) {
if (index === null || !this.containerElement.firstChild) {
// Full render, append-at-end scenario, or index 0 specified and no children rendered.

// Render spacing cell first if index != 0 and cell spacing enabled.
Expand All @@ -143,7 +145,7 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
}
},

renderAddChildren: function(update) {
renderAddChildren: function (update) {
this._childIdToElementMap = {};

var componentCount = this.component.getComponentCount();
Expand All @@ -153,19 +155,19 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
}

Core.Web.Event.add(this.element,
Core.Web.Env.QUIRK_IE_KEY_DOWN_EVENT_REPEAT ? "keydown" : "keypress",
Core.method(this, this.processKeyPress), false);
Core.Web.Env.QUIRK_IE_KEY_DOWN_EVENT_REPEAT ? "keydown" : "keypress",
Core.method(this, this.processKeyPress), false);
},

renderDispose: function(update) {
renderDispose: function (update) {
Core.Web.Event.removeAll(this.element);
this.element = null;
this.containerElement = null;
this._childIdToElementMap = null;
this.spacingPrototype = null;
},

renderRemoveChild: function(update, child) {
renderRemoveChild: function (update, child) {
var childElement = this._childIdToElementMap[child.renderId];
if (!childElement) {
return;
Expand All @@ -186,23 +188,24 @@ Contrib.ScrollPane.Peer = Core.extend(Echo.Render.ComponentSync, {
delete this._childIdToElementMap[child.renderId];
},

renderUpdate: function(update) {
renderUpdate: function (update) {
var fullRender = false;
if (update.hasUpdatedProperties() || update.hasUpdatedLayoutDataChildren()) {
// Full render
fullRender = true;
} else {
var removedChildren = update.getRemovedChildren();
var i;
if (removedChildren) {
// Remove children.
for (var i = 0; i < removedChildren.length; ++i) {
for (i = 0; i < removedChildren.length; ++i) {
this.renderRemoveChild(update, removedChildren[i]);
}
}
var addedChildren = update.getAddedChildren();
if (addedChildren) {
// Add children.
for (var i = 0; i < addedChildren.length; ++i) {
for (i = 0; i < addedChildren.length; ++i) {
this.renderAddChild(update, addedChildren[i], this.component.indexOf(addedChildren[i]));
}
}
Expand Down

0 comments on commit da951d9

Please sign in to comment.