code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
private void load(final String key, final String value, final String location) {
// Recursive bit
if (INCLUDE.equals(key)) {
load(parseStringArray(value));
} else {
backing.put(key, value);
if ("yes".equals(value) || "true".equals(value)) {
booleanBacking.add(key);
} else {
booleanBacking.rem... | java |
private void load(final String[] subFiles) {
for (int i = 0; i < subFiles.length; i++) {
load(subFiles[i]);
}
} | java |
public Properties getSubProperties(final String prefix, final boolean truncate) {
String cacheKey = truncate + prefix;
Properties sub = subcontextCache.get(cacheKey);
if (sub != null) {
// make a copy so users can't change.
Properties copy = new Properties();
copy.putAll(sub);
return copy;
}
sub... | java |
@Override
public void preparePaintComponent(final Request request) {
if (!this.isInitialised()) {
// Give the repeater the list of data to display.
productRepeater.setData(fetchProductData());
// Remember that we've done the initialisation.
this.setInitialised(true);
}
} | java |
public static String unescapeToXML(final String input) {
if (Util.empty(input)) {
return input;
}
// Check if input has encoded brackets
String encoded = WebUtilities.doubleEncodeBrackets(input);
String unescaped = UNESCAPE_HTML_TO_XML.translate(encoded);
String decoded = WebUtilities.doubleDecodeBracket... | java |
@Override
public Message toMessage(final Throwable throwable) {
LOG.error("The system is currently unavailable", throwable);
return new Message(Message.ERROR_MESSAGE, InternalMessages.DEFAULT_SYSTEM_ERROR);
} | java |
public void addTargets(final List<? extends AjaxTarget> targets) {
if (targets != null) {
for (AjaxTarget target : targets) {
this.addTarget(target);
}
}
} | java |
public void addTarget(final AjaxTarget target) {
AjaxControlModel model = getOrCreateComponentModel();
if (model.targets == null) {
model.targets = new ArrayList<>();
}
model.targets.add(target);
MemoryUtil.checkSize(model.targets.size(), this.getClass().getSimpleName());
} | java |
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
List<AjaxTarget> targets = getTargets();
if (targets != null && !targets.isEmpty()) {
WComponent triggerComponent = trigger == null ? this : trigger;
// The trigger maybe in a different context
... | java |
public void setCaseSensitiveMatch(final Boolean caseInsensitive) {
FilterableBeanBoundDataModel model = getFilterableTableModel();
if (model != null) {
model.setCaseSensitiveMatch(caseInsensitive);
}
} | java |
private WDecoratedLabel buildColumnHeader(final String text, final WMenu menu) {
WDecoratedLabel label = new WDecoratedLabel(null, new WText(text), menu);
return label;
} | java |
private void buildFilterMenus() {
buildFilterSubMenu(firstNameFilterMenu, FIRST_NAME);
if (firstNameFilterMenu.getChildCount() == 0) {
firstNameFilterMenu.setVisible(false);
}
buildFilterSubMenu(lastNameFilterMenu, LAST_NAME);
if (lastNameFilterMenu.getChildCount() == 0) {
lastNameFilterMenu.setVisible... | java |
private void setUpClearAllAction() {
/* if one or fewer of the filter menus are visible then we don't need the clear all menus button */
int visibleMenus = 0;
if (firstNameFilterMenu.isVisible()) {
visibleMenus++;
}
if (lastNameFilterMenu.isVisible()) {
visibleMenus++;
}
if (dobFilterMenu.isVisible(... | java |
private void buildFilterSubMenu(final WMenu menu, final int column) {
List<?> beanList = getFilterableTableModel().getFullBeanList();
int rows = (beanList == null) ? 0 : beanList.size();
if (rows == 0) {
return;
}
final List<String> found = new ArrayList<>();
final WDecoratedLabel filterSubMenuLabel =... | java |
public void setUrl(final String url) {
String currUrl = getUrl();
if (!Objects.equals(url, currUrl)) {
getOrCreateComponentModel().url = url;
}
} | java |
public void setTargetWindow(final String targetWindow) {
String currTargWin = getTargetWindow();
if (!Objects.equals(targetWindow, currTargWin)) {
getOrCreateComponentModel().targetWindow = targetWindow;
}
} | java |
private void dumpWEnvironment() {
StringBuffer text = new StringBuffer();
Environment env = getEnvironment();
text.append("\n\nWEnvironment"
+ "\n------------");
text.append("\nAppId: ").append(env.getAppId());
text.append("\nBaseUrl: ").append(env.getBaseUrl());
text.append("\nHostFreeBaseUrl: ").ap... | java |
public static Configuration copyConfiguration(final Configuration original) {
Configuration copy = new MapConfiguration(new HashMap<String, Object>());
for (Iterator<?> i = original.getKeys(); i.hasNext();) {
String key = (String) i.next();
Object value = original.getProperty(key);
if (value instanceof L... | java |
public List<String> getFileTypes() {
List<String> fileTypes = getComponentModel().fileTypes;
if (fileTypes == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(fileTypes);
} | java |
public void setFileTypes(final String[] types) {
if (types == null) {
setFileTypes((List<String>) null);
} else {
setFileTypes(Arrays.asList(types));
}
} | java |
private void resetValidationState() {
// if User Model exists it will be returned, othewise Shared Model is returned
final FileWidgetModel componentModel = getComponentModel();
// If Shared Model is returned then both fileType and fileSize are always valid
// If User Model is returned check if any if any is fal... | java |
public InputStream getInputStream() throws IOException {
FileItemWrap wrapper = getValue();
if (wrapper != null) {
return wrapper.getInputStream();
}
return null;
} | java |
@Override
public Object getData() {
Object data = super.getData();
if (isRichTextArea() && isSanitizeOnOutput() && data != null) {
return sanitizeOutputText(data.toString());
}
return data;
} | java |
@Override
public void setData(final Object data) {
if (isRichTextArea() && data instanceof String) {
super.setData(sanitizeInputText((String) data));
} else {
super.setData(data);
}
} | java |
public static List<Diagnostic> extractDiagnostics(final List<Diagnostic> diagnostics,
final int severity) {
ArrayList<Diagnostic> extract = new ArrayList<>();
for (Diagnostic diagnostic : diagnostics) {
if (diagnostic.getSeverity() == severity) {
extract.add(diagnostic);
}
}
return extract;
} | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WCollapsible collapsible = (WCollapsible) component;
XmlStringBuilder xml = renderContext.getWriter();
WComponent content = collapsible.getContent();
boolean collapsed = collapsible.isCollapsed();
xml.appen... | java |
private void toggleReadOnly() {
allFiles.setReadOnly(!allFiles.isReadOnly());
imageFiles.setReadOnly(!imageFiles.isReadOnly());
textFiles.setReadOnly(!textFiles.isReadOnly());
pdfFiles.setReadOnly(!pdfFiles.isReadOnly());
} | java |
private void processFiles() {
StringBuffer buf = new StringBuffer();
appendFileDetails(buf, allFiles);
appendFileDetails(buf, textFiles);
appendFileDetails(buf, pdfFiles);
console.setText(buf.toString());
} | java |
private void appendFileDetails(final StringBuffer buf, final WMultiFileWidget fileWidget) {
List<FileWidgetUpload> files = fileWidget.getFiles();
if (files != null) {
for (FileWidgetUpload file : files) {
String streamedSize;
try {
InputStream in = file.getFile().getInputStream();
int size =... | java |
public String getUrl() {
ContentAccess content = getContentAccess();
String mode = DisplayMode.PROMPT_TO_SAVE.equals(getDisplayMode()) ? "attach" : "inline";
// Check for a "static" resource
if (content instanceof InternalResource) {
String url = ((InternalResource) content).getTargetUrl();
// This magi... | java |
private void applySettings() {
container.reset();
WList list = new WList((com.github.bordertech.wcomponents.WList.Type) ddType.getSelected());
List<String> selected = (List<String>) cgBeanFields.getSelected();
SimpleListRenderer renderer = new SimpleListRenderer(selected, cbRenderUsingFieldLayout.
isSelect... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WNumberField field = (WNumberField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = field.isReadOnly();
BigDecimal value = field.getValue();
String userText = field.getText()... | java |
@Override
public void write(final int c) {
WhiteSpaceFilterStateMachine.StateChange change = stateMachine.nextState((char) c);
if (change.getOutputBytes() != null) {
for (int i = 0; i < change.getOutputBytes().length; i++) {
super.write(change.getOutputBytes()[i]);
}
}
if (!change.isSuppressCurrent... | java |
@Override
public void write(final String string, final int off, final int len) {
for (int i = off; i < off + len; i++) {
write(string.charAt(i));
}
} | java |
@Override
protected boolean execute(final Request request) {
for (Condition condition : conditions) {
if (condition.isTrue(request)) {
return true;
}
}
return false;
} | java |
public R fetch(String properties) {
((TQRootBean) _root).query().fetch(_name, properties);
return _root;
} | java |
public R fetchQuery(String properties) {
((TQRootBean) _root).query().fetchQuery(_name, properties);
return _root;
} | java |
protected R fetchProperties(TQProperty<?>... props) {
((TQRootBean) _root).query().fetch(_name, properties(props));
return _root;
} | java |
protected String properties(TQProperty<?>... props) {
StringBuilder selectProps = new StringBuilder(50);
for (int i = 0; i < props.length; i++) {
if (i > 0) {
selectProps.append(",");
}
selectProps.append(props[i].propertyName());
}
return selectProps.toString();
} | java |
public R filterMany(ExpressionList<T> filter) {
@SuppressWarnings("unchecked")
ExpressionList<T> expressionList = (ExpressionList<T>) expr().filterMany(_name);
expressionList.addAll(filter);
return _root;
} | java |
public List<Event> getApp(int appId, LocalDate dateFrom, LocalDate dateTo,
ReferenceType... types) {
return getCalendar("app/" + appId, dateFrom, dateTo, null, types);
} | java |
public List<Event> getSpace(int spaceId, LocalDate dateFrom,
LocalDate dateTo, ReferenceType... types) {
return getCalendar("space/" + spaceId, dateFrom, dateTo, null, types);
} | java |
public List<Event> getGlobal(LocalDate dateFrom, LocalDate dateTo,
List<Integer> spaceIds, ReferenceType... types) {
return getCalendar("", dateFrom, dateTo, spaceIds, types);
} | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WPasswordField field = (WPasswordField) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = field.isReadOnly();
xml.appendTagOpen(TAG_NAME);
xml.appendAttribute("id", component.... | java |
@Override
public void handleRequest(final Request request) {
if (!isInitialised()) {
getOrCreateComponentModel().delegate = new SafetyContainerDelegate(UIContextHolder.
getCurrent());
setInitialised(true);
}
try {
UIContext delegate = getComponentModel().delegate;
UIContextHolder.pushContext(de... | java |
public void resetContent() {
for (int i = 0; i < shim.getChildCount(); i++) {
WComponent child = shim.getChildAt(i);
child.reset();
}
removeAttribute(SafetyContainer.ERROR_KEY);
} | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WRadioButton button = (WRadioButton) component;
XmlStringBuilder xml = renderContext.getWriter();
boolean readOnly = button.isReadOnly();
String value = button.getValue();
xml.appendTagOpen("ui:radiobutton... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTabGroup group = (WTabGroup) component;
paintChildren(group, renderContext);
} | java |
private String getApplicationTitle(final UIContext uic) {
WComponent root = uic.getUI();
String title = root instanceof WApplication ? ((WApplication) root).getTitle() : null;
Map<String, String> params = uic.getEnvironment().getHiddenParameters();
String target = params.get(WWindow.WWINDOW_REQUEST_PARAM_KEY);... | java |
private String getFilterValues(final TableDataModel dataModel, final int rowIndex) {
List<String> filterValues = dataModel.getFilterValues(rowIndex);
if (filterValues == null || filterValues.isEmpty()) {
return null;
}
StringBuffer buf = new StringBuffer(filterValues.get(0));
for (int i = 1; i < filterV... | java |
public static Renderer getRenderer(final WComponent component, final RenderContext context) {
Class<? extends WComponent> clazz = component.getClass();
Duplet<String, Class<?>> key = new Duplet<String, Class<?>>(context.getRenderPackage(),
clazz);
Renderer renderer = INSTANCE.renderers.get(key);
if (rende... | java |
@Deprecated
public static Renderer getTemplateRenderer(final RenderContext context) {
String packageName = context.getRenderPackage();
Renderer renderer = INSTANCE.templateRenderers.get(packageName);
if (renderer == null) {
renderer = INSTANCE.findTemplateRenderer(packageName);
} else if (renderer == NULL_... | java |
@Deprecated
private synchronized Renderer findTemplateRenderer(final String packageName) {
RendererFactory factory = INSTANCE.findRendererFactory(packageName);
Renderer renderer = factory.getTemplateRenderer();
if (renderer == null) {
templateRenderers.put(packageName, NULL_RENDERER);
} else {
templateR... | java |
@Deprecated
public static Renderer getDefaultRenderer(final WComponent component) {
LOG.warn("The getDefaultRenderer() method is deprecated. Do not obtain renderers directly.");
return getRenderer(component, new WebXmlRenderContext(new PrintWriter(new NullWriter())));
} | java |
private synchronized Renderer findRenderer(final WComponent component,
final Duplet<String, Class<?>> key) {
LOG.info("Looking for layout for " + key.getSecond().getName() + " in " + key.getFirst());
Renderer renderer = findConfiguredRenderer(component, key.getFirst());
if (renderer == null) {
renderers.p... | java |
private synchronized RendererFactory findRendererFactory(final String packageName) {
RendererFactory factory = factoriesByPackage.get(packageName);
if (factory == null) {
try {
factory = (RendererFactory) Class.forName(packageName + ".RendererFactoryImpl").
newInstance();
factoriesByPackage.put(pa... | java |
private Renderer findConfiguredRenderer(final WComponent component, final String rendererPackage) {
Renderer renderer = null;
// We loop for each WComponent in the class hierarchy, as the
// Renderer may have been specified at a higher level.
for (Class<?> c = component.getClass(); renderer == null && c != nul... | java |
private static Renderer createRenderer(final String rendererName) {
if (rendererName.endsWith(".vm")) {
// This is a velocity template, so use a VelocityLayout
return new VelocityRenderer(rendererName);
}
try {
Class<?> managerClass = Class.forName(rendererName);
Object manager = managerClass.newInst... | java |
private void fakeServiceCall() {
poller.enablePoll();
Cache.getCache().invalidate(DATA_KEY);
new Thread() {
@Override
public void run() {
try {
Thread.sleep(SERVICE_TIME);
Cache.getCache().put(DATA_KEY, "SUCCESS!");
} catch (InterruptedException e) {
LOG.error("Timed out calling serv... | java |
public void analyseWC(final WComponent comp) {
if (comp == null) {
return;
}
statsByWCTree.put(comp, createWCTreeStats(comp));
} | java |
private void addStats(final Map<WComponent, Stat> statsMap, final WComponent comp) {
Stat stat = createStat(comp);
statsMap.put(comp, stat);
if (comp instanceof Container) {
Container container = (Container) comp;
int childCount = container.getChildCount();
for (int i = 0; i < childCount; i++) {
WC... | java |
private Stat createStat(final WComponent comp) {
Stat stat = new Stat();
stat.setClassName(comp.getClass().getName());
stat.setName(comp.getId());
if (stat.getName() == null) {
stat.setName("Unknown");
}
if (comp instanceof AbstractWComponent) {
Object obj = AbstractWComponent.replaceWComponent((Ab... | java |
private int getSerializationSize(final Object obj) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
oos.close();
byte[] bytes = bos.toByteArray();
return bytes.length;
} catch (IOException ex) {
// Unab... | java |
private WDataTable createTable() {
WDataTable tbl = new WDataTable();
tbl.addColumn(new WTableColumn("First name", new WTextField()));
tbl.addColumn(new WTableColumn("Last name", new WTextField()));
tbl.addColumn(new WTableColumn("DOB", new WDateField()));
return tbl;
} | java |
@Override
protected void preparePaintComponent(final Request request) {
if (!isInitialised()) {
MyData data = new MyData("Homer");
basic.setData(data);
List<MyData> dataList = new ArrayList<>();
dataList.add(new MyData("Homer"));
dataList.add(new MyData("Marge"));
dataList.add(new MyData("Bart"));... | java |
private int getSize(final String fieldType, final Object fieldValue) {
Integer fieldSize = SIMPLE_SIZES.get(fieldType);
if (fieldSize != null) {
if (PRIMITIVE_TYPES.contains(fieldType)) {
return fieldSize;
}
return OBJREF_SIZE + fieldSize;
} else if (fieldValue instanceof String) {
return (OBJRE... | java |
private void toFlatSummary(final String indent, final StringBuffer buffer) {
buffer.append(indent);
ObjectGraphNode root = (ObjectGraphNode) getRoot();
double pct = 100.0 * getSize() / root.getSize();
buffer.append(getSize()).append(" (");
buffer.append(new DecimalFormat("0.0").format(pct));
buffer.append... | java |
private void toXml(final String indent, final StringBuffer xml) {
String primitiveString = formatSimpleValue();
xml.append(indent);
xml.append(isPrimitive() ? "<primitive" : "<object");
if (refNode == null) {
xml.append(" id=\"").append(id).append('"');
if (fieldName != null) {
xml.append(" field=\... | java |
private void addClientOnlyExamples() {
// client command button
add(new WHeading(HeadingLevel.H2, "Client command buttons"));
add(new ExplanatoryText("These examples show buttons which do not submit the form"));
//client command buttons witho a command
WButton nothingButton = new WButton("Do nothing");
ad... | java |
private void addDefaultSubmitButtonExample() {
add(new WHeading(HeadingLevel.H3, "Default submit button"));
add(new ExplanatoryText(
"This example shows how to use an image as the only content of a WButton. "
+ "In addition this text field submits the entire screen using the image button to the right of th... | java |
private void addDisabledExamples() {
add(new WHeading(HeadingLevel.H2, "Examples of disabled buttons"));
WPanel disabledButtonLayoutPanel = new WPanel(WPanel.Type.BOX);
disabledButtonLayoutPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 6, 0,
FlowLayout.ContentAlignment.BASELINE));
add(disabledButtonLayout... | java |
private void addAntiPatternExamples() {
add(new WHeading(HeadingLevel.H2, "WButton anti-pattern examples"));
add(new WMessageBox(WMessageBox.WARN,
"These examples are purposely bad and should not be used as samples of how to use WComponents but samples of how NOT to use them."));
add(new WHeading(HeadingLeve... | java |
@Override
public void handleRequest(final Request request) {
if (plainBtn.isPressed()) {
WMessages.getInstance(this).info("Plain button pressed.");
}
if (linkBtn.isPressed()) {
WMessages.getInstance(this).info("Link button pressed.");
}
} | java |
public static boolean containsOption(final List<?> options, final Object findOption) {
if (options != null) {
for (Object option : options) {
if (option instanceof OptionGroup) {
List<?> groupOptions = ((OptionGroup) option).getOptions();
if (groupOptions != null) {
for (Object nestedOption : g... | java |
public static Object getFirstOption(final List<?> options) {
if (options != null) {
for (Object option : options) {
if (option instanceof OptionGroup) {
List<?> groupOptions = ((OptionGroup) option).getOptions();
if (groupOptions != null && !groupOptions.isEmpty()) {
return groupOptions.get(0);... | java |
@Deprecated
private static boolean isLegacyMatch(final Object option, final Object data) {
// Support legacy matching, which supported setSelected using String representations...
String optionAsString = String.valueOf(option);
String matchAsString = String.valueOf(data);
boolean equal = Util.equals(optionAsStr... | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WTemplate template = (WTemplate) component;
// Setup the context
Map<String, Object> context = new HashMap<>();
// Make the component available under the "wc" key.
context.put("wc", template);
// Load the... | java |
@Override
public void updateComponent(final Object data) {
MyData myData = (MyData) data;
name.setText("<B>" + myData.getName() + "</B>");
count.setText(String.valueOf(myData.getCount()));
} | java |
@Override
public void paint(final RenderContext renderContext) {
if (!doTransform) {
super.paint(renderContext);
return;
}
if (!(renderContext instanceof WebXmlRenderContext)) {
LOG.warn("Unable to transform a " + renderContext);
super.paint(renderContext);
return;
}
LOG.debug("Transform XML... | java |
private void transform(final String xml, final UIContext uic, final PrintWriter writer) {
Transformer transformer = newTransformer();
Source inputXml;
try {
inputXml = new StreamSource(new ByteArrayInputStream(xml.getBytes("utf-8")));
StreamResult result = new StreamResult(writer);
if (debugRequested) {... | java |
private static Templates initTemplates() {
try {
URL xsltURL = ThemeUtil.class.getResource(RESOURCE_NAME);
if (xsltURL != null) {
Source xsltSource = new StreamSource(xsltURL.openStream(), xsltURL.toExternalForm());
TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl();
Templates te... | java |
private static String removeCorruptCharacters(final String input) {
if (Util.empty(input)) {
return input;
}
return ESCAPE_BAD_XML10.translate(input);
} | java |
public int create(Reference object, HookCreate create) {
return getResourceFactory()
.getApiResource(
"/hook/" + object.getType() + "/" + object.getId()
+ "/")
.entity(create, MediaType.APPLICATION_JSON)
.post(HookCreateResponse.class).getId();
} | java |
public List<Hook> get(Reference object) {
return getResourceFactory().getApiResource(
"/hook/" + object.getType() + "/" + object.getId() + "/").get(
new GenericType<List<Hook>>() {
});
} | java |
public void requestVerification(int id) {
getResourceFactory().getApiResource("/hook/" + id + "/verify/request")
.entity(new Empty(), MediaType.APPLICATION_JSON_TYPE).post();
} | java |
public void validateVerification(int id, String code) {
getResourceFactory().getApiResource("/hook/" + id + "/verify/validate")
.entity(new HookValidate(code), MediaType.APPLICATION_JSON)
.post();
} | java |
@Override
public void handleRequest(final Request request) {
// Protect against client-side tampering of disabled/read-only fields.
if (isDisabled() || isReadOnly()) {
return;
}
RadioButtonGroup currentGroup = getGroup();
// Check if the group is not on the request (do nothing)
if (!currentGroup.isPre... | java |
public void setSelected(final boolean selected) {
if (selected) {
if (isDisabled()) {
throw new IllegalStateException("Cannot select a disabled radio button");
}
getGroup().setSelectedValue(getValue());
} else if (isSelected()) {
// Clear selection
getGroup().setData(null);
}
} | java |
public ApplicationResource addJsUrl(final String url) {
if (Util.empty(url)) {
throw new IllegalArgumentException("A URL must be provided.");
}
ApplicationResource res = new ApplicationResource(url);
addJsResource(res);
return res;
} | java |
public ApplicationResource addJsFile(final String fileName) {
if (Util.empty(fileName)) {
throw new IllegalArgumentException("A file name must be provided.");
}
InternalResource resource = new InternalResource(fileName, fileName);
ApplicationResource res = new ApplicationResource(resource);
addJsResource(r... | java |
public void addJsResource(final ApplicationResource resource) {
WApplicationModel model = getOrCreateComponentModel();
if (model.jsResources == null) {
model.jsResources = new ArrayList<>();
} else if (model.jsResources.contains(resource)) {
return;
}
model.jsResources.add(resource);
MemoryUtil.checkS... | java |
public void removeJsResource(final ApplicationResource resource) {
WApplicationModel model = getOrCreateComponentModel();
if (model.jsResources != null) {
model.jsResources.remove(resource);
}
} | java |
public ApplicationResource addCssUrl(final String url) {
if (Util.empty(url)) {
throw new IllegalArgumentException("A URL must be provided.");
}
ApplicationResource res = new ApplicationResource(url);
addCssResource(res);
return res;
} | java |
public ApplicationResource addCssFile(final String fileName) {
if (Util.empty(fileName)) {
throw new IllegalArgumentException("A file name must be provided.");
}
InternalResource resource = new InternalResource(fileName, fileName);
ApplicationResource res = new ApplicationResource(resource);
addCssResource... | java |
public void addCssResource(final ApplicationResource resource) {
WApplicationModel model = getOrCreateComponentModel();
if (model.cssResources == null) {
model.cssResources = new ArrayList<>();
} else if (model.cssResources.contains(resource)) {
return;
}
model.cssResources.add(resource);
MemoryUtil.c... | java |
public void removeCssResource(final ApplicationResource resource) {
WApplicationModel model = getOrCreateComponentModel();
if (model.cssResources != null) {
model.cssResources.remove(resource);
}
} | java |
@Override
protected void validateComponent(final List<Diagnostic> diags) {
// Mandatory validation
if (isMandatory() && isEmpty()) {
diags.add(createMandatoryDiagnostic());
}
// Other validations
List<FieldValidator> validators = getComponentModel().validators;
if (validators != null) {
for (FieldV... | java |
protected void setChangedInLastRequest(final boolean changed) {
if (isChangedInLastRequest() != changed) {
InputModel model = getOrCreateComponentModel();
model.changedInLastRequest = changed;
}
} | java |
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WHiddenComment hiddenComponent = (WHiddenComment) component;
XmlStringBuilder xml = renderContext.getWriter();
String hiddenText = hiddenComponent.getText();
if (!Util.empty(hiddenText)) {
xml.appendTag("... | java |
public void setComparator(final int col, final Comparator comparator) {
synchronized (this) {
if (comparators == null) {
comparators = new HashMap<>();
}
}
if (comparator == null) {
comparators.remove(col);
} else {
comparators.put(col, comparator);
}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.