Skip to content

Commit

Permalink
#827 removed the datatable.net CSS and JavaScript files from the JAR,…
Browse files Browse the repository at this point in the history
… using the CDN instead
  • Loading branch information
stephanrauh committed Aug 19, 2017
1 parent 80a61e4 commit 290e0c1
Show file tree
Hide file tree
Showing 18 changed files with 503 additions and 1,326 deletions.
2 changes: 0 additions & 2 deletions gradleResources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from 'staticResources/css/ext/bootstrap-tree.css'
from 'staticResources/css/ext/bootstrap-treeview.min.css'

from 'staticResources/css/ext/datatables.min.css'
from 'staticResources/css/ext/animate.css'
from 'staticResources/css/ext/dropdown-submenu.css'
from 'staticResources/css/ext/sticky-footer-navbar.css'
Expand Down Expand Up @@ -70,7 +69,6 @@
from 'staticResources/js/bootstrap-notify.min.js'
from 'staticResources/js/bootstrap-datetimepicker.min.js'
from 'staticResources/js/moment-with-locales.min.js'
from 'staticResources/js/datatables.min.js'
from 'staticResources/js/fullcalendar.min.js'
from 'staticResources/js/fullcalendar-lang-all.js'
from 'staticResources/js/jquery.blockUI.js'
Expand Down
122 changes: 0 additions & 122 deletions gradleResources/staticResources/css/ext/datatables.min.css

This file was deleted.

571 changes: 0 additions & 571 deletions gradleResources/staticResources/js/datatables.min.js

This file was deleted.

36 changes: 0 additions & 36 deletions mavenResources/META-INF/resources/bsf/css/datatables.min.css

This file was deleted.

