| Chunk |
|---|
| Conflicting content |
|---|
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
<<<<<<< HEAD
import org.nuxeo.theme.html.ui.Resources;
=======
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuxeo.theme.Manager;
import org.nuxeo.theme.resources.ResourceManager;
import org.nuxeo.theme.resources.ResourceType;
import org.nuxeo.theme.types.TypeRegistry;
import org.nuxeo.theme.types.TypeFamily;
>>>>>>> a80ea93ee61abd805f33afccf60f03d5b092f9d2
public class UIResources extends UIOutput {
|
| Solution content |
|---|
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuxeo.theme.html.ui.Resources;
public class UIResources extends UIOutput {
|
| File |
|---|
| UIResources.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
@Override
public void encodeAll(final FacesContext context) throws IOException {
final ResponseWriter writer = context.getResponseWriter();
<<<<<<< HEAD
=======
final String resourcePath = "/nuxeo/nxthemes-lib/";
final TypeRegistry typeRegistry = Manager.getTypeRegistry();
>>>>>>> a80ea93ee61abd805f33afccf60f03d5b092f9d2
Map |
| Solution content |
|---|
@Override
public void encodeAll(final FacesContext context) throws IOException {
final ResponseWriter writer = context.getResponseWriter();
Map |
| File |
|---|
| UIResources.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
<<<<<<< HEAD
}
params.put("themeUrl", themeUrl.toString());
writer.write(Resources.render(params));
=======
combinedScripts.append("?path=").append(path);
// styles
if (hasStyles) {
writer.startElement("link", this);
params.put("path", context.getExternalContext().getRequestContextPath());
combinedStyles.deleteCharAt(combinedStyles.length() - 1);
combinedScripts.deleteCharAt(combinedScripts.length() - 1);
combinedStyles.append("?path=").append(path);
writer.writeAttribute("type", "text/javascript", null);
writer.writeAttribute("src", url, null);
writer.endElement("script");
}
}
final String path = context.getExternalContext().getRequestContextPath();
final ResourceManager resourceManager = Manager.getResourceManager();
final StringBuilder combinedStyles = new StringBuilder();
final StringBuilder combinedScripts = new StringBuilder();
combinedStyles.append(resourcePath);
combinedScripts.append(resourcePath);
boolean hasScripts = false;
boolean hasStyles = false;
for (String resourceName : resourceManager.getResourcesFor(themeUrl)) {
ResourceType resource = (ResourceType) typeRegistry.lookup(
TypeFamily.RESOURCE, resourceName);
if (resource == null) {
log.error(String.format("Resource '%s' not registered.",resourceName));
continue;
}
String url = resource.getUrl();
if (resourceName.endsWith(".css")) {
if (url == null) {
combinedStyles.append(resourceName).append(",");
hasStyles = true;
} else {
writer.startElement("link", this);
writer.writeAttribute("type", "text/css", null);
writer.writeAttribute("rel", "stylesheet", null);
writer.writeAttribute("media", "all", null);
writer.writeAttribute("href", url, null);
writer.endElement("link");
}
} else if (resourceName.endsWith(".js")) {
if (url == null) {
combinedScripts.append(resourceName).append(",");
hasScripts = true;
} else {
writer.startElement("script", this);
writer.writeAttribute("type", "text/css", null);
writer.writeAttribute("rel", "stylesheet", null);
writer.writeAttribute("media", "all", null);
writer.writeAttribute("href", combinedStyles.toString(), null);
writer.endElement("link");
}
// scripts
if (hasScripts) {
writer.startElement("script", this);
writer.writeAttribute("type", "text/javascript", null);
writer.writeAttribute("src", combinedScripts.toString(), null);
writer.endElement("script");
}
>>>>>>> a80ea93ee61abd805f33afccf60f03d5b092f9d2
}
} |
| Solution content |
|---|
}
}
params.put("themeUrl", themeUrl.toString());
params.put("path", context.getExternalContext().getRequestContextPath());
writer.write(Resources.render(params)); |
| File |
|---|
| UIResources.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Comment |
| For statement |
| If statement |
| Method invocation |
| Variable |