code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public void commit() {
if (directory == null)
return;
try {
if (reader != null)
reader.close();
// it turns out that IndexWriter.optimize actually slows
// searches down, because it invalidates the cache. therefore
// not calling it any more.
// http://www.searchwor... | java |
public Record findRecordById(String id) {
if (directory == null)
init();
Property idprop = config.getIdentityProperties().iterator().next();
for (Record r : lookup(idprop, id))
if (r.getValue(idprop.getName()).equals(id))
return r;
return null; // not found
} | java |
public String clean(String value) {
String orig = value;
// check if there's a + before the first digit
boolean initialplus = findPlus(value);
// remove everything but digits
value = sub.clean(value);
if (value == null)
return null;
// check for initial '00'
boolean zero... | java |
public boolean overrides(Link other) {
if (other.getStatus() == LinkStatus.ASSERTED &&
status != LinkStatus.ASSERTED)
return false;
else if (status == LinkStatus.ASSERTED &&
other.getStatus() != LinkStatus.ASSERTED)
return true;
// the two links are from equivalent sources ... | java |
public void process() {
// are we ready to process yet, or have we had an error, and are
// waiting a bit longer in the hope that it will resolve itself?
if (error_skips > 0) {
error_skips--;
return;
}
try {
if (logger != null)
logger.debug("Starting processing");
... | java |
void reportError(Throwable throwable) {
if (logger != null)
logger.error("Timer reported error", throwable);
status = "Thread blocked on error: " + throwable;
error_skips = error_factor;
} | java |
public static String makePropertyName(String name) {
char[] buf = new char[name.length() + 3];
int pos = 0;
buf[pos++] = 's';
buf[pos++] = 'e';
buf[pos++] = 't';
for (int ix = 0; ix < name.length(); ix++) {
char ch = name.charAt(ix);
if (ix == 0)
ch = Character.toUpperCase(c... | java |
@NonNull
private List<String> mapObsoleteElements(List<String> names) {
List<String> elementsToRemove = new ArrayList<>(names.size());
for (String name : names) {
if (name.startsWith("android")) continue;
elementsToRemove.add(name);
}
return elementsToRemove;
... | java |
private void removeObsoleteElements(List<String> names,
Map<String, View> sharedElements,
List<String> elementsToRemove) {
if (elementsToRemove.size() > 0) {
names.removeAll(elementsToRemove);
for (String ele... | java |
@Override
public void onBindViewHolder(GalleryAdapter.ViewHolder holder, int position, List<Object> payloads) {
if (payloads.isEmpty()) { // If doesn't have any payload then bind the fully item
super.onBindViewHolder(holder, position, payloads);
} else {
for (Object payload :... | java |
public Slice newSlice(long address, int size)
{
if (address <= 0) {
throw new IllegalArgumentException("Invalid address: " + address);
}
if (size == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(null, address, size, 0, null);
} | java |
public Slice newSlice(long address, int size, Object reference)
{
if (address <= 0) {
throw new IllegalArgumentException("Invalid address: " + address);
}
if (reference == null) {
throw new NullPointerException("Object reference is null");
}
if (size =... | java |
public static int hash(int input)
{
int k1 = mixK1(input);
int h1 = mixH1(DEFAULT_SEED, k1);
return fmix(h1, SizeOf.SIZE_OF_INT);
} | java |
public static boolean isAscii(Slice utf8)
{
int length = utf8.length();
int offset = 0;
// Length rounded to 8 bytes
int length8 = length & 0x7FFF_FFF8;
for (; offset < length8; offset += 8) {
if ((utf8.getLongUnchecked(offset) & TOP_MASK64) != 0) {
... | java |
public static int lengthOfCodePoint(int codePoint)
{
if (codePoint < 0) {
throw new InvalidCodePointException(codePoint);
}
if (codePoint < 0x80) {
// normal ASCII
// 0xxx_xxxx
return 1;
}
if (codePoint < 0x800) {
re... | java |
public ComplexDouble divi(ComplexDouble c, ComplexDouble result) {
double d = c.r * c.r + c.i * c.i;
double newR = (r * c.r + i * c.i) / d;
double newI = (i * c.r - r * c.i) / d;
result.r = newR;
result.i = newI;
return result;
} | java |
public static int[] randomPermutation(int size) {
Random r = new Random();
int[] result = new int[size];
for (int j = 0; j < size; j++) {
result[j] = j;
}
for (int j = size - 1; j > 0; j--) {
int k = r.nextInt(j);
int temp = result[j]... | java |
public static int[] randomSubset(int k, int n) {
assert(0 < k && k <= n);
Random r = new Random();
int t = 0, m = 0;
int[] result = new int[k];
while (m < k) {
double u = r.nextDouble();
if ( (n - t) * u < k - m ) {
result[m] = t;
... | java |
public static DoubleMatrix[] fullSVD(DoubleMatrix A) {
int m = A.rows;
int n = A.columns;
DoubleMatrix U = new DoubleMatrix(m, m);
DoubleMatrix S = new DoubleMatrix(min(m, n));
DoubleMatrix V = new DoubleMatrix(n, n);
int info = NativeBlas.dgesvd('A', 'A', m, n, A.dup()... | java |
private InputStream tryPath(String path) {
Logger.getLogger().debug("Trying path \"" + path + "\".");
return getClass().getResourceAsStream(path);
} | java |
private void loadLibraryFromStream(String libname, InputStream is) {
try {
File tempfile = createTempFile(libname);
OutputStream os = new FileOutputStream(tempfile);
logger.debug("tempfile.getPath() = " + tempfile.getPath());
long savedTime = System.currentTimeMillis();
// ... | java |
public static void checkVectorAddition() {
DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0);
DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0);
DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0);
check("checking vector addition", x.add(y).equals(z));
} | java |
public static void checkXerbla() {
double[] x = new double[9];
System.out.println("Check whether we're catching XERBLA errors. If you see something like \"** On entry to DGEMM parameter number 4 had an illegal value\", it didn't work!");
try {
NativeBlas.dgemm('N', 'N', 3, -1, 3, 1... | java |
public static void checkEigenvalues() {
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.d... | java |
public static DoubleMatrix cholesky(DoubleMatrix A) {
DoubleMatrix result = A.dup();
int info = NativeBlas.dpotrf('U', A.rows, result.data, 0, A.rows);
if (info < 0) {
throw new LapackArgumentException("DPOTRF", -info);
} else if (info > 0) {
throw new LapackPositivityExcepti... | java |
public static QRDecomposition<DoubleMatrix> qr(DoubleMatrix A) {
int minmn = min(A.rows, A.columns);
DoubleMatrix result = A.dup();
DoubleMatrix tau = new DoubleMatrix(minmn);
SimpleBlas.geqrf(result, tau);
DoubleMatrix R = new DoubleMatrix(A.rows, A.columns);
for (int i = 0; i < A.rows; i++) {
... | java |
public static DoubleMatrix absi(DoubleMatrix x) {
/*# mapfct('Math.abs') #*/
//RJPP-BEGIN------------------------------------------------------------
for (int i = 0; i < x.length; i++)
x.put(i, (double) Math.abs(x.get(i)));
return x;
//RJPP-END----------------------------------------------------------... | java |
public static DoubleMatrix expm(DoubleMatrix A) {
// constants for pade approximation
final double c0 = 1.0;
final double c1 = 0.5;
final double c2 = 0.12;
final double c3 = 0.01833333333333333;
final double c4 = 0.0019927536231884053;
final double c5 = 1.63043478... | java |
public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) {
VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN;
if(geometry instanceof Point
|| geometry instanceof MultiPoint) {
result = VectorTile.Tile.GeomType.POINT;
} else if(geometry i... | java |
private static boolean equalAsInts(Vec2d a, Vec2d b) {
return ((int) a.x) == ((int) b.x) && ((int) a.y) == ((int) b.y);
} | java |
private static void validate(String name, Collection<Geometry> geometries, int extent) {
if (name == null) {
throw new IllegalArgumentException("layer name is null");
}
if (geometries == null) {
throw new IllegalArgumentException("geometry collection is null");
}
... | java |
public int addKey(String key) {
JdkUtils.requireNonNull(key);
int nextIndex = keys.size();
final Integer mapIndex = JdkUtils.putIfAbsent(keys, key, nextIndex);
return mapIndex == null ? nextIndex : mapIndex;
} | java |
private void findScrollView(ViewGroup viewGroup) {
scrollChild = viewGroup;
if (viewGroup.getChildCount() > 0) {
int count = viewGroup.getChildCount();
View child;
for (int i = 0; i < count; i++) {
child = viewGroup.getChildAt(i);
if (c... | java |
private void removeAllBroadcasts(Set<String> sessionIds) {
if (sessionIds == null) {
for (CmsSessionInfo info : OpenCms.getSessionManager().getSessionInfos()) {
OpenCms.getSessionManager().getBroadcastQueue(info.getSessionId().getStringValue()).clear();
}
ret... | java |
@UiHandler("m_atDay")
void onWeekDayChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setWeekDay(event.getValue());
}
} | java |
private void addCheckBox(final String internalValue, String labelMessageKey) {
CmsCheckBox box = new CmsCheckBox(Messages.get().key(labelMessageKey));
box.setInternalValue(internalValue);
box.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
public void onValueChange(... | java |
private void checkExactlyTheWeeksCheckBoxes(Collection<WeekOfMonth> weeksToCheck) {
for (CmsCheckBox cb : m_checkboxes) {
cb.setChecked(weeksToCheck.contains(WeekOfMonth.valueOf(cb.getInternalValue())));
}
} | java |
private void fillWeekPanel() {
addCheckBox(WeekOfMonth.FIRST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_1_0);
addCheckBox(WeekOfMonth.SECOND.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_2_0);
addCheckBox(WeekOfMonth.THIRD.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_3_0);
... | java |
public Label htmlLabel(String html) {
Label label = new Label();
label.setContentMode(ContentMode.HTML);
label.setValue(html);
return label;
} | java |
public String readSnippet(String name) {
String path = CmsStringUtil.joinPaths(
m_context.getSetupBean().getWebAppRfsPath(),
CmsSetupBean.FOLDER_SETUP,
"html",
name);
try (InputStream stream = new FileInputStream(path)) {
byte[] data = CmsFile... | java |
public static List<String> getSelectOptionValues(CmsObject cms, String rootPath, boolean allRemoved) {
try {
cms = OpenCms.initCmsObject(cms);
cms.getRequestContext().setSiteRoot("");
CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cms, rootPath);
... | java |
public void addRow(Component component) {
Component actualComponent = component == null ? m_newComponentFactory.get() : component;
I_CmsEditableGroupRow row = m_rowBuilder.buildRow(this, actualComponent);
m_container.addComponent(row);
updatePlaceholder();
updateButtonBars();
... | java |
public void addRowAfter(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index >= 0) {
Component component = m_newComponentFactory.get();
I_CmsEditableGroupRow newRow = m_rowBuilder.buildRow(this, component);
m_container.addComponent(n... | java |
public List<I_CmsEditableGroupRow> getRows() {
List<I_CmsEditableGroupRow> result = Lists.newArrayList();
for (Component component : m_container) {
if (component instanceof I_CmsEditableGroupRow) {
result.add((I_CmsEditableGroupRow)component);
}
}
... | java |
public void moveDown(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if ((index >= 0) && (index < (m_container.getComponentCount() - 1))) {
m_container.removeComponent(row);
m_container.addComponent(row, index + 1);
}
updateButtonBars... | java |
public void moveUp(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index > 0) {
m_container.removeComponent(row);
m_container.addComponent(row, index - 1);
}
updateButtonBars();
} | java |
public void remove(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index >= 0) {
m_container.removeComponent(row);
}
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | java |
public void adjustLinks(String sourceFolder, String targetFolder) throws CmsException {
String rootSourceFolder = addSiteRoot(sourceFolder);
String rootTargetFolder = addSiteRoot(targetFolder);
String siteRoot = getRequestContext().getSiteRoot();
getRequestContext().setSiteRoot("");
... | java |
public void setRGB(int red, int green, int blue) throws Exception {
CmsColor color = new CmsColor();
color.setRGB(red, green, blue);
m_red = red;
m_green = green;
m_blue = blue;
m_hue = color.getHue();
m_saturation = color.getSaturation();
m_br... | java |
protected void doSave() {
List<CmsFavoriteEntry> entries = getEntries();
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
} | java |
List<CmsFavoriteEntry> getEntries() {
List<CmsFavoriteEntry> result = new ArrayList<>();
for (I_CmsEditableGroupRow row : m_group.getRows()) {
CmsFavoriteEntry entry = ((CmsFavInfo)row).getEntry();
result.add(entry);
}
return result;
} | java |
private CmsFavInfo createFavInfo(CmsFavoriteEntry entry) throws CmsException {
String title = "";
String subtitle = "";
CmsFavInfo result = new CmsFavInfo(entry);
CmsObject cms = A_CmsUI.getCmsObject();
String project = getProject(cms, entry);
String site = getSite(cms, ... | java |
private CmsFavoriteEntry getEntry(Component row) {
if (row instanceof CmsFavInfo) {
return ((CmsFavInfo)row).getEntry();
}
return null;
} | java |
private String getProject(CmsObject cms, CmsFavoriteEntry entry) throws CmsException {
String result = m_projectLabels.get(entry.getProjectId());
if (result == null) {
result = cms.readProject(entry.getProjectId()).getName();
m_projectLabels.put(entry.getProjectId(), result);
... | java |
private String getSite(CmsObject cms, CmsFavoriteEntry entry) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(entry.getSiteRoot());
Item item = m_sitesContainer.getItem(entry.getSiteRoot());
if (item != null) {
return (String)(item.getItemProperty("caption").getValue())... | java |
private void onClickAdd() {
if (m_currentLocation.isPresent()) {
CmsFavoriteEntry entry = m_currentLocation.get();
List<CmsFavoriteEntry> entries = getEntries();
entries.add(entry);
try {
m_favDao.saveFavorites(entries);
} catch (Excep... | java |
public void setLocale(String locale) {
try {
m_locale = LocaleUtils.toLocale(locale);
} catch (IllegalArgumentException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
m_locale = null;
}
} | java |
public List<CmsFavoriteEntry> loadFavorites() throws CmsException {
List<CmsFavoriteEntry> result = new ArrayList<>();
try {
CmsUser user = readUser();
String data = (String)user.getAdditionalInfo(ADDINFO_KEY);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(data)) {
... | java |
public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {
try {
JSONObject json = new JSONObject();
JSONArray array = new JSONArray();
for (CmsFavoriteEntry entry : favorites) {
array.put(entry.toJson());
}
json... | java |
private boolean validate(CmsFavoriteEntry entry) {
try {
String siteRoot = entry.getSiteRoot();
if (!m_okSiteRoots.contains(siteRoot)) {
m_rootCms.readResource(siteRoot);
m_okSiteRoots.add(siteRoot);
}
CmsUUID project = entry.getPr... | java |
public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | java |
public void updateExceptions() {
m_exceptionsList.setDates(m_model.getExceptions());
if (m_model.getExceptions().size() > 0) {
m_exceptionsPanel.setVisible(true);
} else {
m_exceptionsPanel.setVisible(false);
}
} | java |
@UiHandler("m_currentTillEndCheckBox")
void onCurrentTillEndChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setCurrentTillEnd(event.getValue());
}
} | java |
@UiHandler("m_endTime")
void onEndTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setEndTime(event.getDate());
}
} | java |
void onEndTypeChange() {
EndType endType = m_model.getEndType();
m_groupDuration.selectButton(getDurationButtonForType(endType));
switch (endType) {
case DATE:
case TIMES:
m_durationPanel.setVisible(true);
m_seriesEndDate.setValue(m_model.... | java |
void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButto... | java |
@UiHandler("m_seriesCheckBox")
void onSeriesChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setIsSeries(event.getValue());
}
} | java |
@UiHandler("m_startTime")
void onStartTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setStartTime(event.getDate());
}
} | java |
@UiHandler("m_wholeDayCheckBox")
void onWholeDayChange(ValueChangeEvent<Boolean> event) {
//TODO: Improve - adjust time selections?
if (handleChange()) {
m_controller.setWholeDay(event.getValue());
}
} | java |
private void createAndAddButton(PatternType pattern, String messageKey) {
CmsRadioButton btn = new CmsRadioButton(pattern.toString(), Messages.get().key(messageKey));
btn.addStyleName(I_CmsWidgetsLayoutBundle.INSTANCE.widgetCss().radioButtonlabel());
btn.setGroup(m_groupPattern);
m_patt... | java |
private void initDatesPanel() {
m_startLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_STARTTIME_0));
m_startTime.setAllowInvalidValue(true);
m_startTime.setValue(m_model.getStart());
m_endLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_ENDTIME_0));
m... | java |
private void initDeactivationPanel() {
m_deactivationPanel.setVisible(false);
m_deactivationText.setText(Messages.get().key(Messages.GUI_SERIALDATE_DEACTIVE_TEXT_0));
} | java |
private void initDurationButtonGroup() {
m_groupDuration = new CmsRadioButtonGroup();
m_endsAfterRadioButton = new CmsRadioButton(
EndType.TIMES.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_0));
m_endsAfterRadioButton.setGroup(m_groupDurat... | java |
private void initDurationPanel() {
m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));
m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));
m_seriesEndDate.setDateOnly(true);
m_seriesEn... | java |
private void initExceptionsPanel() {
m_exceptionsPanel.setLegend(Messages.get().key(Messages.GUI_SERIALDATE_PANEL_EXCEPTIONS_0));
m_exceptionsPanel.addCloseHandler(this);
m_exceptionsPanel.setVisible(false);
} | java |
private void initManagementPart() {
m_manageExceptionsButton.setText(Messages.get().key(Messages.GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0));
m_manageExceptionsButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
} | java |
private void initPatternButtonGroup() {
m_groupPattern = new CmsRadioButtonGroup();
m_patternButtons = new HashMap<>();
createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0);
m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY));
... | java |
private void injectAdditionalStyles() {
try {
Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets();
for (String stylesheet : stylesheets) {
A_CmsUI.get().getPage().addDependency(new Dependency(Type.STYLESHEET, stylesheet));
... | java |
public String createSessionForResource(String configPath, String fileName) throws CmsUgcException {
CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile(
getCmsObject(),
getRequest(),
configPath,
fileName);
return "" + formS... | java |
public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue();
} else {
try {
tryToSetParsedValue(value);
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not se... | java |
private JSONValue datesToJsonArray(Collection<Date> dates) {
if (null != dates) {
JSONArray result = new JSONArray();
for (Date d : dates) {
result.set(result.size(), dateToJson(d));
}
return result;
}
return null;
} | java |
private JSONValue dateToJson(Date d) {
return null != d ? new JSONString(Long.toString(d.getTime())) : null;
} | java |
private Boolean readOptionalBoolean(JSONValue val) {
JSONBoolean b = null == val ? null : val.isBoolean();
if (b != null) {
return Boolean.valueOf(b.booleanValue());
}
return null;
} | java |
private Date readOptionalDate(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return new Date(Long.parseLong(str.stringValue()));
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// do... | java |
private int readOptionalInt(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return Integer.valueOf(str.stringValue()).intValue();
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// Do... | java |
private Month readOptionalMonth(JSONValue val) {
String str = readOptionalString(val);
if (null != str) {
try {
return Month.valueOf(str);
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
// Do nothing -return the default value
... | java |
private String readOptionalString(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
return str.stringValue();
}
return null;
} | java |
private WeekDay readWeekDay(JSONValue val) throws IllegalArgumentException {
String str = readOptionalString(val);
if (null != str) {
return WeekDay.valueOf(str);
}
throw new IllegalArgumentException();
} | java |
private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString()));
}
return array;
} else {
... | java |
private void tryToSetParsedValue(String value) throws Exception {
JSONObject json = JSONParser.parseStrict(value).isObject();
JSONValue val = json.get(JsonKey.START);
setStart(readOptionalDate(val));
val = json.get(JsonKey.END);
setEnd(readOptionalDate(val));
setWholeDay... | java |
private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
} catch (CmsException e) {
LOG.error(e.ge... | java |
public List<CmsCategory> getLeafItems() {
List<CmsCategory> result = new ArrayList<CmsCategory>();
if (m_categories.isEmpty()) {
return result;
}
Iterator<CmsCategory> it = m_categories.iterator();
CmsCategory current = it.next();
while (it.hasNext()) {
... | java |
public Map<String, CmsJspCategoryAccessBean> getSubCategories() {
if (m_subCategories == null) {
m_subCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
@SuppressWarnings("synthetic-access")
public Object transform(Object pathPrefix) {
... | java |
public List<CmsCategory> getTopItems() {
List<CmsCategory> categories = new ArrayList<CmsCategory>();
String matcher = Pattern.quote(m_mainCategoryPath) + "[^/]*/";
for (CmsCategory category : m_categories) {
if (category.getPath().matches(matcher)) {
categories.add(... | java |
public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
}
m_hiDpiImages.put(factor, image);
} | java |
public static final String[] getRequiredSolrFields() {
if (null == m_requiredSolrFields) {
List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales();
m_requiredSolrFields = new String[14 + (locales.size() * 6)];
int count = 0;
m_requiredSolrFields[c... | java |
private static CmsUUID toUuid(String uuid) {
if ("null".equals(uuid) || CmsStringUtil.isEmpty(uuid)) {
return null;
}
return new CmsUUID(uuid);
} | java |
private void ensureIndexIsUnlocked(String dataDir) {
Collection<File> lockFiles = new ArrayList<File>(2);
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "index") + "write.lock"));
lockFiles.add(
new F... | java |
private void maybeUpdateScrollbarPositions() {
if (!isAttached()) {
return;
}
if (m_scrollbar != null) {
int vPos = getVerticalScrollPosition();
if (m_scrollbar.getVerticalScrollPosition() != vPos) {
m_scrollbar.setVerticalScrollPosi... | java |
private void setVerticalScrollbar(final CmsScrollBar scrollbar, int width) {
// Validate.
if ((scrollbar == m_scrollbar) || (scrollbar == null)) {
return;
}
// Detach new child.
scrollbar.asWidget().removeFromParent();
// Remove old child.
... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.