569 changes: 0 additions & 569 deletions mavenResources/META-INF/resources/bsf/js/datatables.min.js

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/net/bootsfaces/component/ComponentsEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public enum ComponentsEnum {
internalFALink("<b:internalFALink", "internalFALink", "net.bootsfaces.component.internalFALink.InternalFALink"),
internalIE8CompatibilityLink("<b:internalIE8CompatibilityLink", "internalIE8CompatibilityLink",
"net.bootsfaces.component.internalIE8CompatibilityLink.InternalIE8CompatibilityLink"),
internalJavaScriptResource("<b:internalJavaScriptResource", "internalJavaScriptResource",
"net.bootsfaces.component.internalJavaScriptResource.InternalJavaScriptResource"),
internalCssScriptResource("<b:internalCssScriptResource", "internalCssScriptResource",
"net.bootsfaces.component.internalCssScriptResource.InternalCssScriptResource"),
jumbotron("<b:jumbotron", "jumbotron", "net.bootsfaces.component.jumbotron.Jumbotron"),
kebab("<b:kebab", "kebab", "net.bootsfaces.component.kebab.Kebab"),
label("<b:label", "label", "net.bootsfaces.component.label.Label"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
import net.bootsfaces.utils.BsfUtils;

/** This class holds the attributes of &lt;b:dataTable /&gt;. */
@ResourceDependencies({ @ResourceDependency(library = "bsf", name = "js/datatables.min.js", target = "body"),
// @ResourceDependency(library = "bsf", name =
// "js/datatables-bf-extensions.js", target = "body"),
@ResourceDependency(library = "bsf", name = "css/datatables.min.css", target = "head") })
@FacesComponent(DataTable.COMPONENT_TYPE)
public class DataTable extends DataTableCore
implements IAJAXComponent, ClientBehaviorHolder, net.bootsfaces.render.IHasTooltip, IResponsive, IContentDisabled {
Expand Down Expand Up @@ -82,7 +78,8 @@ public DataTable() {
setRendererType(DEFAULT_RENDERER);
Tooltip.addResourceFiles();
AddResourcesListener.addThemedCSSResource("core.css");
//AddResourcesListener.addThemedCSSResource("bsf.css");
AddResourcesListener.addResourceIfNecessary("https://cdn.datatables.net/v/bs/jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/af-2.2.0/b-1.4.0/b-colvis-1.4.0/b-html5-1.4.0/b-print-1.4.0/cr-1.3.3/fc-3.2.2/fh-3.1.2/r-2.1.1/rr-1.2.0/sc-1.4.2/se-1.2.2/datatables.min.css");
AddResourcesListener.addResourceIfNecessary("https://cdn.datatables.net/v/bs/jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/af-2.2.0/b-1.4.0/b-colvis-1.4.0/b-html5-1.4.0/b-print-1.4.0/cr-1.3.3/fc-3.2.2/fh-3.1.2/r-2.1.1/rr-1.2.0/sc-1.4.2/se-1.2.2/datatables.min.js");
}

public void setValueExpression(String name, ValueExpression binding) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Copyright 2014-17 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
*
* This file is part of BootsFaces.
*
* 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.
*/

package net.bootsfaces.component.internalCssScriptResource;

import javax.el.ValueExpression;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.*;
import net.bootsfaces.utils.BsfUtils;

/** This class holds the attributes of &lt;b:internalCssScriptResource /&gt;. */
@FacesComponent("net.bootsfaces.component.internalCssScriptResource.InternalCssScriptResource")
public class InternalCssScriptResource extends InternalCssScriptResourceCore {

public static final String COMPONENT_TYPE = "net.bootsfaces.component.internalCssScriptResource.InternalCssScriptResource";

public static final String COMPONENT_FAMILY = "net.bootsfaces.component";

public static final String DEFAULT_RENDERER = "net.bootsfaces.component.internalCssScriptResource.InternalCssScriptResource";

public InternalCssScriptResource() {
setRendererType(DEFAULT_RENDERER);
}

public String getFamily() {
return COMPONENT_FAMILY;
}

/**
* Manage EL-expression for snake-case attributes
*/
public void setValueExpression(String name, ValueExpression binding) {
name = BsfUtils.snakeCaseToCamelCase(name);
super.setValueExpression(name, binding);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2014 - 17 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
*
* This file is part of BootsFaces.
*
* 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.
*/
package net.bootsfaces.component.internalCssScriptResource;

import net.bootsfaces.beans.BsfBeanInfo;

/**
* BeanInfo class to provide mapping
* of snake-case attributes to camelCase ones
*
* @author Dario D'Urzo
*/
public class InternalCssScriptResourceBeanInfo extends BsfBeanInfo {

/**
* Get the reference decorated class
*/
@Override
public Class<?> getDecoratedClass() {
return InternalCssScriptResource.class;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Copyright 2014 - 17 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
*
* This file is part of BootsFaces.
*
* 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.
*/

package net.bootsfaces.component.internalCssScriptResource;

import javax.faces.component.UIOutput;

/** This class holds the attributes of &lt;b:internalCssScriptResource /&gt;. */
public abstract class InternalCssScriptResourceCore extends UIOutput {

protected enum PropertyKeys {
url;
String toString;

PropertyKeys(String toString) {
this.toString = toString;
}

PropertyKeys() {
}

public String toString() {
return ((this.toString != null) ? this.toString : super.toString());
}
}

/**
* URL of the CSS file to include. <P>
* @return Returns the value of the attribute, or null, if it hasn't been set by the JSF file.
*/
public String getUrl() {
return (String) getStateHelper().eval(PropertyKeys.url);
}

/**
* URL of the CSS file to include. <P>
* Usually this method is called internally by the JSF engine.
*/
public void setUrl(String _url) {
getStateHelper().put(PropertyKeys.url, _url);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Copyright 2014 - 17 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
*
* This file is part of BootsFaces.
*
* 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.
*/

package net.bootsfaces.component.internalCssScriptResource;

import java.io.IOException;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.render.FacesRenderer;

import net.bootsfaces.render.CoreRenderer;

/** This class generates the HTML code of &lt;b:internalCssScriptResource /&gt;. */
@FacesRenderer(componentFamily = "net.bootsfaces.component", rendererType = "net.bootsfaces.component.internalCssScriptResource.InternalCssScriptResource")
public class InternalCssScriptResourceRenderer extends CoreRenderer {

/**
* This methods generates the HTML code of the current b:internalCssScriptResource.
* @param context the FacesContext.
* @param component the current b:internalCssScriptResource.
* @throws IOException thrown if something goes wrong when writing the HTML code.
*/
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
InternalCssScriptResource internalCssScriptResource = (InternalCssScriptResource) component;
ResponseWriter rw = context.getResponseWriter();

rw.startElement("link", internalCssScriptResource);
rw.writeAttribute("type", "text/css", null);
rw.writeAttribute("rel", "stylesheet", null);
rw.writeAttribute("href", internalCssScriptResource.getUrl(), null);

rw.endElement("link");

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Copyright 2014-17 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
*
* This file is part of BootsFaces.
*
* 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.
*/

package net.bootsfaces.component.internalJavaScriptResource;

import javax.el.ValueExpression;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.*;
import net.bootsfaces.utils.BsfUtils;

/** This class holds the attributes of &lt;b:internalJavaScriptResource /&gt;. */
@FacesComponent("net.bootsfaces.component.internalJavaScriptResource.InternalJavaScriptResource")
public class InternalJavaScriptResource extends InternalJavaScriptResourceCore {

public static final String COMPONENT_TYPE = "net.bootsfaces.component.internalJavaScriptResource.InternalJavaScriptResource";

public static final String COMPONENT_FAMILY = "net.bootsfaces.component";

public static final String DEFAULT_RENDERER = "net.bootsfaces.component.internalJavaScriptResource.InternalJavaScriptResource";

public InternalJavaScriptResource() {
setRendererType(DEFAULT_RENDERER);
}

public String getFamily() {
return COMPONENT_FAMILY;
}

/**
* Manage EL-expression for snake-case attributes
*/
public void setValueExpression(String name, ValueExpression binding) {
name = BsfUtils.snakeCaseToCamelCase(name);
super.setValueExpression(name, binding);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2014 - 17 by Riccardo Massera (TheCoder4.Eu) and Stephan Rauh (http://www.beyondjava.net).
*
* This file is part of BootsFaces.
*
* 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.
*/
package net.bootsfaces.component.internalJavaScriptResource;

import net.bootsfaces.beans.BsfBeanInfo;

/**
* BeanInfo class to provide mapping
* of snake-case attributes to camelCase ones
*
* @author Dario D'Urzo
*/
public class InternalJavaScriptResourceBeanInfo extends BsfBeanInfo {

/**
* Get the reference decorated class
*/
@Override
public Class<?> getDecoratedClass() {
return InternalJavaScriptResource.class;
}
}

Loading

0 comments on commit 290e0c1

Please sign in to comment.