Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase performance of b:tree control #708

Merged
merged 2 commits into from
Apr 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 58 additions & 50 deletions src/main/java/net/bootsfaces/component/tree/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
*
* 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.
* 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.tree;

Expand All @@ -32,53 +32,61 @@
import net.bootsfaces.render.IResponsive;
import net.bootsfaces.utils.BsfUtils;

/** This class holds the attributes of <b:tree />. */
@ResourceDependencies({ @ResourceDependency(library = "bsf", name = "js/bootstrap-treeview.min.js", target = "body"), })
/**
* This class holds the attributes of <b:tree />.
*/
@ResourceDependencies({
@ResourceDependency(library = "bsf", name = "js/bootstrap-treeview.min.js", target = "body"),})
@FacesComponent("net.bootsfaces.component.tree.Tree")
public class Tree extends TreeCore implements ClientBehaviorHolder, IResponsive {

// Static internal references
public static final String COMPONENT_TYPE = C.BSFCOMPONENT + ".tree.Tree";
public static final String COMPONENT_FAMILY = C.BSFCOMPONENT;
public static final String DEFAULT_RENDERER = "net.bootsfaces.component.tree.Tree";
// Static internal references
public static final String COMPONENT_TYPE = C.BSFCOMPONENT + ".tree.Tree";
public static final String COMPONENT_FAMILY = C.BSFCOMPONENT;
public static final String DEFAULT_RENDERER = "net.bootsfaces.component.tree.Tree";

// Supported event list
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList("click"));
// Supported event list
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList("click"));

/**
* Constructor. It is used to configure the renderer
*/
public Tree() {
setRendererType(DEFAULT_RENDERER);
/**
* Constructor. It is used to configure the renderer
*/
public Tree() {
setRendererType(DEFAULT_RENDERER);

AddResourcesListener.addThemedCSSResource("core.css");
AddResourcesListener.addExtCSSResource("bootstrap-treeview.min.css");
//AddResourcesListener.addThemedCSSResource("bsf.css");
//!bs-less//AddResourcesListener.addThemedCSSResource("list-group.css");
}
AddResourcesListener.addThemedCSSResource("core.css");
AddResourcesListener.addExtCSSResource("bootstrap-treeview.min.css");
}

@Override
public String getFamily() {
return COMPONENT_FAMILY;
}
@Override
public String getFamily() {
return COMPONENT_FAMILY;
}

/**
* Provide support to snake-case attribute in EL-expression items
*/
@Override
public void setValueExpression(String name, ValueExpression binding) {
name = BsfUtils.snakeCaseToCamelCase(name);
super.setValueExpression(name, binding);
}
/**
* Provide support to snake-case attribute in EL-expression items
*
* @param name
* @param binding
*/
@Override
public void setValueExpression(String name, ValueExpression binding) {
name = BsfUtils.snakeCaseToCamelCase(name);
super.setValueExpression(name, binding);
}

/**
* Management of events
*/
public Collection<String> getEventNames() {
return EVENT_NAMES;
}
/**
* Management of events
*
* @return
*/
@Override
public Collection<String> getEventNames() {
return EVENT_NAMES;
}

public String getDefaultEventName() {
return "click";
}
@Override
public String getDefaultEventName() {
return "click";
}
}
48 changes: 25 additions & 23 deletions src/main/java/net/bootsfaces/component/tree/TreeBeanInfo.java
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
/**
* Copyright 2014-2017 Dario D'Urzo and Stephan Rauh
*
*
* 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.
*
* 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.tree;

import net.bootsfaces.beans.BsfBeanInfo;

/**
* BeanInfo class to provide mapping
* of snake-case attributes to camelCase ones
*
* BeanInfo class to provide mapping of snake-case attributes to camelCase ones
*
* @author durzod
*/
public class TreeBeanInfo extends BsfBeanInfo {
/**
* Get the reference decorated class
*/
@Override
public Class<?> getDecoratedClass() {
return Tree.class;
}

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