repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java | CmsImportExportUserDialog.importUserFromFile | protected void importUserFromFile() {
CmsImportUserThread thread = new CmsImportUserThread(
m_cms,
m_ou,
m_userImportList,
getGroupsList(m_importGroups, true),
getRolesList(m_importRoles, true),
m_sendMail.getValue().booleanValue());
thread.start();
CmsShowReportDialog dialog = new CmsShowReportDialog(thread, new Runnable() {
public void run() {
m_window.close();
}
});
m_window.setContent(dialog);
} | java | protected void importUserFromFile() {
CmsImportUserThread thread = new CmsImportUserThread(
m_cms,
m_ou,
m_userImportList,
getGroupsList(m_importGroups, true),
getRolesList(m_importRoles, true),
m_sendMail.getValue().booleanValue());
thread.start();
CmsShowReportDialog dialog = new CmsShowReportDialog(thread, new Runnable() {
public void run() {
m_window.close();
}
});
m_window.setContent(dialog);
} | [
"protected",
"void",
"importUserFromFile",
"(",
")",
"{",
"CmsImportUserThread",
"thread",
"=",
"new",
"CmsImportUserThread",
"(",
"m_cms",
",",
"m_ou",
",",
"m_userImportList",
",",
"getGroupsList",
"(",
"m_importGroups",
",",
"true",
")",
",",
"getRolesList",
"(... | Import user from file. | [
"Import",
"user",
"from",
"file",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java#L628-L647 | train |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthlyWeeks.java | CmsSerialDateBeanMonthlyWeeks.toCorrectDateWithDay | private void toCorrectDateWithDay(Calendar date, WeekOfMonth week) {
date.set(Calendar.DAY_OF_MONTH, 1);
int daysToFirstWeekDayMatch = ((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS)
- (date.get(Calendar.DAY_OF_WEEK))) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS;
date.add(Calendar.DAY_OF_MONTH, daysToFirstWeekDayMatch);
int wouldBeDayOfMonth = date.get(Calendar.DAY_OF_MONTH)
+ ((week.ordinal()) * I_CmsSerialDateValue.NUM_OF_WEEKDAYS);
if (wouldBeDayOfMonth > date.getActualMaximum(Calendar.DAY_OF_MONTH)) {
date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth - I_CmsSerialDateValue.NUM_OF_WEEKDAYS);
} else {
date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth);
}
} | java | private void toCorrectDateWithDay(Calendar date, WeekOfMonth week) {
date.set(Calendar.DAY_OF_MONTH, 1);
int daysToFirstWeekDayMatch = ((m_weekDay.toInt() + I_CmsSerialDateValue.NUM_OF_WEEKDAYS)
- (date.get(Calendar.DAY_OF_WEEK))) % I_CmsSerialDateValue.NUM_OF_WEEKDAYS;
date.add(Calendar.DAY_OF_MONTH, daysToFirstWeekDayMatch);
int wouldBeDayOfMonth = date.get(Calendar.DAY_OF_MONTH)
+ ((week.ordinal()) * I_CmsSerialDateValue.NUM_OF_WEEKDAYS);
if (wouldBeDayOfMonth > date.getActualMaximum(Calendar.DAY_OF_MONTH)) {
date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth - I_CmsSerialDateValue.NUM_OF_WEEKDAYS);
} else {
date.set(Calendar.DAY_OF_MONTH, wouldBeDayOfMonth);
}
} | [
"private",
"void",
"toCorrectDateWithDay",
"(",
"Calendar",
"date",
",",
"WeekOfMonth",
"week",
")",
"{",
"date",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"1",
")",
";",
"int",
"daysToFirstWeekDayMatch",
"=",
"(",
"(",
"m_weekDay",
".",
"toInt"... | Sets the day of the month that matches the condition, i.e., the day of month of the 2nd Saturday.
If the day does not exist in the current month, the last possible date is set, i.e.,
instead of the fifth Saturday, the fourth is chosen.
@param date date that has the correct year and month already set.
@param week the number of the week to choose. | [
"Sets",
"the",
"day",
"of",
"the",
"month",
"that",
"matches",
"the",
"condition",
"i",
".",
"e",
".",
"the",
"day",
"of",
"month",
"of",
"the",
"2nd",
"Saturday",
".",
"If",
"the",
"day",
"does",
"not",
"exist",
"in",
"the",
"current",
"month",
"the... | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthlyWeeks.java#L128-L142 | train |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthlyWeeks.java | CmsSerialDateBeanMonthlyWeeks.toNextDate | private void toNextDate(Calendar date, int interval) {
long previousDate = date.getTimeInMillis();
if (!m_weekOfMonthIterator.hasNext()) {
date.add(Calendar.MONTH, interval);
m_weekOfMonthIterator = m_weeksOfMonth.iterator();
}
toCorrectDateWithDay(date, m_weekOfMonthIterator.next());
if (previousDate == date.getTimeInMillis()) { // this can happen if the fourth and the last week are checked.
toNextDate(date);
}
} | java | private void toNextDate(Calendar date, int interval) {
long previousDate = date.getTimeInMillis();
if (!m_weekOfMonthIterator.hasNext()) {
date.add(Calendar.MONTH, interval);
m_weekOfMonthIterator = m_weeksOfMonth.iterator();
}
toCorrectDateWithDay(date, m_weekOfMonthIterator.next());
if (previousDate == date.getTimeInMillis()) { // this can happen if the fourth and the last week are checked.
toNextDate(date);
}
} | [
"private",
"void",
"toNextDate",
"(",
"Calendar",
"date",
",",
"int",
"interval",
")",
"{",
"long",
"previousDate",
"=",
"date",
".",
"getTimeInMillis",
"(",
")",
";",
"if",
"(",
"!",
"m_weekOfMonthIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"date",
"... | Calculates the next date, starting from the provided date.
@param date the current date.
@param interval the number of month to add when moving to the next month. | [
"Calculates",
"the",
"next",
"date",
"starting",
"from",
"the",
"provided",
"date",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthlyWeeks.java#L150-L162 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/resourcetypes/CmsResourceTypeApp.java | CmsResourceTypeApp.isResourceTypeIdFree | public static boolean isResourceTypeIdFree(int id) {
try {
OpenCms.getResourceManager().getResourceType(id);
} catch (CmsLoaderException e) {
return true;
}
return false;
} | java | public static boolean isResourceTypeIdFree(int id) {
try {
OpenCms.getResourceManager().getResourceType(id);
} catch (CmsLoaderException e) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isResourceTypeIdFree",
"(",
"int",
"id",
")",
"{",
"try",
"{",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"id",
")",
";",
"}",
"catch",
"(",
"CmsLoaderException",
"e",
")",
"{",
"return",
"t... | Is the given resource type id free?
@param id to be checked
@return boolean | [
"Is",
"the",
"given",
"resource",
"type",
"id",
"free?"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsResourceTypeApp.java#L72-L80 | train |
alkacon/opencms-core | src/org/opencms/widgets/A_CmsAdeGalleryWidget.java | A_CmsAdeGalleryWidget.getGalleryOpenParams | protected Map<String, String> getGalleryOpenParams(
CmsObject cms,
CmsMessages messages,
I_CmsWidgetParameter param,
String resource,
long hashId) {
Map<String, String> result = new HashMap<String, String>();
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_MODE, A_CmsAjaxGallery.MODE_WIDGET);
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_STORAGE_PREFIX, getGalleryStoragePrefix());
result.put(I_CmsGalleryProviderConstants.CONFIG_RESOURCE_TYPES, getGalleryTypes());
if (param.getId() != null) {
result.put(I_CmsGalleryProviderConstants.KEY_FIELD_ID, param.getId());
// use javascript to read the current field value
result.put(
I_CmsGalleryProviderConstants.CONFIG_CURRENT_ELEMENT,
"'+document.getElementById('" + param.getId() + "').getAttribute('value')+'");
}
result.put(I_CmsGalleryProviderConstants.KEY_HASH_ID, "" + hashId);
// the edited resource
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(resource)) {
result.put(I_CmsGalleryProviderConstants.CONFIG_REFERENCE_PATH, resource);
}
// the start up gallery path
CmsGalleryWidgetConfiguration configuration = getWidgetConfiguration(cms, messages, param);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getStartup())) {
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_PATH, configuration.getStartup());
}
// set gallery types if available
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getGalleryTypes())) {
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_TYPES, configuration.getGalleryTypes());
}
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_NAME, getGalleryName());
return result;
} | java | protected Map<String, String> getGalleryOpenParams(
CmsObject cms,
CmsMessages messages,
I_CmsWidgetParameter param,
String resource,
long hashId) {
Map<String, String> result = new HashMap<String, String>();
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_MODE, A_CmsAjaxGallery.MODE_WIDGET);
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_STORAGE_PREFIX, getGalleryStoragePrefix());
result.put(I_CmsGalleryProviderConstants.CONFIG_RESOURCE_TYPES, getGalleryTypes());
if (param.getId() != null) {
result.put(I_CmsGalleryProviderConstants.KEY_FIELD_ID, param.getId());
// use javascript to read the current field value
result.put(
I_CmsGalleryProviderConstants.CONFIG_CURRENT_ELEMENT,
"'+document.getElementById('" + param.getId() + "').getAttribute('value')+'");
}
result.put(I_CmsGalleryProviderConstants.KEY_HASH_ID, "" + hashId);
// the edited resource
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(resource)) {
result.put(I_CmsGalleryProviderConstants.CONFIG_REFERENCE_PATH, resource);
}
// the start up gallery path
CmsGalleryWidgetConfiguration configuration = getWidgetConfiguration(cms, messages, param);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getStartup())) {
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_PATH, configuration.getStartup());
}
// set gallery types if available
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(configuration.getGalleryTypes())) {
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_TYPES, configuration.getGalleryTypes());
}
result.put(I_CmsGalleryProviderConstants.CONFIG_GALLERY_NAME, getGalleryName());
return result;
} | [
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"getGalleryOpenParams",
"(",
"CmsObject",
"cms",
",",
"CmsMessages",
"messages",
",",
"I_CmsWidgetParameter",
"param",
",",
"String",
"resource",
",",
"long",
"hashId",
")",
"{",
"Map",
"<",
"String",
",",... | Returns the required gallery open parameters.
@param cms an initialized instance of a CmsObject
@param messages the dialog messages
@param param the widget parameter to generate the widget for
@param resource the resource being edited
@param hashId the field id hash
@return the gallery open parameters | [
"Returns",
"the",
"required",
"gallery",
"open",
"parameters",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsAdeGalleryWidget.java#L284-L318 | train |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrFieldConfiguration.java | CmsSolrFieldConfiguration.appendFieldMappingsFromElementsOnThePage | protected I_CmsSearchDocument appendFieldMappingsFromElementsOnThePage(
I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
List<String> systemFields) {
try {
CmsFile file = cms.readFile(resource);
CmsXmlContainerPage containerPage = CmsXmlContainerPageFactory.unmarshal(cms, file);
CmsContainerPageBean containerBean = containerPage.getContainerPage(cms);
if (containerBean != null) {
for (CmsContainerElementBean element : containerBean.getElements()) {
element.initResource(cms);
CmsResource elemResource = element.getResource();
Set<CmsSearchField> mappedFields = getXSDMappingsForPage(cms, elemResource);
if (mappedFields != null) {
for (CmsSearchField field : mappedFields) {
if (!systemFields.contains(field.getName())) {
document = appendFieldMapping(
document,
field,
cms,
elemResource,
CmsSolrDocumentXmlContent.extractXmlContent(cms, elemResource, getIndex()),
cms.readPropertyObjects(resource, false),
cms.readPropertyObjects(resource, true));
} else {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_SOLR_ERR_MAPPING_TO_INTERNALLY_USED_FIELD_3,
elemResource.getRootPath(),
field.getName(),
resource.getRootPath()));
}
}
}
}
}
} catch (CmsException e) {
// Should be thrown if element on the page does not exist anymore - this is possible, but not necessarily an error.
// Hence, just notice it in the debug log.
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e);
}
}
return document;
} | java | protected I_CmsSearchDocument appendFieldMappingsFromElementsOnThePage(
I_CmsSearchDocument document,
CmsObject cms,
CmsResource resource,
List<String> systemFields) {
try {
CmsFile file = cms.readFile(resource);
CmsXmlContainerPage containerPage = CmsXmlContainerPageFactory.unmarshal(cms, file);
CmsContainerPageBean containerBean = containerPage.getContainerPage(cms);
if (containerBean != null) {
for (CmsContainerElementBean element : containerBean.getElements()) {
element.initResource(cms);
CmsResource elemResource = element.getResource();
Set<CmsSearchField> mappedFields = getXSDMappingsForPage(cms, elemResource);
if (mappedFields != null) {
for (CmsSearchField field : mappedFields) {
if (!systemFields.contains(field.getName())) {
document = appendFieldMapping(
document,
field,
cms,
elemResource,
CmsSolrDocumentXmlContent.extractXmlContent(cms, elemResource, getIndex()),
cms.readPropertyObjects(resource, false),
cms.readPropertyObjects(resource, true));
} else {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_SOLR_ERR_MAPPING_TO_INTERNALLY_USED_FIELD_3,
elemResource.getRootPath(),
field.getName(),
resource.getRootPath()));
}
}
}
}
}
} catch (CmsException e) {
// Should be thrown if element on the page does not exist anymore - this is possible, but not necessarily an error.
// Hence, just notice it in the debug log.
if (LOG.isDebugEnabled()) {
LOG.debug(e.getLocalizedMessage(), e);
}
}
return document;
} | [
"protected",
"I_CmsSearchDocument",
"appendFieldMappingsFromElementsOnThePage",
"(",
"I_CmsSearchDocument",
"document",
",",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"List",
"<",
"String",
">",
"systemFields",
")",
"{",
"try",
"{",
"CmsFile",
"file",
"... | Adds search fields from elements on a container page to a container page's document.
@param document The document for the container page
@param cms The current CmsObject
@param resource The resource of the container page
@param systemFields The list of field names for fields where mappings to should be discarded, since these fields are used system internally.
@return the manipulated document | [
"Adds",
"search",
"fields",
"from",
"elements",
"on",
"a",
"container",
"page",
"to",
"a",
"container",
"page",
"s",
"document",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrFieldConfiguration.java#L377-L424 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsRootHandler.java | CmsRootHandler.clearHandlers | public void clearHandlers() {
for (Map<String, CmsAttributeHandler> handlers : m_handlers) {
for (CmsAttributeHandler handler : handlers.values()) {
handler.clearHandlers();
}
handlers.clear();
}
m_handlers.clear();
m_handlers.add(new HashMap<String, CmsAttributeHandler>());
m_handlerById.clear();
} | java | public void clearHandlers() {
for (Map<String, CmsAttributeHandler> handlers : m_handlers) {
for (CmsAttributeHandler handler : handlers.values()) {
handler.clearHandlers();
}
handlers.clear();
}
m_handlers.clear();
m_handlers.add(new HashMap<String, CmsAttributeHandler>());
m_handlerById.clear();
} | [
"public",
"void",
"clearHandlers",
"(",
")",
"{",
"for",
"(",
"Map",
"<",
"String",
",",
"CmsAttributeHandler",
">",
"handlers",
":",
"m_handlers",
")",
"{",
"for",
"(",
"CmsAttributeHandler",
"handler",
":",
"handlers",
".",
"values",
"(",
")",
")",
"{",
... | Clears the handler hierarchy. | [
"Clears",
"the",
"handler",
"hierarchy",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsRootHandler.java#L63-L74 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.setDates | public void setDates(SortedSet<Date> dates, boolean checked) {
m_checkBoxes.clear();
for (Date date : dates) {
CmsCheckBox cb = generateCheckBox(date, checked);
m_checkBoxes.add(cb);
}
reInitLayoutElements();
setDatesInternal(dates);
} | java | public void setDates(SortedSet<Date> dates, boolean checked) {
m_checkBoxes.clear();
for (Date date : dates) {
CmsCheckBox cb = generateCheckBox(date, checked);
m_checkBoxes.add(cb);
}
reInitLayoutElements();
setDatesInternal(dates);
} | [
"public",
"void",
"setDates",
"(",
"SortedSet",
"<",
"Date",
">",
"dates",
",",
"boolean",
"checked",
")",
"{",
"m_checkBoxes",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Date",
"date",
":",
"dates",
")",
"{",
"CmsCheckBox",
"cb",
"=",
"generateCheckBox",... | Sets all dates in the list.
@param dates the dates to set
@param checked flag, indicating if all should be checked or unchecked. | [
"Sets",
"all",
"dates",
"in",
"the",
"list",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L240-L249 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.setDatesWithCheckState | public void setDatesWithCheckState(Collection<CmsPair<Date, Boolean>> datesWithCheckInfo) {
SortedSet<Date> dates = new TreeSet<>();
m_checkBoxes.clear();
for (CmsPair<Date, Boolean> p : datesWithCheckInfo) {
addCheckBox(p.getFirst(), p.getSecond().booleanValue());
dates.add(p.getFirst());
}
reInitLayoutElements();
setDatesInternal(dates);
} | java | public void setDatesWithCheckState(Collection<CmsPair<Date, Boolean>> datesWithCheckInfo) {
SortedSet<Date> dates = new TreeSet<>();
m_checkBoxes.clear();
for (CmsPair<Date, Boolean> p : datesWithCheckInfo) {
addCheckBox(p.getFirst(), p.getSecond().booleanValue());
dates.add(p.getFirst());
}
reInitLayoutElements();
setDatesInternal(dates);
} | [
"public",
"void",
"setDatesWithCheckState",
"(",
"Collection",
"<",
"CmsPair",
"<",
"Date",
",",
"Boolean",
">",
">",
"datesWithCheckInfo",
")",
"{",
"SortedSet",
"<",
"Date",
">",
"dates",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"m_checkBoxes",
".",
"... | Set dates with the provided check states.
@param datesWithCheckInfo the dates to set, accompanied with the check state to set. | [
"Set",
"dates",
"with",
"the",
"provided",
"check",
"states",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L255-L265 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.addCheckBox | private void addCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = generateCheckBox(date, checkState);
m_checkBoxes.add(cb);
reInitLayoutElements();
} | java | private void addCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = generateCheckBox(date, checkState);
m_checkBoxes.add(cb);
reInitLayoutElements();
} | [
"private",
"void",
"addCheckBox",
"(",
"Date",
"date",
",",
"boolean",
"checkState",
")",
"{",
"CmsCheckBox",
"cb",
"=",
"generateCheckBox",
"(",
"date",
",",
"checkState",
")",
";",
"m_checkBoxes",
".",
"add",
"(",
"cb",
")",
";",
"reInitLayoutElements",
"(... | Add a new check box.
@param date the date for the check box
@param checkState the initial check state. | [
"Add",
"a",
"new",
"check",
"box",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L272-L278 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.addDateWithCheckState | private void addDateWithCheckState(Date date, boolean checkState) {
addCheckBox(date, checkState);
if (!m_dates.contains(date)) {
m_dates.add(date);
fireValueChange();
}
} | java | private void addDateWithCheckState(Date date, boolean checkState) {
addCheckBox(date, checkState);
if (!m_dates.contains(date)) {
m_dates.add(date);
fireValueChange();
}
} | [
"private",
"void",
"addDateWithCheckState",
"(",
"Date",
"date",
",",
"boolean",
"checkState",
")",
"{",
"addCheckBox",
"(",
"date",
",",
"checkState",
")",
";",
"if",
"(",
"!",
"m_dates",
".",
"contains",
"(",
"date",
")",
")",
"{",
"m_dates",
".",
"add... | Add a date with a certain check state.
@param date the date to add.
@param checkState the check state. | [
"Add",
"a",
"date",
"with",
"a",
"certain",
"check",
"state",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L285-L292 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.generateCheckBox | private CmsCheckBox generateCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = new CmsCheckBox();
cb.setText(m_dateFormat.format(date));
cb.setChecked(checkState);
cb.getElement().setPropertyObject("date", date);
return cb;
} | java | private CmsCheckBox generateCheckBox(Date date, boolean checkState) {
CmsCheckBox cb = new CmsCheckBox();
cb.setText(m_dateFormat.format(date));
cb.setChecked(checkState);
cb.getElement().setPropertyObject("date", date);
return cb;
} | [
"private",
"CmsCheckBox",
"generateCheckBox",
"(",
"Date",
"date",
",",
"boolean",
"checkState",
")",
"{",
"CmsCheckBox",
"cb",
"=",
"new",
"CmsCheckBox",
"(",
")",
";",
"cb",
".",
"setText",
"(",
"m_dateFormat",
".",
"format",
"(",
"date",
")",
")",
";",
... | Generate a new check box with the provided date and check state.
@param date date for the check box.
@param checkState the initial check state.
@return the created check box | [
"Generate",
"a",
"new",
"check",
"box",
"with",
"the",
"provided",
"date",
"and",
"check",
"state",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L308-L316 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.reInitLayoutElements | private void reInitLayoutElements() {
m_panel.clear();
for (CmsCheckBox cb : m_checkBoxes) {
m_panel.add(setStyle(m_onlyLabels ? new Label(cb.getText()) : cb));
}
} | java | private void reInitLayoutElements() {
m_panel.clear();
for (CmsCheckBox cb : m_checkBoxes) {
m_panel.add(setStyle(m_onlyLabels ? new Label(cb.getText()) : cb));
}
} | [
"private",
"void",
"reInitLayoutElements",
"(",
")",
"{",
"m_panel",
".",
"clear",
"(",
")",
";",
"for",
"(",
"CmsCheckBox",
"cb",
":",
"m_checkBoxes",
")",
"{",
"m_panel",
".",
"add",
"(",
"setStyle",
"(",
"m_onlyLabels",
"?",
"new",
"Label",
"(",
"cb",... | Refresh the layout element. | [
"Refresh",
"the",
"layout",
"element",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L321-L327 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.setDatesInternal | private void setDatesInternal(SortedSet<Date> dates) {
if (!m_dates.equals(dates)) {
m_dates = new TreeSet<>(dates);
fireValueChange();
}
} | java | private void setDatesInternal(SortedSet<Date> dates) {
if (!m_dates.equals(dates)) {
m_dates = new TreeSet<>(dates);
fireValueChange();
}
} | [
"private",
"void",
"setDatesInternal",
"(",
"SortedSet",
"<",
"Date",
">",
"dates",
")",
"{",
"if",
"(",
"!",
"m_dates",
".",
"equals",
"(",
"dates",
")",
")",
"{",
"m_dates",
"=",
"new",
"TreeSet",
"<>",
"(",
"dates",
")",
";",
"fireValueChange",
"(",... | Updates the internal list of dates and fires a value change if necessary.
@param dates the dates to set. | [
"Updates",
"the",
"internal",
"list",
"of",
"dates",
"and",
"fires",
"a",
"value",
"change",
"if",
"necessary",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L334-L340 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java | CmsCheckableDatePanel.setStyle | private Widget setStyle(Widget widget) {
widget.setWidth(m_width);
widget.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
return widget;
} | java | private Widget setStyle(Widget widget) {
widget.setWidth(m_width);
widget.getElement().getStyle().setDisplay(Display.INLINE_BLOCK);
return widget;
} | [
"private",
"Widget",
"setStyle",
"(",
"Widget",
"widget",
")",
"{",
"widget",
".",
"setWidth",
"(",
"m_width",
")",
";",
"widget",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setDisplay",
"(",
"Display",
".",
"INLINE_BLOCK",
")",
";",
... | Set the style for the widgets in the panel according to the chosen style option.
@param widget the widget that should be styled.
@return the styled widget. | [
"Set",
"the",
"style",
"for",
"the",
"widgets",
"in",
"the",
"panel",
"according",
"to",
"the",
"chosen",
"style",
"option",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L347-L352 | train |
alkacon/opencms-core | src/org/opencms/file/types/CmsResourceTypeXmlContent.java | CmsResourceTypeXmlContent.getDetailContainerResources | private List<CmsResource> getDetailContainerResources(CmsObject cms, CmsResource res) throws CmsException {
CmsRelationFilter filter = CmsRelationFilter.relationsFromStructureId(res.getStructureId()).filterType(
CmsRelationType.DETAIL_ONLY);
List<CmsResource> result = Lists.newArrayList();
List<CmsRelation> relations = cms.readRelations(filter);
for (CmsRelation relation : relations) {
try {
result.add(relation.getTarget(cms, CmsResourceFilter.ALL));
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return result;
} | java | private List<CmsResource> getDetailContainerResources(CmsObject cms, CmsResource res) throws CmsException {
CmsRelationFilter filter = CmsRelationFilter.relationsFromStructureId(res.getStructureId()).filterType(
CmsRelationType.DETAIL_ONLY);
List<CmsResource> result = Lists.newArrayList();
List<CmsRelation> relations = cms.readRelations(filter);
for (CmsRelation relation : relations) {
try {
result.add(relation.getTarget(cms, CmsResourceFilter.ALL));
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return result;
} | [
"private",
"List",
"<",
"CmsResource",
">",
"getDetailContainerResources",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"res",
")",
"throws",
"CmsException",
"{",
"CmsRelationFilter",
"filter",
"=",
"CmsRelationFilter",
".",
"relationsFromStructureId",
"(",
"res",
"."... | Reads the detail container resources which are connected by relations to the given resource.
@param cms the current CMS context
@param res the detail content
@return the list of detail only container resources
@throws CmsException if something goes wrong | [
"Reads",
"the",
"detail",
"container",
"resources",
"which",
"are",
"connected",
"by",
"relations",
"to",
"the",
"given",
"resource",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/types/CmsResourceTypeXmlContent.java#L652-L666 | train |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/searchindex/CmsMappingsList.java | CmsMappingsList.getMappings | private List<I_CmsSearchFieldMapping> getMappings() {
CmsSearchManager manager = OpenCms.getSearchManager();
I_CmsSearchFieldConfiguration fieldConfig = manager.getFieldConfiguration(getParamFieldconfiguration());
CmsLuceneField field;
List<I_CmsSearchFieldMapping> result = null;
Iterator<CmsSearchField> itFields;
if (fieldConfig != null) {
itFields = fieldConfig.getFields().iterator();
while (itFields.hasNext()) {
field = (CmsLuceneField)itFields.next();
if (field.getName().equals(getParamField())) {
result = field.getMappings();
}
}
} else {
result = Collections.emptyList();
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1,
A_CmsFieldConfigurationDialog.PARAM_FIELDCONFIGURATION));
}
}
return result;
} | java | private List<I_CmsSearchFieldMapping> getMappings() {
CmsSearchManager manager = OpenCms.getSearchManager();
I_CmsSearchFieldConfiguration fieldConfig = manager.getFieldConfiguration(getParamFieldconfiguration());
CmsLuceneField field;
List<I_CmsSearchFieldMapping> result = null;
Iterator<CmsSearchField> itFields;
if (fieldConfig != null) {
itFields = fieldConfig.getFields().iterator();
while (itFields.hasNext()) {
field = (CmsLuceneField)itFields.next();
if (field.getName().equals(getParamField())) {
result = field.getMappings();
}
}
} else {
result = Collections.emptyList();
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1,
A_CmsFieldConfigurationDialog.PARAM_FIELDCONFIGURATION));
}
}
return result;
} | [
"private",
"List",
"<",
"I_CmsSearchFieldMapping",
">",
"getMappings",
"(",
")",
"{",
"CmsSearchManager",
"manager",
"=",
"OpenCms",
".",
"getSearchManager",
"(",
")",
";",
"I_CmsSearchFieldConfiguration",
"fieldConfig",
"=",
"manager",
".",
"getFieldConfiguration",
"... | Returns the configured mappings of the current field.
@return the configured mappings of the current field | [
"Returns",
"the",
"configured",
"mappings",
"of",
"the",
"current",
"field",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsMappingsList.java#L421-L446 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/ui/CmsSetupErrorDialog.java | CmsSetupErrorDialog.showErrorDialog | public static void showErrorDialog(String message, String details) {
Window window = prepareWindow(DialogWidth.wide);
window.setCaption("Error");
window.setContent(new CmsSetupErrorDialog(message, details, null, window));
A_CmsUI.get().addWindow(window);
} | java | public static void showErrorDialog(String message, String details) {
Window window = prepareWindow(DialogWidth.wide);
window.setCaption("Error");
window.setContent(new CmsSetupErrorDialog(message, details, null, window));
A_CmsUI.get().addWindow(window);
} | [
"public",
"static",
"void",
"showErrorDialog",
"(",
"String",
"message",
",",
"String",
"details",
")",
"{",
"Window",
"window",
"=",
"prepareWindow",
"(",
"DialogWidth",
".",
"wide",
")",
";",
"window",
".",
"setCaption",
"(",
"\"Error\"",
")",
";",
"window... | Shows error dialog, manually supplying details instead of getting them from an exception stack trace.
@param message the error message
@param details the details | [
"Shows",
"error",
"dialog",
"manually",
"supplying",
"details",
"instead",
"of",
"getting",
"them",
"from",
"an",
"exception",
"stack",
"trace",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupErrorDialog.java#L154-L161 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsMacroFormatterResolver.java | CmsMacroFormatterResolver.getMacroBeanValue | protected Object getMacroBeanValue(Object bean, String property) {
Object result = null;
if ((bean != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(property)) {
try {
PropertyUtilsBean propBean = BeanUtilsBean.getInstance().getPropertyUtils();
result = propBean.getProperty(bean, property);
} catch (Exception e) {
LOG.error("Unable to access property '" + property + "' of '" + bean + "'.", e);
}
} else {
LOG.info("Invalid parameters: property='" + property + "' bean='" + bean + "'.");
}
return result;
} | java | protected Object getMacroBeanValue(Object bean, String property) {
Object result = null;
if ((bean != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(property)) {
try {
PropertyUtilsBean propBean = BeanUtilsBean.getInstance().getPropertyUtils();
result = propBean.getProperty(bean, property);
} catch (Exception e) {
LOG.error("Unable to access property '" + property + "' of '" + bean + "'.", e);
}
} else {
LOG.info("Invalid parameters: property='" + property + "' bean='" + bean + "'.");
}
return result;
} | [
"protected",
"Object",
"getMacroBeanValue",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"Object",
"result",
"=",
"null",
";",
"if",
"(",
"(",
"bean",
"!=",
"null",
")",
"&&",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"property",
... | Returns the property value read from the given JavaBean.
@param bean the JavaBean to read the property from
@param property the property to read
@return the property value read from the given JavaBean | [
"Returns",
"the",
"property",
"value",
"read",
"from",
"the",
"given",
"JavaBean",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsMacroFormatterResolver.java#L295-L309 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setEndTime | public void setEndTime(final Date date) {
if (!Objects.equals(m_model.getEnd(), date)) {
m_model.setEnd(date);
valueChanged();
}
} | java | public void setEndTime(final Date date) {
if (!Objects.equals(m_model.getEnd(), date)) {
m_model.setEnd(date);
valueChanged();
}
} | [
"public",
"void",
"setEndTime",
"(",
"final",
"Date",
"date",
")",
"{",
"if",
"(",
"!",
"Objects",
".",
"equals",
"(",
"m_model",
".",
"getEnd",
"(",
")",
",",
"date",
")",
")",
"{",
"m_model",
".",
"setEnd",
"(",
"date",
")",
";",
"valueChanged",
... | Set the end time.
@param date the end time to set. | [
"Set",
"the",
"end",
"time",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L578-L585 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setEndType | public void setEndType(final String value) {
final EndType endType = EndType.valueOf(value);
if (!endType.equals(m_model.getEndType())) {
removeExceptionsOnChange(new Command() {
public void execute() {
switch (endType) {
case SINGLE:
m_model.setOccurrences(0);
m_model.setSeriesEndDate(null);
break;
case TIMES:
m_model.setOccurrences(10);
m_model.setSeriesEndDate(null);
break;
case DATE:
m_model.setOccurrences(0);
m_model.setSeriesEndDate(m_model.getStart() == null ? new Date() : m_model.getStart());
break;
default:
break;
}
m_model.setEndType(endType);
valueChanged();
}
});
}
} | java | public void setEndType(final String value) {
final EndType endType = EndType.valueOf(value);
if (!endType.equals(m_model.getEndType())) {
removeExceptionsOnChange(new Command() {
public void execute() {
switch (endType) {
case SINGLE:
m_model.setOccurrences(0);
m_model.setSeriesEndDate(null);
break;
case TIMES:
m_model.setOccurrences(10);
m_model.setSeriesEndDate(null);
break;
case DATE:
m_model.setOccurrences(0);
m_model.setSeriesEndDate(m_model.getStart() == null ? new Date() : m_model.getStart());
break;
default:
break;
}
m_model.setEndType(endType);
valueChanged();
}
});
}
} | [
"public",
"void",
"setEndType",
"(",
"final",
"String",
"value",
")",
"{",
"final",
"EndType",
"endType",
"=",
"EndType",
".",
"valueOf",
"(",
"value",
")",
";",
"if",
"(",
"!",
"endType",
".",
"equals",
"(",
"m_model",
".",
"getEndType",
"(",
")",
")"... | Set the duration option.
@param value the duration option to set ({@link EndType} as string). | [
"Set",
"the",
"duration",
"option",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L591-L621 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setIsSeries | public void setIsSeries(Boolean isSeries) {
if (null != isSeries) {
final boolean series = isSeries.booleanValue();
if ((null != m_model.getParentSeriesId()) && series) {
m_removeSeriesBindingConfirmDialog.show(new Command() {
public void execute() {
m_model.setParentSeriesId(null);
setPattern(PatternType.DAILY.toString());
}
});
} else {
setPattern(series ? PatternType.DAILY.toString() : PatternType.NONE.toString());
}
}
} | java | public void setIsSeries(Boolean isSeries) {
if (null != isSeries) {
final boolean series = isSeries.booleanValue();
if ((null != m_model.getParentSeriesId()) && series) {
m_removeSeriesBindingConfirmDialog.show(new Command() {
public void execute() {
m_model.setParentSeriesId(null);
setPattern(PatternType.DAILY.toString());
}
});
} else {
setPattern(series ? PatternType.DAILY.toString() : PatternType.NONE.toString());
}
}
} | [
"public",
"void",
"setIsSeries",
"(",
"Boolean",
"isSeries",
")",
"{",
"if",
"(",
"null",
"!=",
"isSeries",
")",
"{",
"final",
"boolean",
"series",
"=",
"isSeries",
".",
"booleanValue",
"(",
")",
";",
"if",
"(",
"(",
"null",
"!=",
"m_model",
".",
"getP... | Toggle between single events and series.
@param isSeries flag, indicating if we want a series of events. | [
"Toggle",
"between",
"single",
"events",
"and",
"series",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L627-L645 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setOccurrences | public void setOccurrences(String occurrences) {
int o = CmsSerialDateUtil.toIntWithDefault(occurrences, -1);
if (m_model.getOccurrences() != o) {
m_model.setOccurrences(o);
valueChanged();
}
} | java | public void setOccurrences(String occurrences) {
int o = CmsSerialDateUtil.toIntWithDefault(occurrences, -1);
if (m_model.getOccurrences() != o) {
m_model.setOccurrences(o);
valueChanged();
}
} | [
"public",
"void",
"setOccurrences",
"(",
"String",
"occurrences",
")",
"{",
"int",
"o",
"=",
"CmsSerialDateUtil",
".",
"toIntWithDefault",
"(",
"occurrences",
",",
"-",
"1",
")",
";",
"if",
"(",
"m_model",
".",
"getOccurrences",
"(",
")",
"!=",
"o",
")",
... | Set the occurrences. If the String is invalid, the occurrences will be set to "-1" to cause server-side validation to fail.
@param occurrences the interval to set. | [
"Set",
"the",
"occurrences",
".",
"If",
"the",
"String",
"is",
"invalid",
"the",
"occurrences",
"will",
"be",
"set",
"to",
"-",
"1",
"to",
"cause",
"server",
"-",
"side",
"validation",
"to",
"fail",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L660-L667 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setPattern | public void setPattern(String patternType) {
final PatternType type = PatternType.valueOf(patternType);
if (type != m_model.getPatternType()) {
removeExceptionsOnChange(new Command() {
public void execute() {
EndType oldEndType = m_model.getEndType();
m_model.setPatternType(type);
m_model.setIndividualDates(null);
m_model.setInterval(getPatternDefaultValues().getInterval());
m_model.setEveryWorkingDay(Boolean.FALSE);
m_model.clearWeekDays();
m_model.clearIndividualDates();
m_model.clearWeeksOfMonth();
m_model.clearExceptions();
if (type.equals(PatternType.NONE) || type.equals(PatternType.INDIVIDUAL)) {
m_model.setEndType(EndType.SINGLE);
} else if (oldEndType.equals(EndType.SINGLE)) {
m_model.setEndType(EndType.TIMES);
m_model.setOccurrences(10);
m_model.setSeriesEndDate(null);
}
m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
m_model.setMonth(getPatternDefaultValues().getMonth());
if (type.equals(PatternType.WEEKLY)) {
m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
}
valueChanged();
}
});
}
} | java | public void setPattern(String patternType) {
final PatternType type = PatternType.valueOf(patternType);
if (type != m_model.getPatternType()) {
removeExceptionsOnChange(new Command() {
public void execute() {
EndType oldEndType = m_model.getEndType();
m_model.setPatternType(type);
m_model.setIndividualDates(null);
m_model.setInterval(getPatternDefaultValues().getInterval());
m_model.setEveryWorkingDay(Boolean.FALSE);
m_model.clearWeekDays();
m_model.clearIndividualDates();
m_model.clearWeeksOfMonth();
m_model.clearExceptions();
if (type.equals(PatternType.NONE) || type.equals(PatternType.INDIVIDUAL)) {
m_model.setEndType(EndType.SINGLE);
} else if (oldEndType.equals(EndType.SINGLE)) {
m_model.setEndType(EndType.TIMES);
m_model.setOccurrences(10);
m_model.setSeriesEndDate(null);
}
m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
m_model.setMonth(getPatternDefaultValues().getMonth());
if (type.equals(PatternType.WEEKLY)) {
m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
}
valueChanged();
}
});
}
} | [
"public",
"void",
"setPattern",
"(",
"String",
"patternType",
")",
"{",
"final",
"PatternType",
"type",
"=",
"PatternType",
".",
"valueOf",
"(",
"patternType",
")",
";",
"if",
"(",
"type",
"!=",
"m_model",
".",
"getPatternType",
"(",
")",
")",
"{",
"remove... | Set the serial pattern type.
@param patternType the pattern type to set. | [
"Set",
"the",
"serial",
"pattern",
"type",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L673-L707 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setSeriesEndDate | public void setSeriesEndDate(Date date) {
if (!Objects.equals(m_model.getSeriesEndDate(), date)) {
m_model.setSeriesEndDate(date);
valueChanged();
}
} | java | public void setSeriesEndDate(Date date) {
if (!Objects.equals(m_model.getSeriesEndDate(), date)) {
m_model.setSeriesEndDate(date);
valueChanged();
}
} | [
"public",
"void",
"setSeriesEndDate",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"!",
"Objects",
".",
"equals",
"(",
"m_model",
".",
"getSeriesEndDate",
"(",
")",
",",
"date",
")",
")",
"{",
"m_model",
".",
"setSeriesEndDate",
"(",
"date",
")",
";",
"va... | Set the serial end date.
@param date the serial end date. | [
"Set",
"the",
"serial",
"end",
"date",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L713-L720 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setStartTime | public void setStartTime(final Date date) {
if (!Objects.equals(m_model.getStart(), date)) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setStart(date);
setPatternDefaultValues(date);
valueChanged();
}
});
}
} | java | public void setStartTime(final Date date) {
if (!Objects.equals(m_model.getStart(), date)) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setStart(date);
setPatternDefaultValues(date);
valueChanged();
}
});
}
} | [
"public",
"void",
"setStartTime",
"(",
"final",
"Date",
"date",
")",
"{",
"if",
"(",
"!",
"Objects",
".",
"equals",
"(",
"m_model",
".",
"getStart",
"(",
")",
",",
"date",
")",
")",
"{",
"removeExceptionsOnChange",
"(",
"new",
"Command",
"(",
")",
"{",... | Set the start time.
@param date the start time to set. | [
"Set",
"the",
"start",
"time",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L726-L740 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setWholeDay | public void setWholeDay(Boolean isWholeDay) {
if (m_model.isWholeDay() ^ ((null != isWholeDay) && isWholeDay.booleanValue())) {
m_model.setWholeDay(isWholeDay);
valueChanged();
}
} | java | public void setWholeDay(Boolean isWholeDay) {
if (m_model.isWholeDay() ^ ((null != isWholeDay) && isWholeDay.booleanValue())) {
m_model.setWholeDay(isWholeDay);
valueChanged();
}
} | [
"public",
"void",
"setWholeDay",
"(",
"Boolean",
"isWholeDay",
")",
"{",
"if",
"(",
"m_model",
".",
"isWholeDay",
"(",
")",
"^",
"(",
"(",
"null",
"!=",
"isWholeDay",
")",
"&&",
"isWholeDay",
".",
"booleanValue",
"(",
")",
")",
")",
"{",
"m_model",
"."... | Sets the whole day flag.
@param isWholeDay flag, indicating if the event lasts whole days. | [
"Sets",
"the",
"whole",
"day",
"flag",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L769-L775 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.updateExceptions | public void updateExceptions(SortedSet<Date> exceptions) {
SortedSet<Date> e = null == exceptions ? new TreeSet<Date>() : exceptions;
if (!m_model.getExceptions().equals(e)) {
m_model.setExceptions(e);
m_view.updateExceptions();
valueChanged();
sizeChanged();
}
} | java | public void updateExceptions(SortedSet<Date> exceptions) {
SortedSet<Date> e = null == exceptions ? new TreeSet<Date>() : exceptions;
if (!m_model.getExceptions().equals(e)) {
m_model.setExceptions(e);
m_view.updateExceptions();
valueChanged();
sizeChanged();
}
} | [
"public",
"void",
"updateExceptions",
"(",
"SortedSet",
"<",
"Date",
">",
"exceptions",
")",
"{",
"SortedSet",
"<",
"Date",
">",
"e",
"=",
"null",
"==",
"exceptions",
"?",
"new",
"TreeSet",
"<",
"Date",
">",
"(",
")",
":",
"exceptions",
";",
"if",
"(",... | Updates the exceptions.
@param exceptions the exceptions to set | [
"Updates",
"the",
"exceptions",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L789-L799 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.getService | I_CmsSerialDateServiceAsync getService() {
if (SERVICE == null) {
SERVICE = GWT.create(I_CmsSerialDateService.class);
String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.contenteditor.CmsSerialDateService.gwt");
((ServiceDefTarget)SERVICE).setServiceEntryPoint(serviceUrl);
}
return SERVICE;
} | java | I_CmsSerialDateServiceAsync getService() {
if (SERVICE == null) {
SERVICE = GWT.create(I_CmsSerialDateService.class);
String serviceUrl = CmsCoreProvider.get().link("org.opencms.ade.contenteditor.CmsSerialDateService.gwt");
((ServiceDefTarget)SERVICE).setServiceEntryPoint(serviceUrl);
}
return SERVICE;
} | [
"I_CmsSerialDateServiceAsync",
"getService",
"(",
")",
"{",
"if",
"(",
"SERVICE",
"==",
"null",
")",
"{",
"SERVICE",
"=",
"GWT",
".",
"create",
"(",
"I_CmsSerialDateService",
".",
"class",
")",
";",
"String",
"serviceUrl",
"=",
"CmsCoreProvider",
".",
"get",
... | Returns the RPC service for serial dates.
@return the RPC service for serial dates. | [
"Returns",
"the",
"RPC",
"service",
"for",
"serial",
"dates",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L824-L832 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.setPatternDefaultValues | void setPatternDefaultValues(Date startDate) {
if ((m_patternDefaultValues == null) || !Objects.equals(m_patternDefaultValues.getDate(), startDate)) {
m_patternDefaultValues = new PatternDefaultValues(startDate);
}
} | java | void setPatternDefaultValues(Date startDate) {
if ((m_patternDefaultValues == null) || !Objects.equals(m_patternDefaultValues.getDate(), startDate)) {
m_patternDefaultValues = new PatternDefaultValues(startDate);
}
} | [
"void",
"setPatternDefaultValues",
"(",
"Date",
"startDate",
")",
"{",
"if",
"(",
"(",
"m_patternDefaultValues",
"==",
"null",
")",
"||",
"!",
"Objects",
".",
"equals",
"(",
"m_patternDefaultValues",
".",
"getDate",
"(",
")",
",",
"startDate",
")",
")",
"{",... | Sets the default pattern values dependent on the provided start date.
@param startDate the date, the default values are determined with. | [
"Sets",
"the",
"default",
"pattern",
"values",
"dependent",
"on",
"the",
"provided",
"start",
"date",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L838-L843 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java | CmsSerialDateController.initPatternControllers | private void initPatternControllers() {
m_patternControllers.put(PatternType.NONE, new CmsPatternPanelNoneController());
m_patternControllers.put(PatternType.DAILY, new CmsPatternPanelDailyController(m_model, this));
m_patternControllers.put(PatternType.WEEKLY, new CmsPatternPanelWeeklyController(m_model, this));
m_patternControllers.put(PatternType.MONTHLY, new CmsPatternPanelMonthlyController(m_model, this));
m_patternControllers.put(PatternType.YEARLY, new CmsPatternPanelYearlyController(m_model, this));
// m_patternControllers.put(PatternType.INDIVIDUAL, new CmsPatternPanelIndividualController(m_model, this));
} | java | private void initPatternControllers() {
m_patternControllers.put(PatternType.NONE, new CmsPatternPanelNoneController());
m_patternControllers.put(PatternType.DAILY, new CmsPatternPanelDailyController(m_model, this));
m_patternControllers.put(PatternType.WEEKLY, new CmsPatternPanelWeeklyController(m_model, this));
m_patternControllers.put(PatternType.MONTHLY, new CmsPatternPanelMonthlyController(m_model, this));
m_patternControllers.put(PatternType.YEARLY, new CmsPatternPanelYearlyController(m_model, this));
// m_patternControllers.put(PatternType.INDIVIDUAL, new CmsPatternPanelIndividualController(m_model, this));
} | [
"private",
"void",
"initPatternControllers",
"(",
")",
"{",
"m_patternControllers",
".",
"put",
"(",
"PatternType",
".",
"NONE",
",",
"new",
"CmsPatternPanelNoneController",
"(",
")",
")",
";",
"m_patternControllers",
".",
"put",
"(",
"PatternType",
".",
"DAILY",
... | Initialize the pattern controllers. | [
"Initialize",
"the",
"pattern",
"controllers",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateController.java#L848-L856 | train |
alkacon/opencms-core | src/org/opencms/configuration/CmsSetNextRule.java | CmsSetNextRule.begin | @Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
// not now: 6.0.0
// digester.setLogger(CmsLog.getLog(digester.getClass()));
// Push an array to capture the parameter values if necessary
if (m_paramCount > 0) {
Object[] parameters = new Object[m_paramCount];
for (int i = 0; i < parameters.length; i++) {
parameters[i] = null;
}
getDigester().pushParams(parameters);
}
} | java | @Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
// not now: 6.0.0
// digester.setLogger(CmsLog.getLog(digester.getClass()));
// Push an array to capture the parameter values if necessary
if (m_paramCount > 0) {
Object[] parameters = new Object[m_paramCount];
for (int i = 0; i < parameters.length; i++) {
parameters[i] = null;
}
getDigester().pushParams(parameters);
}
} | [
"@",
"Override",
"public",
"void",
"begin",
"(",
"String",
"namespace",
",",
"String",
"name",
",",
"Attributes",
"attributes",
")",
"throws",
"Exception",
"{",
"// not now: 6.0.0",
"// digester.setLogger(CmsLog.getLog(digester.getClass()));",
"// Push an array to capture the... | Process the start of this element.
@param attributes The attribute list for this element
@param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace
aware or the element has no namespace
@param name the local name if the parser is namespace aware, or just the element name otherwise
@throws Exception if something goes wrong | [
"Process",
"the",
"start",
"of",
"this",
"element",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsSetNextRule.java#L180-L194 | train |
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.setPublishQueueShutdowntime | public void setPublishQueueShutdowntime(String publishQueueShutdowntime) {
if (m_frozen) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0));
}
m_publishQueueShutdowntime = Integer.parseInt(publishQueueShutdowntime);
} | java | public void setPublishQueueShutdowntime(String publishQueueShutdowntime) {
if (m_frozen) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_CONFIG_FROZEN_0));
}
m_publishQueueShutdowntime = Integer.parseInt(publishQueueShutdowntime);
} | [
"public",
"void",
"setPublishQueueShutdowntime",
"(",
"String",
"publishQueueShutdowntime",
")",
"{",
"if",
"(",
"m_frozen",
")",
"{",
"throw",
"new",
"CmsRuntimeException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_CONF... | Sets the publish queue shutdown time.
@param publishQueueShutdowntime the shutdown time to set, parsed as <code>int</code> | [
"Sets",
"the",
"publish",
"queue",
"shutdown",
"time",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L707-L713 | train |
alkacon/opencms-core | src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java | CmsUserSettingsStringPropertyWrapper.getElementView | @PrefMetadata(type = CmsElementViewPreference.class)
public String getElementView() {
return m_settings.getAdditionalPreference(CmsElementViewPreference.PREFERENCE_NAME, false);
} | java | @PrefMetadata(type = CmsElementViewPreference.class)
public String getElementView() {
return m_settings.getAdditionalPreference(CmsElementViewPreference.PREFERENCE_NAME, false);
} | [
"@",
"PrefMetadata",
"(",
"type",
"=",
"CmsElementViewPreference",
".",
"class",
")",
"public",
"String",
"getElementView",
"(",
")",
"{",
"return",
"m_settings",
".",
"getAdditionalPreference",
"(",
"CmsElementViewPreference",
".",
"PREFERENCE_NAME",
",",
"false",
... | Gets the element view.
@return the element view | [
"Gets",
"the",
"element",
"view",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java#L194-L198 | train |
alkacon/opencms-core | src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java | CmsUserSettingsStringPropertyWrapper.getExplorerFileEntryOptions | @PrefMetadata(type = CmsHiddenBuiltinPreference.class)
public String getExplorerFileEntryOptions() {
if (m_settings.getExplorerFileEntryOptions() == null) {
return "";
} else {
return "" + m_settings.getExplorerFileEntryOptions();
}
} | java | @PrefMetadata(type = CmsHiddenBuiltinPreference.class)
public String getExplorerFileEntryOptions() {
if (m_settings.getExplorerFileEntryOptions() == null) {
return "";
} else {
return "" + m_settings.getExplorerFileEntryOptions();
}
} | [
"@",
"PrefMetadata",
"(",
"type",
"=",
"CmsHiddenBuiltinPreference",
".",
"class",
")",
"public",
"String",
"getExplorerFileEntryOptions",
"(",
")",
"{",
"if",
"(",
"m_settings",
".",
"getExplorerFileEntryOptions",
"(",
")",
"==",
"null",
")",
"{",
"return",
"\"... | Gets the explorer file entry options.
@return the explorer file entry options | [
"Gets",
"the",
"explorer",
"file",
"entry",
"options",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java#L238-L246 | train |
alkacon/opencms-core | src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java | CmsUserSettingsStringPropertyWrapper.getTimeWarp | @PrefMetadata(type = CmsTimeWarpPreference.class)
public String getTimeWarp() {
long warp = m_settings.getTimeWarp();
return warp < 0 ? "" : "" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the negative value
} | java | @PrefMetadata(type = CmsTimeWarpPreference.class)
public String getTimeWarp() {
long warp = m_settings.getTimeWarp();
return warp < 0 ? "" : "" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the negative value
} | [
"@",
"PrefMetadata",
"(",
"type",
"=",
"CmsTimeWarpPreference",
".",
"class",
")",
"public",
"String",
"getTimeWarp",
"(",
")",
"{",
"long",
"warp",
"=",
"m_settings",
".",
"getTimeWarp",
"(",
")",
";",
"return",
"warp",
"<",
"0",
"?",
"\"\"",
":",
"\"\"... | Gets the time warp.
@return the time warp | [
"Gets",
"the",
"time",
"warp",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java#L572-L577 | train |
alkacon/opencms-core | src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java | CmsUserSettingsStringPropertyWrapper.setTimeWarp | public void setTimeWarp(String l) {
long warp = CmsContextInfo.CURRENT_TIME;
try {
warp = Long.parseLong(l);
} catch (NumberFormatException e) {
// if parsing the time warp fails, it will be set to -1 (i.e. disabled)
}
m_settings.setTimeWarp(warp);
} | java | public void setTimeWarp(String l) {
long warp = CmsContextInfo.CURRENT_TIME;
try {
warp = Long.parseLong(l);
} catch (NumberFormatException e) {
// if parsing the time warp fails, it will be set to -1 (i.e. disabled)
}
m_settings.setTimeWarp(warp);
} | [
"public",
"void",
"setTimeWarp",
"(",
"String",
"l",
")",
"{",
"long",
"warp",
"=",
"CmsContextInfo",
".",
"CURRENT_TIME",
";",
"try",
"{",
"warp",
"=",
"Long",
".",
"parseLong",
"(",
"l",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
... | Sets the time warp.
@param l the new time warp | [
"Sets",
"the",
"time",
"warp",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/preferences/CmsUserSettingsStringPropertyWrapper.java#L1128-L1137 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setExceptions | public final void setExceptions(SortedSet<Date> dates) {
m_exceptions.clear();
if (null != dates) {
m_exceptions.addAll(dates);
}
} | java | public final void setExceptions(SortedSet<Date> dates) {
m_exceptions.clear();
if (null != dates) {
m_exceptions.addAll(dates);
}
} | [
"public",
"final",
"void",
"setExceptions",
"(",
"SortedSet",
"<",
"Date",
">",
"dates",
")",
"{",
"m_exceptions",
".",
"clear",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"dates",
")",
"{",
"m_exceptions",
".",
"addAll",
"(",
"dates",
")",
";",
"}",
"}... | Set dates where the event should not take place, even if they are part of the series.
@param dates dates to set. | [
"Set",
"dates",
"where",
"the",
"event",
"should",
"not",
"take",
"place",
"even",
"if",
"they",
"are",
"part",
"of",
"the",
"series",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L465-L472 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setIndividualDates | public final void setIndividualDates(SortedSet<Date> dates) {
m_individualDates.clear();
if (null != dates) {
m_individualDates.addAll(dates);
}
for (Date d : getExceptions()) {
if (!m_individualDates.contains(d)) {
m_exceptions.remove(d);
}
}
} | java | public final void setIndividualDates(SortedSet<Date> dates) {
m_individualDates.clear();
if (null != dates) {
m_individualDates.addAll(dates);
}
for (Date d : getExceptions()) {
if (!m_individualDates.contains(d)) {
m_exceptions.remove(d);
}
}
} | [
"public",
"final",
"void",
"setIndividualDates",
"(",
"SortedSet",
"<",
"Date",
">",
"dates",
")",
"{",
"m_individualDates",
".",
"clear",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"dates",
")",
"{",
"m_individualDates",
".",
"addAll",
"(",
"dates",
")",
"... | Set the individual dates where the event should take place.
@param dates the dates to set. | [
"Set",
"the",
"individual",
"dates",
"where",
"the",
"event",
"should",
"take",
"place",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L478-L490 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setWeekDay | public final void setWeekDay(WeekDay weekDay) {
SortedSet<WeekDay> wds = new TreeSet<>();
if (null != weekDay) {
wds.add(weekDay);
}
setWeekDays(wds);
} | java | public final void setWeekDay(WeekDay weekDay) {
SortedSet<WeekDay> wds = new TreeSet<>();
if (null != weekDay) {
wds.add(weekDay);
}
setWeekDays(wds);
} | [
"public",
"final",
"void",
"setWeekDay",
"(",
"WeekDay",
"weekDay",
")",
"{",
"SortedSet",
"<",
"WeekDay",
">",
"wds",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"weekDay",
")",
"{",
"wds",
".",
"add",
"(",
"weekDay",
")",
... | Set the week day the events should occur.
@param weekDay the week day to set. | [
"Set",
"the",
"week",
"day",
"the",
"events",
"should",
"occur",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L566-L574 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setWeekDays | public final void setWeekDays(SortedSet<WeekDay> weekDays) {
m_weekDays.clear();
if (null != weekDays) {
m_weekDays.addAll(weekDays);
}
} | java | public final void setWeekDays(SortedSet<WeekDay> weekDays) {
m_weekDays.clear();
if (null != weekDays) {
m_weekDays.addAll(weekDays);
}
} | [
"public",
"final",
"void",
"setWeekDays",
"(",
"SortedSet",
"<",
"WeekDay",
">",
"weekDays",
")",
"{",
"m_weekDays",
".",
"clear",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"weekDays",
")",
"{",
"m_weekDays",
".",
"addAll",
"(",
"weekDays",
")",
";",
"}"... | Set the week days the events should occur.
@param weekDays the week days to set. | [
"Set",
"the",
"week",
"days",
"the",
"events",
"should",
"occur",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L580-L586 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setWeekOfMonth | public final void setWeekOfMonth(WeekOfMonth weekOfMonth) {
SortedSet<WeekOfMonth> woms = new TreeSet<>();
if (null != weekOfMonth) {
woms.add(weekOfMonth);
}
setWeeksOfMonth(woms);
} | java | public final void setWeekOfMonth(WeekOfMonth weekOfMonth) {
SortedSet<WeekOfMonth> woms = new TreeSet<>();
if (null != weekOfMonth) {
woms.add(weekOfMonth);
}
setWeeksOfMonth(woms);
} | [
"public",
"final",
"void",
"setWeekOfMonth",
"(",
"WeekOfMonth",
"weekOfMonth",
")",
"{",
"SortedSet",
"<",
"WeekOfMonth",
">",
"woms",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"weekOfMonth",
")",
"{",
"woms",
".",
"add",
"(",... | Set the week of the month the events should occur.
@param weekOfMonth the week of month to set (first to fifth, where fifth means last). | [
"Set",
"the",
"week",
"of",
"the",
"month",
"the",
"events",
"should",
"occur",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L592-L599 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setWeeksOfMonth | public final void setWeeksOfMonth(SortedSet<WeekOfMonth> weeksOfMonth) {
m_weeksOfMonth.clear();
if (null != weeksOfMonth) {
m_weeksOfMonth.addAll(weeksOfMonth);
}
} | java | public final void setWeeksOfMonth(SortedSet<WeekOfMonth> weeksOfMonth) {
m_weeksOfMonth.clear();
if (null != weeksOfMonth) {
m_weeksOfMonth.addAll(weeksOfMonth);
}
} | [
"public",
"final",
"void",
"setWeeksOfMonth",
"(",
"SortedSet",
"<",
"WeekOfMonth",
">",
"weeksOfMonth",
")",
"{",
"m_weeksOfMonth",
".",
"clear",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"weeksOfMonth",
")",
"{",
"m_weeksOfMonth",
".",
"addAll",
"(",
"weeksO... | Set the weeks of the month the events should occur.
@param weeksOfMonth the weeks of month to set (first to fifth, where fifth means last). | [
"Set",
"the",
"weeks",
"of",
"the",
"month",
"the",
"events",
"should",
"occur",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L605-L612 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.isDurationValid | protected final boolean isDurationValid() {
if (isValidEndTypeForPattern()) {
switch (getEndType()) {
case DATE:
return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS));
case TIMES:
return getOccurrences() > 0;
case SINGLE:
return true;
default:
return false;
}
} else {
return false;
}
} | java | protected final boolean isDurationValid() {
if (isValidEndTypeForPattern()) {
switch (getEndType()) {
case DATE:
return (getStart().getTime() < (getSeriesEndDate().getTime() + DAY_IN_MILLIS));
case TIMES:
return getOccurrences() > 0;
case SINGLE:
return true;
default:
return false;
}
} else {
return false;
}
} | [
"protected",
"final",
"boolean",
"isDurationValid",
"(",
")",
"{",
"if",
"(",
"isValidEndTypeForPattern",
"(",
")",
")",
"{",
"switch",
"(",
"getEndType",
"(",
")",
")",
"{",
"case",
"DATE",
":",
"return",
"(",
"getStart",
"(",
")",
".",
"getTime",
"(",
... | Checks if the duration option is valid.
NOTE: This does NOT check, if too many events are specified.
@return a flag, indicating if the duration option is valid. | [
"Checks",
"if",
"the",
"duration",
"option",
"is",
"valid",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L640-L656 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.isPatternValid | protected final boolean isPatternValid() {
switch (getPatternType()) {
case DAILY:
return isEveryWorkingDay() || isIntervalValid();
case WEEKLY:
return isIntervalValid() && isWeekDaySet();
case MONTHLY:
return isIntervalValid() && isWeekDaySet() ? isWeekOfMonthSet() : isDayOfMonthValid();
case YEARLY:
return isMonthSet() && isWeekDaySet() ? isWeekOfMonthSet() : isDayOfMonthValid();
case INDIVIDUAL:
case NONE:
return true;
default:
return false;
}
} | java | protected final boolean isPatternValid() {
switch (getPatternType()) {
case DAILY:
return isEveryWorkingDay() || isIntervalValid();
case WEEKLY:
return isIntervalValid() && isWeekDaySet();
case MONTHLY:
return isIntervalValid() && isWeekDaySet() ? isWeekOfMonthSet() : isDayOfMonthValid();
case YEARLY:
return isMonthSet() && isWeekDaySet() ? isWeekOfMonthSet() : isDayOfMonthValid();
case INDIVIDUAL:
case NONE:
return true;
default:
return false;
}
} | [
"protected",
"final",
"boolean",
"isPatternValid",
"(",
")",
"{",
"switch",
"(",
"getPatternType",
"(",
")",
")",
"{",
"case",
"DAILY",
":",
"return",
"isEveryWorkingDay",
"(",
")",
"||",
"isIntervalValid",
"(",
")",
";",
"case",
"WEEKLY",
":",
"return",
"... | Checks, if all values necessary for a specific pattern are valid.
@return a flag, indicating if all values required for the pattern are valid. | [
"Checks",
"if",
"all",
"values",
"necessary",
"for",
"a",
"specific",
"pattern",
"are",
"valid",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L689-L706 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.isValidEndTypeForPattern | protected final boolean isValidEndTypeForPattern() {
if (getEndType() == null) {
return false;
}
switch (getPatternType()) {
case DAILY:
case WEEKLY:
case MONTHLY:
case YEARLY:
return (getEndType().equals(EndType.DATE) || getEndType().equals(EndType.TIMES));
case INDIVIDUAL:
case NONE:
return getEndType().equals(EndType.SINGLE);
default:
return false;
}
} | java | protected final boolean isValidEndTypeForPattern() {
if (getEndType() == null) {
return false;
}
switch (getPatternType()) {
case DAILY:
case WEEKLY:
case MONTHLY:
case YEARLY:
return (getEndType().equals(EndType.DATE) || getEndType().equals(EndType.TIMES));
case INDIVIDUAL:
case NONE:
return getEndType().equals(EndType.SINGLE);
default:
return false;
}
} | [
"protected",
"final",
"boolean",
"isValidEndTypeForPattern",
"(",
")",
"{",
"if",
"(",
"getEndType",
"(",
")",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"switch",
"(",
"getPatternType",
"(",
")",
")",
"{",
"case",
"DAILY",
":",
"case",
"WEEKLY... | Checks, if the end type is valid for the set pattern type.
@return a flag, indicating if the end type is valid for the pattern type. | [
"Checks",
"if",
"the",
"end",
"type",
"is",
"valid",
"for",
"the",
"set",
"pattern",
"type",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L721-L738 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setDefaultValue | protected final void setDefaultValue() {
m_start = null;
m_end = null;
m_patterntype = PatternType.NONE;
m_dayOfMonth = 0;
m_exceptions.clear();
m_individualDates.clear();
m_interval = 0;
m_isEveryWorkingDay = false;
m_isWholeDay = false;
m_month = Month.JANUARY;
m_seriesEndDate = null;
m_seriesOccurrences = 0;
m_weekDays.clear();
m_weeksOfMonth.clear();
m_endType = EndType.SINGLE;
m_parentSeriesId = null;
} | java | protected final void setDefaultValue() {
m_start = null;
m_end = null;
m_patterntype = PatternType.NONE;
m_dayOfMonth = 0;
m_exceptions.clear();
m_individualDates.clear();
m_interval = 0;
m_isEveryWorkingDay = false;
m_isWholeDay = false;
m_month = Month.JANUARY;
m_seriesEndDate = null;
m_seriesOccurrences = 0;
m_weekDays.clear();
m_weeksOfMonth.clear();
m_endType = EndType.SINGLE;
m_parentSeriesId = null;
} | [
"protected",
"final",
"void",
"setDefaultValue",
"(",
")",
"{",
"m_start",
"=",
"null",
";",
"m_end",
"=",
"null",
";",
"m_patterntype",
"=",
"PatternType",
".",
"NONE",
";",
"m_dayOfMonth",
"=",
"0",
";",
"m_exceptions",
".",
"clear",
"(",
")",
";",
"m_... | Sets the value to a default. | [
"Sets",
"the",
"value",
"to",
"a",
"default",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L761-L779 | train |
alkacon/opencms-core | src/org/opencms/acacia/shared/A_CmsSerialDateValue.java | A_CmsSerialDateValue.setDerivedEndType | protected final void setDerivedEndType() {
m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)
? EndType.SINGLE
: null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;
} | java | protected final void setDerivedEndType() {
m_endType = getPatternType().equals(PatternType.NONE) || getPatternType().equals(PatternType.INDIVIDUAL)
? EndType.SINGLE
: null != getSeriesEndDate() ? EndType.DATE : EndType.TIMES;
} | [
"protected",
"final",
"void",
"setDerivedEndType",
"(",
")",
"{",
"m_endType",
"=",
"getPatternType",
"(",
")",
".",
"equals",
"(",
"PatternType",
".",
"NONE",
")",
"||",
"getPatternType",
"(",
")",
".",
"equals",
"(",
"PatternType",
".",
"INDIVIDUAL",
")",
... | Set the end type as derived from other values. | [
"Set",
"the",
"end",
"type",
"as",
"derived",
"from",
"other",
"values",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/A_CmsSerialDateValue.java#L784-L789 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsFunctionRenderer.java | CmsFunctionRenderer.defaultHtml | public static String defaultHtml(HttpServletRequest request) {
CmsObject cms = CmsFlexController.getController(request).getCmsObject();
// We only want the big red warning in Offline mode
if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
return "<div><!--Dynamic function not configured--></div>";
} else {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
String message = Messages.get().getBundle(locale).key(Messages.GUI_FUNCTION_DEFAULT_HTML_0);
return "<div style=\"border: 2px solid red; padding: 10px;\">" + message + "</div>";
}
} | java | public static String defaultHtml(HttpServletRequest request) {
CmsObject cms = CmsFlexController.getController(request).getCmsObject();
// We only want the big red warning in Offline mode
if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
return "<div><!--Dynamic function not configured--></div>";
} else {
Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms);
String message = Messages.get().getBundle(locale).key(Messages.GUI_FUNCTION_DEFAULT_HTML_0);
return "<div style=\"border: 2px solid red; padding: 10px;\">" + message + "</div>";
}
} | [
"public",
"static",
"String",
"defaultHtml",
"(",
"HttpServletRequest",
"request",
")",
"{",
"CmsObject",
"cms",
"=",
"CmsFlexController",
".",
"getController",
"(",
"request",
")",
".",
"getCmsObject",
"(",
")",
";",
"// We only want the big red warning in Offline mode... | Returns the default output for functions without configured JSPs.
@param request the current request
@return the default HTML output | [
"Returns",
"the",
"default",
"output",
"for",
"functions",
"without",
"configured",
"JSPs",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsFunctionRenderer.java#L117-L129 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java | RemoteServiceProxy.getEncodedInstance | private static String getEncodedInstance(String encodedResponse) {
if (isReturnValue(encodedResponse) || isThrownException(encodedResponse)) {
return encodedResponse.substring(4);
}
return encodedResponse;
} | java | private static String getEncodedInstance(String encodedResponse) {
if (isReturnValue(encodedResponse) || isThrownException(encodedResponse)) {
return encodedResponse.substring(4);
}
return encodedResponse;
} | [
"private",
"static",
"String",
"getEncodedInstance",
"(",
"String",
"encodedResponse",
")",
"{",
"if",
"(",
"isReturnValue",
"(",
"encodedResponse",
")",
"||",
"isThrownException",
"(",
"encodedResponse",
")",
")",
"{",
"return",
"encodedResponse",
".",
"substring",... | Returns a string that encodes the result of a method invocation.
Effectively, this just removes any headers from the encoded response.
@param encodedResponse
@return string that encodes the result of a method invocation | [
"Returns",
"a",
"string",
"that",
"encodes",
"the",
"result",
"of",
"a",
"method",
"invocation",
".",
"Effectively",
"this",
"just",
"removes",
"any",
"headers",
"from",
"the",
"encoded",
"response",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L202-L208 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java | RemoteServiceProxy.doInvoke | protected <T> Request doInvoke(ResponseReader responseReader,
String methodName, RpcStatsContext statsContext, String requestData,
AsyncCallback<T> callback) {
RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName,
statsContext, requestData, callback);
try {
return rb.send();
} catch (RequestException ex) {
InvocationException iex = new InvocationException(
"Unable to initiate the asynchronous service invocation (" +
methodName + ") -- check the network connection",
ex);
callback.onFailure(iex);
} finally {
if (statsContext.isStatsAvailable()) {
statsContext.stats(statsContext.bytesStat(methodName,
requestData.length(), "requestSent"));
}
}
return null;
} | java | protected <T> Request doInvoke(ResponseReader responseReader,
String methodName, RpcStatsContext statsContext, String requestData,
AsyncCallback<T> callback) {
RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName,
statsContext, requestData, callback);
try {
return rb.send();
} catch (RequestException ex) {
InvocationException iex = new InvocationException(
"Unable to initiate the asynchronous service invocation (" +
methodName + ") -- check the network connection",
ex);
callback.onFailure(iex);
} finally {
if (statsContext.isStatsAvailable()) {
statsContext.stats(statsContext.bytesStat(methodName,
requestData.length(), "requestSent"));
}
}
return null;
} | [
"protected",
"<",
"T",
">",
"Request",
"doInvoke",
"(",
"ResponseReader",
"responseReader",
",",
"String",
"methodName",
",",
"RpcStatsContext",
"statsContext",
",",
"String",
"requestData",
",",
"AsyncCallback",
"<",
"T",
">",
"callback",
")",
"{",
"RequestBuilde... | Performs a remote service method invocation. This method is called by
generated proxy classes.
@param <T> return type for the AsyncCallback
@param responseReader instance used to read the return value of the
invocation
@param requestData payload that encodes the addressing and arguments of the
RPC call
@param callback callback handler
@return a {@link Request} object that can be used to track the request | [
"Performs",
"a",
"remote",
"service",
"method",
"invocation",
".",
"This",
"method",
"is",
"called",
"by",
"generated",
"proxy",
"classes",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L374-L396 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java | RemoteServiceProxy.doPrepareRequestBuilder | protected <T> RequestBuilder doPrepareRequestBuilder(
ResponseReader responseReader, String methodName, RpcStatsContext statsContext,
String requestData, AsyncCallback<T> callback) {
RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName,
statsContext, requestData, callback);
return rb;
} | java | protected <T> RequestBuilder doPrepareRequestBuilder(
ResponseReader responseReader, String methodName, RpcStatsContext statsContext,
String requestData, AsyncCallback<T> callback) {
RequestBuilder rb = doPrepareRequestBuilderImpl(responseReader, methodName,
statsContext, requestData, callback);
return rb;
} | [
"protected",
"<",
"T",
">",
"RequestBuilder",
"doPrepareRequestBuilder",
"(",
"ResponseReader",
"responseReader",
",",
"String",
"methodName",
",",
"RpcStatsContext",
"statsContext",
",",
"String",
"requestData",
",",
"AsyncCallback",
"<",
"T",
">",
"callback",
")",
... | Configures a RequestBuilder to send an RPC request when the RequestBuilder
is intended to be returned through the asynchronous proxy interface.
@param <T> return type for the AsyncCallback
@param responseReader instance used to read the return value of the
invocation
@param requestData payload that encodes the addressing and arguments of the
RPC call
@param callback callback handler
@return a RequestBuilder object that is ready to have its
{@link RequestBuilder#send()} method invoked. | [
"Configures",
"a",
"RequestBuilder",
"to",
"send",
"an",
"RPC",
"request",
"when",
"the",
"RequestBuilder",
"is",
"intended",
"to",
"be",
"returned",
"through",
"the",
"asynchronous",
"proxy",
"interface",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L412-L420 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java | RemoteServiceProxy.doPrepareRequestBuilderImpl | private <T> RequestBuilder doPrepareRequestBuilderImpl(
ResponseReader responseReader, String methodName, RpcStatsContext statsContext,
String requestData, AsyncCallback<T> callback) {
if (getServiceEntryPoint() == null) {
throw new NoServiceEntryPointSpecifiedException();
}
RequestCallback responseHandler = doCreateRequestCallback(responseReader,
methodName, statsContext, callback);
ensureRpcRequestBuilder();
rpcRequestBuilder.create(getServiceEntryPoint());
rpcRequestBuilder.setCallback(responseHandler);
// changed code
rpcRequestBuilder.setSync(isSync(methodName));
// changed code
rpcRequestBuilder.setContentType(RPC_CONTENT_TYPE);
rpcRequestBuilder.setRequestData(requestData);
rpcRequestBuilder.setRequestId(statsContext.getRequestId());
return rpcRequestBuilder.finish();
} | java | private <T> RequestBuilder doPrepareRequestBuilderImpl(
ResponseReader responseReader, String methodName, RpcStatsContext statsContext,
String requestData, AsyncCallback<T> callback) {
if (getServiceEntryPoint() == null) {
throw new NoServiceEntryPointSpecifiedException();
}
RequestCallback responseHandler = doCreateRequestCallback(responseReader,
methodName, statsContext, callback);
ensureRpcRequestBuilder();
rpcRequestBuilder.create(getServiceEntryPoint());
rpcRequestBuilder.setCallback(responseHandler);
// changed code
rpcRequestBuilder.setSync(isSync(methodName));
// changed code
rpcRequestBuilder.setContentType(RPC_CONTENT_TYPE);
rpcRequestBuilder.setRequestData(requestData);
rpcRequestBuilder.setRequestId(statsContext.getRequestId());
return rpcRequestBuilder.finish();
} | [
"private",
"<",
"T",
">",
"RequestBuilder",
"doPrepareRequestBuilderImpl",
"(",
"ResponseReader",
"responseReader",
",",
"String",
"methodName",
",",
"RpcStatsContext",
"statsContext",
",",
"String",
"requestData",
",",
"AsyncCallback",
"<",
"T",
">",
"callback",
")",... | Configures a RequestBuilder to send an RPC request.
@param <T> return type for the AsyncCallback
@param responseReader instance used to read the return value of the
invocation
@param requestData payload that encodes the addressing and arguments of the
RPC call
@param callback callback handler
@return a RequestBuilder object that is ready to have its
{@link RequestBuilder#send()} method invoked. | [
"Configures",
"a",
"RequestBuilder",
"to",
"send",
"an",
"RPC",
"request",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java#L435-L459 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java | CmsCategoryTree.deselectChildren | private void deselectChildren(CmsTreeItem item) {
for (String childId : m_childrens.get(item.getId())) {
CmsTreeItem child = m_categories.get(childId);
deselectChildren(child);
child.getCheckBox().setChecked(false);
if (m_selectedCategories.contains(childId)) {
m_selectedCategories.remove(childId);
}
}
} | java | private void deselectChildren(CmsTreeItem item) {
for (String childId : m_childrens.get(item.getId())) {
CmsTreeItem child = m_categories.get(childId);
deselectChildren(child);
child.getCheckBox().setChecked(false);
if (m_selectedCategories.contains(childId)) {
m_selectedCategories.remove(childId);
}
}
} | [
"private",
"void",
"deselectChildren",
"(",
"CmsTreeItem",
"item",
")",
"{",
"for",
"(",
"String",
"childId",
":",
"m_childrens",
".",
"get",
"(",
"item",
".",
"getId",
"(",
")",
")",
")",
"{",
"CmsTreeItem",
"child",
"=",
"m_categories",
".",
"get",
"("... | Deselects all child items of the provided item.
@param item the item for which all childs should be deselected.d | [
"Deselects",
"all",
"child",
"items",
"of",
"the",
"provided",
"item",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java#L972-L982 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java | CmsCategoryTree.normalizeSelectedCategories | private void normalizeSelectedCategories() {
Collection<String> normalizedCategories = new ArrayList<String>(m_selectedCategories.size());
for (CmsTreeItem item : m_categories.values()) {
if (item.getCheckBox().isChecked()) {
normalizedCategories.add(item.getId());
}
}
m_selectedCategories = normalizedCategories;
} | java | private void normalizeSelectedCategories() {
Collection<String> normalizedCategories = new ArrayList<String>(m_selectedCategories.size());
for (CmsTreeItem item : m_categories.values()) {
if (item.getCheckBox().isChecked()) {
normalizedCategories.add(item.getId());
}
}
m_selectedCategories = normalizedCategories;
} | [
"private",
"void",
"normalizeSelectedCategories",
"(",
")",
"{",
"Collection",
"<",
"String",
">",
"normalizedCategories",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"m_selectedCategories",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"CmsTreeItem",
"it... | Normalize the list of selected categories to fit for the ids of the tree items. | [
"Normalize",
"the",
"list",
"of",
"selected",
"categories",
"to",
"fit",
"for",
"the",
"ids",
"of",
"the",
"tree",
"items",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java#L1003-L1013 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java | CmsCategoryTree.uncheckAll | private void uncheckAll(CmsList<? extends I_CmsListItem> list) {
for (Widget it : list) {
CmsTreeItem treeItem = (CmsTreeItem)it;
treeItem.getCheckBox().setChecked(false);
uncheckAll(treeItem.getChildren());
}
} | java | private void uncheckAll(CmsList<? extends I_CmsListItem> list) {
for (Widget it : list) {
CmsTreeItem treeItem = (CmsTreeItem)it;
treeItem.getCheckBox().setChecked(false);
uncheckAll(treeItem.getChildren());
}
} | [
"private",
"void",
"uncheckAll",
"(",
"CmsList",
"<",
"?",
"extends",
"I_CmsListItem",
">",
"list",
")",
"{",
"for",
"(",
"Widget",
"it",
":",
"list",
")",
"{",
"CmsTreeItem",
"treeItem",
"=",
"(",
"CmsTreeItem",
")",
"it",
";",
"treeItem",
".",
"getChec... | Uncheck all items in the list including all sub-items.
@param list list of CmsTreeItem entries. | [
"Uncheck",
"all",
"items",
"in",
"the",
"list",
"including",
"all",
"sub",
"-",
"items",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/category/CmsCategoryTree.java#L1053-L1060 | train |
alkacon/opencms-core | src/org/opencms/widgets/Messages.java | Messages.getButtonName | public static String getButtonName(String gallery) {
StringBuffer sb = new StringBuffer(GUI_BUTTON_PREF);
sb.append(gallery.toUpperCase());
sb.append(GUI_BUTTON_SUF);
return sb.toString();
} | java | public static String getButtonName(String gallery) {
StringBuffer sb = new StringBuffer(GUI_BUTTON_PREF);
sb.append(gallery.toUpperCase());
sb.append(GUI_BUTTON_SUF);
return sb.toString();
} | [
"public",
"static",
"String",
"getButtonName",
"(",
"String",
"gallery",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"GUI_BUTTON_PREF",
")",
";",
"sb",
".",
"append",
"(",
"gallery",
".",
"toUpperCase",
"(",
")",
")",
";",
"sb",
".",
... | Create button message key.
@param gallery name
@return Button message key as String | [
"Create",
"button",
"message",
"key",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/Messages.java#L181-L187 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.addDescriptor | public boolean addDescriptor() {
saveLocalization();
IndexedContainer oldContainer = m_container;
try {
createAndLockDescriptorFile();
unmarshalDescriptor();
updateBundleDescriptorContent();
m_hasMasterMode = true;
m_container = createContainer();
m_editorState.put(EditMode.DEFAULT, getDefaultState());
m_editorState.put(EditMode.MASTER, getMasterState());
} catch (CmsException | IOException e) {
LOG.error(e.getLocalizedMessage(), e);
if (m_descContent != null) {
m_descContent = null;
}
if (m_descFile != null) {
m_descFile = null;
}
if (m_desc != null) {
try {
m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1));
} catch (CmsException ex) {
LOG.error(ex.getLocalizedMessage(), ex);
}
m_desc = null;
}
m_hasMasterMode = false;
m_container = oldContainer;
return false;
}
m_removeDescriptorOnCancel = true;
return true;
} | java | public boolean addDescriptor() {
saveLocalization();
IndexedContainer oldContainer = m_container;
try {
createAndLockDescriptorFile();
unmarshalDescriptor();
updateBundleDescriptorContent();
m_hasMasterMode = true;
m_container = createContainer();
m_editorState.put(EditMode.DEFAULT, getDefaultState());
m_editorState.put(EditMode.MASTER, getMasterState());
} catch (CmsException | IOException e) {
LOG.error(e.getLocalizedMessage(), e);
if (m_descContent != null) {
m_descContent = null;
}
if (m_descFile != null) {
m_descFile = null;
}
if (m_desc != null) {
try {
m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(1));
} catch (CmsException ex) {
LOG.error(ex.getLocalizedMessage(), ex);
}
m_desc = null;
}
m_hasMasterMode = false;
m_container = oldContainer;
return false;
}
m_removeDescriptorOnCancel = true;
return true;
} | [
"public",
"boolean",
"addDescriptor",
"(",
")",
"{",
"saveLocalization",
"(",
")",
";",
"IndexedContainer",
"oldContainer",
"=",
"m_container",
";",
"try",
"{",
"createAndLockDescriptorFile",
"(",
")",
";",
"unmarshalDescriptor",
"(",
")",
";",
"updateBundleDescript... | Creates a descriptor for the currently edited message bundle.
@return <code>true</code> if the descriptor could be created, <code>false</code> otherwise. | [
"Creates",
"a",
"descriptor",
"for",
"the",
"currently",
"edited",
"message",
"bundle",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L562-L596 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.deleteDescriptorIfNecessary | public void deleteDescriptorIfNecessary() throws CmsException {
if (m_removeDescriptorOnCancel && (m_desc != null)) {
m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2));
}
} | java | public void deleteDescriptorIfNecessary() throws CmsException {
if (m_removeDescriptorOnCancel && (m_desc != null)) {
m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2));
}
} | [
"public",
"void",
"deleteDescriptorIfNecessary",
"(",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"m_removeDescriptorOnCancel",
"&&",
"(",
"m_desc",
"!=",
"null",
")",
")",
"{",
"m_cms",
".",
"deleteResource",
"(",
"m_desc",
",",
"CmsResourceDeleteMode",
".",
... | When the descriptor was added while editing, but the change was not saved, it has to be removed
when the editor is closed.
@throws CmsException thrown when deleting the descriptor resource fails | [
"When",
"the",
"descriptor",
"was",
"added",
"while",
"editing",
"but",
"the",
"change",
"was",
"not",
"saved",
"it",
"has",
"to",
"be",
"removed",
"when",
"the",
"editor",
"is",
"closed",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L612-L618 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getConfigurableMessages | public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) {
return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle);
} | java | public ConfigurableMessages getConfigurableMessages(CmsMessages defaultMessages, Locale locale) {
return new ConfigurableMessages(defaultMessages, locale, m_configuredBundle);
} | [
"public",
"ConfigurableMessages",
"getConfigurableMessages",
"(",
"CmsMessages",
"defaultMessages",
",",
"Locale",
"locale",
")",
"{",
"return",
"new",
"ConfigurableMessages",
"(",
"defaultMessages",
",",
"locale",
",",
"m_configuredBundle",
")",
";",
"}"
] | Returns the configured bundle, or the provided default bundle.
@param defaultMessages the default bundle
@param locale the preferred locale
@return the configured bundle or, if not found, the default bundle. | [
"Returns",
"the",
"configured",
"bundle",
"or",
"the",
"provided",
"default",
"bundle",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L642-L646 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getContextMenuForItem | public CmsContextMenu getContextMenuForItem(Object itemId) {
CmsContextMenu result = null;
try {
final Item item = m_container.getItem(itemId);
Property<?> keyProp = item.getItemProperty(TableProperty.KEY);
String key = (String)keyProp.getValue();
if ((null != key) && !key.isEmpty()) {
loadAllRemainingLocalizations();
final Map<Locale, String> localesWithEntries = new HashMap<Locale, String>();
for (Locale l : m_localizations.keySet()) {
if (l != m_locale) {
String value = m_localizations.get(l).getProperty(key);
if ((null != value) && !value.isEmpty()) {
localesWithEntries.put(l, value);
}
}
}
if (!localesWithEntries.isEmpty()) {
result = new CmsContextMenu();
ContextMenuItem mainItem = result.addItem(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(
Messages.GUI_BUNDLE_EDITOR_CONTEXT_COPY_LOCALE_0));
for (final Locale l : localesWithEntries.keySet()) {
ContextMenuItem menuItem = mainItem.addItem(l.getDisplayName(UI.getCurrent().getLocale()));
menuItem.addItemClickListener(new ContextMenuItemClickListener() {
public void contextMenuItemClicked(ContextMenuItemClickEvent event) {
item.getItemProperty(TableProperty.TRANSLATION).setValue(localesWithEntries.get(l));
}
});
}
}
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
//TODO: Improve
}
return result;
} | java | public CmsContextMenu getContextMenuForItem(Object itemId) {
CmsContextMenu result = null;
try {
final Item item = m_container.getItem(itemId);
Property<?> keyProp = item.getItemProperty(TableProperty.KEY);
String key = (String)keyProp.getValue();
if ((null != key) && !key.isEmpty()) {
loadAllRemainingLocalizations();
final Map<Locale, String> localesWithEntries = new HashMap<Locale, String>();
for (Locale l : m_localizations.keySet()) {
if (l != m_locale) {
String value = m_localizations.get(l).getProperty(key);
if ((null != value) && !value.isEmpty()) {
localesWithEntries.put(l, value);
}
}
}
if (!localesWithEntries.isEmpty()) {
result = new CmsContextMenu();
ContextMenuItem mainItem = result.addItem(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(
Messages.GUI_BUNDLE_EDITOR_CONTEXT_COPY_LOCALE_0));
for (final Locale l : localesWithEntries.keySet()) {
ContextMenuItem menuItem = mainItem.addItem(l.getDisplayName(UI.getCurrent().getLocale()));
menuItem.addItemClickListener(new ContextMenuItemClickListener() {
public void contextMenuItemClicked(ContextMenuItemClickEvent event) {
item.getItemProperty(TableProperty.TRANSLATION).setValue(localesWithEntries.get(l));
}
});
}
}
}
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
//TODO: Improve
}
return result;
} | [
"public",
"CmsContextMenu",
"getContextMenuForItem",
"(",
"Object",
"itemId",
")",
"{",
"CmsContextMenu",
"result",
"=",
"null",
";",
"try",
"{",
"final",
"Item",
"item",
"=",
"m_container",
".",
"getItem",
"(",
"itemId",
")",
";",
"Property",
"<",
"?",
">",... | Returns the context menu for the table item.
@param itemId the table item.
@return the context menu for the given item. | [
"Returns",
"the",
"context",
"menu",
"for",
"the",
"table",
"item",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L667-L709 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getEditableColumns | public List<TableProperty> getEditableColumns(CmsMessageBundleEditorTypes.EditMode mode) {
return m_editorState.get(mode).getEditableColumns();
} | java | public List<TableProperty> getEditableColumns(CmsMessageBundleEditorTypes.EditMode mode) {
return m_editorState.get(mode).getEditableColumns();
} | [
"public",
"List",
"<",
"TableProperty",
">",
"getEditableColumns",
"(",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
"mode",
")",
"{",
"return",
"m_editorState",
".",
"get",
"(",
"mode",
")",
".",
"getEditableColumns",
"(",
")",
";",
"}"
] | Returns the editable columns for the provided edit mode.
@param mode the edit mode.
@return the editable columns for the provided edit mode. | [
"Returns",
"the",
"editable",
"columns",
"for",
"the",
"provided",
"edit",
"mode",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L725-L728 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getEditedFilePath | public String getEditedFilePath() {
switch (getBundleType()) {
case DESCRIPTOR:
return m_cms.getSitePath(m_desc);
case PROPERTY:
return null != m_lockedBundleFiles.get(getLocale())
? m_cms.getSitePath(m_lockedBundleFiles.get(getLocale()).getFile())
: m_cms.getSitePath(m_resource);
case XML:
return m_cms.getSitePath(m_resource);
default:
throw new IllegalArgumentException();
}
} | java | public String getEditedFilePath() {
switch (getBundleType()) {
case DESCRIPTOR:
return m_cms.getSitePath(m_desc);
case PROPERTY:
return null != m_lockedBundleFiles.get(getLocale())
? m_cms.getSitePath(m_lockedBundleFiles.get(getLocale()).getFile())
: m_cms.getSitePath(m_resource);
case XML:
return m_cms.getSitePath(m_resource);
default:
throw new IllegalArgumentException();
}
} | [
"public",
"String",
"getEditedFilePath",
"(",
")",
"{",
"switch",
"(",
"getBundleType",
"(",
")",
")",
"{",
"case",
"DESCRIPTOR",
":",
"return",
"m_cms",
".",
"getSitePath",
"(",
"m_desc",
")",
";",
"case",
"PROPERTY",
":",
"return",
"null",
"!=",
"m_locke... | Returns the site path for the edited bundle file.
@return the site path for the edited bundle file. | [
"Returns",
"the",
"site",
"path",
"for",
"the",
"edited",
"bundle",
"file",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L735-L749 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.handleChange | public void handleChange(Object propertyId) {
try {
lockOnChange(propertyId);
} catch (CmsException e) {
LOG.debug(e);
}
if (isDescriptorProperty(propertyId)) {
m_descriptorHasChanges = true;
}
if (isBundleProperty(propertyId)) {
m_changedTranslations.add(getLocale());
}
} | java | public void handleChange(Object propertyId) {
try {
lockOnChange(propertyId);
} catch (CmsException e) {
LOG.debug(e);
}
if (isDescriptorProperty(propertyId)) {
m_descriptorHasChanges = true;
}
if (isBundleProperty(propertyId)) {
m_changedTranslations.add(getLocale());
}
} | [
"public",
"void",
"handleChange",
"(",
"Object",
"propertyId",
")",
"{",
"try",
"{",
"lockOnChange",
"(",
"propertyId",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"e",
")",
";",
"}",
"if",
"(",
"isDescriptorPr... | Handles the change of a value in the current translation.
@param propertyId the property id of the column where the value has changed. | [
"Handles",
"the",
"change",
"of",
"a",
"value",
"in",
"the",
"current",
"translation",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L792-L806 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.handleKeyChange | public KeyChangeResult handleKeyChange(EntryChangeEvent event, boolean allLanguages) {
if (m_keyset.getKeySet().contains(event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_DUPLICATED_KEY;
}
if (allLanguages && !renameKeyForAllLanguages(event.getOldValue(), event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_FOR_OTHER_LANGUAGE;
}
return KeyChangeResult.SUCCESS;
} | java | public KeyChangeResult handleKeyChange(EntryChangeEvent event, boolean allLanguages) {
if (m_keyset.getKeySet().contains(event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_DUPLICATED_KEY;
}
if (allLanguages && !renameKeyForAllLanguages(event.getOldValue(), event.getNewValue())) {
m_container.getItem(event.getItemId()).getItemProperty(TableProperty.KEY).setValue(event.getOldValue());
return KeyChangeResult.FAILED_FOR_OTHER_LANGUAGE;
}
return KeyChangeResult.SUCCESS;
} | [
"public",
"KeyChangeResult",
"handleKeyChange",
"(",
"EntryChangeEvent",
"event",
",",
"boolean",
"allLanguages",
")",
"{",
"if",
"(",
"m_keyset",
".",
"getKeySet",
"(",
")",
".",
"contains",
"(",
"event",
".",
"getNewValue",
"(",
")",
")",
")",
"{",
"m_cont... | Handles a key change.
@param event the key change event.
@param allLanguages <code>true</code> for changing the key for all languages, <code>false</code> if the key should be changed only for the current language.
@return result, indicating if the key change was successful. | [
"Handles",
"a",
"key",
"change",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L815-L826 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.handleKeyDeletion | public boolean handleKeyDeletion(final String key) {
if (m_keyset.getKeySet().contains(key)) {
if (removeKeyForAllLanguages(key)) {
m_keyset.removeKey(key);
return true;
} else {
return false;
}
}
return true;
} | java | public boolean handleKeyDeletion(final String key) {
if (m_keyset.getKeySet().contains(key)) {
if (removeKeyForAllLanguages(key)) {
m_keyset.removeKey(key);
return true;
} else {
return false;
}
}
return true;
} | [
"public",
"boolean",
"handleKeyDeletion",
"(",
"final",
"String",
"key",
")",
"{",
"if",
"(",
"m_keyset",
".",
"getKeySet",
"(",
")",
".",
"contains",
"(",
"key",
")",
")",
"{",
"if",
"(",
"removeKeyForAllLanguages",
"(",
"key",
")",
")",
"{",
"m_keyset"... | Handles the deletion of a key.
@param key the deleted key.
@return <code>true</code> if the deletion was successful, <code>false</code> otherwise. | [
"Handles",
"the",
"deletion",
"of",
"a",
"key",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L833-L844 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.publish | public void publish() {
CmsDirectPublishDialogAction action = new CmsDirectPublishDialogAction();
List<CmsResource> resources = getBundleResources();
I_CmsDialogContext context = new A_CmsDialogContext("", ContextType.appToolbar, resources) {
public void focus(CmsUUID structureId) {
//Nothing to do.
}
public List<CmsUUID> getAllStructureIdsInView() {
return null;
}
public void updateUserInfo() {
//Nothing to do.
}
};
action.executeAction(context);
updateLockInformation();
} | java | public void publish() {
CmsDirectPublishDialogAction action = new CmsDirectPublishDialogAction();
List<CmsResource> resources = getBundleResources();
I_CmsDialogContext context = new A_CmsDialogContext("", ContextType.appToolbar, resources) {
public void focus(CmsUUID structureId) {
//Nothing to do.
}
public List<CmsUUID> getAllStructureIdsInView() {
return null;
}
public void updateUserInfo() {
//Nothing to do.
}
};
action.executeAction(context);
updateLockInformation();
} | [
"public",
"void",
"publish",
"(",
")",
"{",
"CmsDirectPublishDialogAction",
"action",
"=",
"new",
"CmsDirectPublishDialogAction",
"(",
")",
";",
"List",
"<",
"CmsResource",
">",
"resources",
"=",
"getBundleResources",
"(",
")",
";",
"I_CmsDialogContext",
"context",
... | Publish the bundle resources directly. | [
"Publish",
"the",
"bundle",
"resources",
"directly",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L904-L928 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.save | public void save() throws CmsException {
if (hasChanges()) {
switch (m_bundleType) {
case PROPERTY:
saveLocalization();
saveToPropertyVfsBundle();
break;
case XML:
saveLocalization();
saveToXmlVfsBundle();
break;
case DESCRIPTOR:
break;
default:
throw new IllegalArgumentException();
}
if (null != m_descFile) {
saveToBundleDescriptor();
}
resetChanges();
}
} | java | public void save() throws CmsException {
if (hasChanges()) {
switch (m_bundleType) {
case PROPERTY:
saveLocalization();
saveToPropertyVfsBundle();
break;
case XML:
saveLocalization();
saveToXmlVfsBundle();
break;
case DESCRIPTOR:
break;
default:
throw new IllegalArgumentException();
}
if (null != m_descFile) {
saveToBundleDescriptor();
}
resetChanges();
}
} | [
"public",
"void",
"save",
"(",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"hasChanges",
"(",
")",
")",
"{",
"switch",
"(",
"m_bundleType",
")",
"{",
"case",
"PROPERTY",
":",
"saveLocalization",
"(",
")",
";",
"saveToPropertyVfsBundle",
"(",
")",
";",
... | Saves the messages for all languages that were opened in the editor.
@throws CmsException thrown if saving fails. | [
"Saves",
"the",
"messages",
"for",
"all",
"languages",
"that",
"were",
"opened",
"in",
"the",
"editor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L935-L962 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.saveAsPropertyBundle | public void saveAsPropertyBundle() throws UnsupportedEncodingException, CmsException, IOException {
switch (m_bundleType) {
case XML:
saveLocalization();
loadAllRemainingLocalizations();
createPropertyVfsBundleFiles();
saveToPropertyVfsBundle();
m_bundleType = BundleType.PROPERTY;
removeXmlBundleFile();
break;
default:
throw new IllegalArgumentException(
"The method should only be called when editing an XMLResourceBundle.");
}
} | java | public void saveAsPropertyBundle() throws UnsupportedEncodingException, CmsException, IOException {
switch (m_bundleType) {
case XML:
saveLocalization();
loadAllRemainingLocalizations();
createPropertyVfsBundleFiles();
saveToPropertyVfsBundle();
m_bundleType = BundleType.PROPERTY;
removeXmlBundleFile();
break;
default:
throw new IllegalArgumentException(
"The method should only be called when editing an XMLResourceBundle.");
}
} | [
"public",
"void",
"saveAsPropertyBundle",
"(",
")",
"throws",
"UnsupportedEncodingException",
",",
"CmsException",
",",
"IOException",
"{",
"switch",
"(",
"m_bundleType",
")",
"{",
"case",
"XML",
":",
"saveLocalization",
"(",
")",
";",
"loadAllRemainingLocalizations",... | Saves the loaded XML bundle as property bundle.
@throws UnsupportedEncodingException thrown if localizations from the XML bundle could not be loaded correctly.
@throws CmsException thrown if any of the interactions with the VFS fails.
@throws IOException thrown if localizations from the XML bundle could not be loaded correctly. | [
"Saves",
"the",
"loaded",
"XML",
"bundle",
"as",
"property",
"bundle",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L970-L987 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.unlock | public void unlock() {
for (Locale l : m_lockedBundleFiles.keySet()) {
LockedFile f = m_lockedBundleFiles.get(l);
f.tryUnlock();
}
if (null != m_descFile) {
m_descFile.tryUnlock();
}
} | java | public void unlock() {
for (Locale l : m_lockedBundleFiles.keySet()) {
LockedFile f = m_lockedBundleFiles.get(l);
f.tryUnlock();
}
if (null != m_descFile) {
m_descFile.tryUnlock();
}
} | [
"public",
"void",
"unlock",
"(",
")",
"{",
"for",
"(",
"Locale",
"l",
":",
"m_lockedBundleFiles",
".",
"keySet",
"(",
")",
")",
"{",
"LockedFile",
"f",
"=",
"m_lockedBundleFiles",
".",
"get",
"(",
"l",
")",
";",
"f",
".",
"tryUnlock",
"(",
")",
";",
... | Unlock all files opened for writing. | [
"Unlock",
"all",
"files",
"opened",
"for",
"writing",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1025-L1034 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getBundleResources | List<CmsResource> getBundleResources() {
List<CmsResource> resources = new ArrayList<>(m_bundleFiles.values());
if (m_desc != null) {
resources.add(m_desc);
}
return resources;
} | java | List<CmsResource> getBundleResources() {
List<CmsResource> resources = new ArrayList<>(m_bundleFiles.values());
if (m_desc != null) {
resources.add(m_desc);
}
return resources;
} | [
"List",
"<",
"CmsResource",
">",
"getBundleResources",
"(",
")",
"{",
"List",
"<",
"CmsResource",
">",
"resources",
"=",
"new",
"ArrayList",
"<>",
"(",
"m_bundleFiles",
".",
"values",
"(",
")",
")",
";",
"if",
"(",
"m_desc",
"!=",
"null",
")",
"{",
"re... | Returns all resources that belong to the bundle
This includes the descriptor if one exists.
@return List of the bundle resources, including the descriptor. | [
"Returns",
"all",
"resources",
"that",
"belong",
"to",
"the",
"bundle",
"This",
"includes",
"the",
"descriptor",
"if",
"one",
"exists",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1042-L1050 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.createAndLockDescriptorFile | private void createAndLockDescriptorFile() throws CmsException {
String sitePath = m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX;
m_desc = m_cms.createResource(
sitePath,
OpenCms.getResourceManager().getResourceType(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString()));
m_descFile = LockedFile.lockResource(m_cms, m_desc);
m_descFile.setCreated(true);
} | java | private void createAndLockDescriptorFile() throws CmsException {
String sitePath = m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX;
m_desc = m_cms.createResource(
sitePath,
OpenCms.getResourceManager().getResourceType(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR.toString()));
m_descFile = LockedFile.lockResource(m_cms, m_desc);
m_descFile.setCreated(true);
} | [
"private",
"void",
"createAndLockDescriptorFile",
"(",
")",
"throws",
"CmsException",
"{",
"String",
"sitePath",
"=",
"m_sitepath",
"+",
"m_basename",
"+",
"CmsMessageBundleEditorTypes",
".",
"Descriptor",
".",
"POSTFIX",
";",
"m_desc",
"=",
"m_cms",
".",
"createRes... | Creates a descriptor for the bundle in the same folder where the bundle files are located.
@throws CmsException thrown if creation fails. | [
"Creates",
"a",
"descriptor",
"for",
"the",
"bundle",
"in",
"the",
"same",
"folder",
"where",
"the",
"bundle",
"files",
"are",
"located",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1069-L1077 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.createContainerForBundleWithDescriptor | private IndexedContainer createContainerForBundleWithDescriptor() throws IOException, CmsException {
IndexedContainer container = new IndexedContainer();
// create properties
container.addContainerProperty(TableProperty.KEY, String.class, "");
container.addContainerProperty(TableProperty.DESCRIPTION, String.class, "");
container.addContainerProperty(TableProperty.DEFAULT, String.class, "");
container.addContainerProperty(TableProperty.TRANSLATION, String.class, "");
// add entries
SortedProperties localization = getLocalization(m_locale);
CmsXmlContentValueSequence messages = m_descContent.getValueSequence(Descriptor.N_MESSAGE, Descriptor.LOCALE);
String descValue;
boolean hasDescription = false;
String defaultValue;
boolean hasDefault = false;
for (int i = 0; i < messages.getElementCount(); i++) {
String prefix = messages.getValue(i).getPath() + "/";
Object itemId = container.addItem();
Item item = container.getItem(itemId);
String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms);
item.getItemProperty(TableProperty.KEY).setValue(key);
String translation = localization.getProperty(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation);
descValue = m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue(
m_cms);
item.getItemProperty(TableProperty.DESCRIPTION).setValue(descValue);
hasDescription = hasDescription || !descValue.isEmpty();
defaultValue = m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue(
m_cms);
item.getItemProperty(TableProperty.DEFAULT).setValue(defaultValue);
hasDefault = hasDefault || !defaultValue.isEmpty();
}
m_hasDefault = hasDefault;
m_hasDescription = hasDescription;
return container;
} | java | private IndexedContainer createContainerForBundleWithDescriptor() throws IOException, CmsException {
IndexedContainer container = new IndexedContainer();
// create properties
container.addContainerProperty(TableProperty.KEY, String.class, "");
container.addContainerProperty(TableProperty.DESCRIPTION, String.class, "");
container.addContainerProperty(TableProperty.DEFAULT, String.class, "");
container.addContainerProperty(TableProperty.TRANSLATION, String.class, "");
// add entries
SortedProperties localization = getLocalization(m_locale);
CmsXmlContentValueSequence messages = m_descContent.getValueSequence(Descriptor.N_MESSAGE, Descriptor.LOCALE);
String descValue;
boolean hasDescription = false;
String defaultValue;
boolean hasDefault = false;
for (int i = 0; i < messages.getElementCount(); i++) {
String prefix = messages.getValue(i).getPath() + "/";
Object itemId = container.addItem();
Item item = container.getItem(itemId);
String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms);
item.getItemProperty(TableProperty.KEY).setValue(key);
String translation = localization.getProperty(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation);
descValue = m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue(
m_cms);
item.getItemProperty(TableProperty.DESCRIPTION).setValue(descValue);
hasDescription = hasDescription || !descValue.isEmpty();
defaultValue = m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue(
m_cms);
item.getItemProperty(TableProperty.DEFAULT).setValue(defaultValue);
hasDefault = hasDefault || !defaultValue.isEmpty();
}
m_hasDefault = hasDefault;
m_hasDescription = hasDescription;
return container;
} | [
"private",
"IndexedContainer",
"createContainerForBundleWithDescriptor",
"(",
")",
"throws",
"IOException",
",",
"CmsException",
"{",
"IndexedContainer",
"container",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"// create properties",
"container",
".",
"addContainerPrope... | Creates the container for a bundle with descriptor.
@return the container for a bundle with descriptor.
@throws IOException thrown if reading the bundle fails.
@throws CmsException thrown if reading the bundle fails. | [
"Creates",
"the",
"container",
"for",
"a",
"bundle",
"with",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1109-L1149 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.createContainerForBundleWithoutDescriptor | private IndexedContainer createContainerForBundleWithoutDescriptor() throws IOException, CmsException {
IndexedContainer container = new IndexedContainer();
// create properties
container.addContainerProperty(TableProperty.KEY, String.class, "");
container.addContainerProperty(TableProperty.TRANSLATION, String.class, "");
// add entries
SortedProperties localization = getLocalization(m_locale);
Set<Object> keySet = m_keyset.getKeySet();
for (Object key : keySet) {
Object itemId = container.addItem();
Item item = container.getItem(itemId);
item.getItemProperty(TableProperty.KEY).setValue(key);
Object translation = localization.get(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation);
}
return container;
} | java | private IndexedContainer createContainerForBundleWithoutDescriptor() throws IOException, CmsException {
IndexedContainer container = new IndexedContainer();
// create properties
container.addContainerProperty(TableProperty.KEY, String.class, "");
container.addContainerProperty(TableProperty.TRANSLATION, String.class, "");
// add entries
SortedProperties localization = getLocalization(m_locale);
Set<Object> keySet = m_keyset.getKeySet();
for (Object key : keySet) {
Object itemId = container.addItem();
Item item = container.getItem(itemId);
item.getItemProperty(TableProperty.KEY).setValue(key);
Object translation = localization.get(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == translation ? "" : translation);
}
return container;
} | [
"private",
"IndexedContainer",
"createContainerForBundleWithoutDescriptor",
"(",
")",
"throws",
"IOException",
",",
"CmsException",
"{",
"IndexedContainer",
"container",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"// create properties",
"container",
".",
"addContainerPr... | Creates the container for a bundle without descriptor.
@return the container for a bundle without descriptor.
@throws IOException thrown if reading the bundle fails.
@throws CmsException thrown if reading the bundle fails. | [
"Creates",
"the",
"container",
"for",
"a",
"bundle",
"without",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1157-L1178 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.createContainerForDescriptorEditing | private IndexedContainer createContainerForDescriptorEditing() {
IndexedContainer container = new IndexedContainer();
// create properties
container.addContainerProperty(TableProperty.KEY, String.class, "");
container.addContainerProperty(TableProperty.DESCRIPTION, String.class, "");
container.addContainerProperty(TableProperty.DEFAULT, String.class, "");
// add entries
CmsXmlContentValueSequence messages = m_descContent.getValueSequence(
"/" + Descriptor.N_MESSAGE,
Descriptor.LOCALE);
for (int i = 0; i < messages.getElementCount(); i++) {
String prefix = messages.getValue(i).getPath() + "/";
Object itemId = container.addItem();
Item item = container.getItem(itemId);
String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms);
item.getItemProperty(TableProperty.KEY).setValue(key);
item.getItemProperty(TableProperty.DESCRIPTION).setValue(
m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue(m_cms));
item.getItemProperty(TableProperty.DEFAULT).setValue(
m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue(m_cms));
}
return container;
} | java | private IndexedContainer createContainerForDescriptorEditing() {
IndexedContainer container = new IndexedContainer();
// create properties
container.addContainerProperty(TableProperty.KEY, String.class, "");
container.addContainerProperty(TableProperty.DESCRIPTION, String.class, "");
container.addContainerProperty(TableProperty.DEFAULT, String.class, "");
// add entries
CmsXmlContentValueSequence messages = m_descContent.getValueSequence(
"/" + Descriptor.N_MESSAGE,
Descriptor.LOCALE);
for (int i = 0; i < messages.getElementCount(); i++) {
String prefix = messages.getValue(i).getPath() + "/";
Object itemId = container.addItem();
Item item = container.getItem(itemId);
String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms);
item.getItemProperty(TableProperty.KEY).setValue(key);
item.getItemProperty(TableProperty.DESCRIPTION).setValue(
m_descContent.getValue(prefix + Descriptor.N_DESCRIPTION, Descriptor.LOCALE).getStringValue(m_cms));
item.getItemProperty(TableProperty.DEFAULT).setValue(
m_descContent.getValue(prefix + Descriptor.N_DEFAULT, Descriptor.LOCALE).getStringValue(m_cms));
}
return container;
} | [
"private",
"IndexedContainer",
"createContainerForDescriptorEditing",
"(",
")",
"{",
"IndexedContainer",
"container",
"=",
"new",
"IndexedContainer",
"(",
")",
";",
"// create properties",
"container",
".",
"addContainerProperty",
"(",
"TableProperty",
".",
"KEY",
",",
... | Creates the container for a bundle descriptor.
@return the container for a bundle descriptor. | [
"Creates",
"the",
"container",
"for",
"a",
"bundle",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1184-L1212 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.createPropertyVfsBundleFiles | private void createPropertyVfsBundleFiles() throws CmsIllegalArgumentException, CmsLoaderException, CmsException {
String bundleFileBasePath = m_sitepath + m_basename + "_";
for (Locale l : m_localizations.keySet()) {
CmsResource res = m_cms.createResource(
bundleFileBasePath + l.toString(),
OpenCms.getResourceManager().getResourceType(
CmsMessageBundleEditorTypes.BundleType.PROPERTY.toString()));
m_bundleFiles.put(l, res);
LockedFile file = LockedFile.lockResource(m_cms, res);
file.setCreated(true);
m_lockedBundleFiles.put(l, file);
m_changedTranslations.add(l);
}
} | java | private void createPropertyVfsBundleFiles() throws CmsIllegalArgumentException, CmsLoaderException, CmsException {
String bundleFileBasePath = m_sitepath + m_basename + "_";
for (Locale l : m_localizations.keySet()) {
CmsResource res = m_cms.createResource(
bundleFileBasePath + l.toString(),
OpenCms.getResourceManager().getResourceType(
CmsMessageBundleEditorTypes.BundleType.PROPERTY.toString()));
m_bundleFiles.put(l, res);
LockedFile file = LockedFile.lockResource(m_cms, res);
file.setCreated(true);
m_lockedBundleFiles.put(l, file);
m_changedTranslations.add(l);
}
} | [
"private",
"void",
"createPropertyVfsBundleFiles",
"(",
")",
"throws",
"CmsIllegalArgumentException",
",",
"CmsLoaderException",
",",
"CmsException",
"{",
"String",
"bundleFileBasePath",
"=",
"m_sitepath",
"+",
"m_basename",
"+",
"\"_\"",
";",
"for",
"(",
"Locale",
"l... | Creates all propertyvfsbundle files for the currently loaded translations.
The method is used to convert xmlvfsbundle files into propertyvfsbundle files.
@throws CmsIllegalArgumentException thrown if resource creation fails.
@throws CmsLoaderException thrown if the propertyvfsbundle type can't be read from the resource manager.
@throws CmsException thrown if creation, type retrieval or locking fails. | [
"Creates",
"all",
"propertyvfsbundle",
"files",
"for",
"the",
"currently",
"loaded",
"translations",
".",
"The",
"method",
"is",
"used",
"to",
"convert",
"xmlvfsbundle",
"files",
"into",
"propertyvfsbundle",
"files",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1222-L1237 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getDefaultState | private EditorState getDefaultState() {
List<TableProperty> cols = new ArrayList<TableProperty>(1);
cols.add(TableProperty.TRANSLATION);
return new EditorState(cols, false);
} | java | private EditorState getDefaultState() {
List<TableProperty> cols = new ArrayList<TableProperty>(1);
cols.add(TableProperty.TRANSLATION);
return new EditorState(cols, false);
} | [
"private",
"EditorState",
"getDefaultState",
"(",
")",
"{",
"List",
"<",
"TableProperty",
">",
"cols",
"=",
"new",
"ArrayList",
"<",
"TableProperty",
">",
"(",
"1",
")",
";",
"cols",
".",
"add",
"(",
"TableProperty",
".",
"TRANSLATION",
")",
";",
"return",... | Creates the default editor state for editing a bundle with descriptor.
@return the default editor state for editing a bundle with descriptor. | [
"Creates",
"the",
"default",
"editor",
"state",
"for",
"editing",
"a",
"bundle",
"with",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1243-L1249 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getLocalization | private SortedProperties getLocalization(Locale locale) throws IOException, CmsException {
if (null == m_localizations.get(locale)) {
switch (m_bundleType) {
case PROPERTY:
loadLocalizationFromPropertyBundle(locale);
break;
case XML:
loadLocalizationFromXmlBundle(locale);
break;
case DESCRIPTOR:
return null;
default:
break;
}
}
return m_localizations.get(locale);
} | java | private SortedProperties getLocalization(Locale locale) throws IOException, CmsException {
if (null == m_localizations.get(locale)) {
switch (m_bundleType) {
case PROPERTY:
loadLocalizationFromPropertyBundle(locale);
break;
case XML:
loadLocalizationFromXmlBundle(locale);
break;
case DESCRIPTOR:
return null;
default:
break;
}
}
return m_localizations.get(locale);
} | [
"private",
"SortedProperties",
"getLocalization",
"(",
"Locale",
"locale",
")",
"throws",
"IOException",
",",
"CmsException",
"{",
"if",
"(",
"null",
"==",
"m_localizations",
".",
"get",
"(",
"locale",
")",
")",
"{",
"switch",
"(",
"m_bundleType",
")",
"{",
... | Reads the current properties for a language. If not already done, the properties are read from the respective file.
@param locale the locale for which the localization should be returned.
@return the properties.
@throws IOException thrown if reading the properties from a file fails.
@throws CmsException thrown if reading the properties from a file fails. | [
"Reads",
"the",
"current",
"properties",
"for",
"a",
"language",
".",
"If",
"not",
"already",
"done",
"the",
"properties",
"are",
"read",
"from",
"the",
"respective",
"file",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1275-L1292 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.getMasterState | private EditorState getMasterState() {
List<TableProperty> cols = new ArrayList<TableProperty>(4);
cols.add(TableProperty.KEY);
cols.add(TableProperty.DESCRIPTION);
cols.add(TableProperty.DEFAULT);
cols.add(TableProperty.TRANSLATION);
return new EditorState(cols, true);
} | java | private EditorState getMasterState() {
List<TableProperty> cols = new ArrayList<TableProperty>(4);
cols.add(TableProperty.KEY);
cols.add(TableProperty.DESCRIPTION);
cols.add(TableProperty.DEFAULT);
cols.add(TableProperty.TRANSLATION);
return new EditorState(cols, true);
} | [
"private",
"EditorState",
"getMasterState",
"(",
")",
"{",
"List",
"<",
"TableProperty",
">",
"cols",
"=",
"new",
"ArrayList",
"<",
"TableProperty",
">",
"(",
"4",
")",
";",
"cols",
".",
"add",
"(",
"TableProperty",
".",
"KEY",
")",
";",
"cols",
".",
"... | Returns the master mode's editor state for editing a bundle with descriptor.
@return the master mode's editor state for editing a bundle with descriptor. | [
"Returns",
"the",
"master",
"mode",
"s",
"editor",
"state",
"for",
"editing",
"a",
"bundle",
"with",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1298-L1306 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initBundleType | private CmsMessageBundleEditorTypes.BundleType initBundleType() {
String resourceTypeName = OpenCms.getResourceManager().getResourceType(m_resource).getTypeName();
return CmsMessageBundleEditorTypes.BundleType.toBundleType(resourceTypeName);
} | java | private CmsMessageBundleEditorTypes.BundleType initBundleType() {
String resourceTypeName = OpenCms.getResourceManager().getResourceType(m_resource).getTypeName();
return CmsMessageBundleEditorTypes.BundleType.toBundleType(resourceTypeName);
} | [
"private",
"CmsMessageBundleEditorTypes",
".",
"BundleType",
"initBundleType",
"(",
")",
"{",
"String",
"resourceTypeName",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"m_resource",
")",
".",
"getTypeName",
"(",
")",
";",
"ret... | Init the bundle type member variable.
@return the bundle type of the opened resource. | [
"Init",
"the",
"bundle",
"type",
"member",
"variable",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1312-L1316 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initDescriptor | private void initDescriptor() throws CmsXmlException, CmsException {
if (m_bundleType.equals(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR)) {
m_desc = m_resource;
} else {
//First try to read from same folder like resource, if it fails use CmsMessageBundleEditorTypes.getDescriptor()
try {
m_desc = m_cms.readResource(m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX);
} catch (CmsVfsResourceNotFoundException e) {
m_desc = CmsMessageBundleEditorTypes.getDescriptor(m_cms, m_basename);
}
}
unmarshalDescriptor();
} | java | private void initDescriptor() throws CmsXmlException, CmsException {
if (m_bundleType.equals(CmsMessageBundleEditorTypes.BundleType.DESCRIPTOR)) {
m_desc = m_resource;
} else {
//First try to read from same folder like resource, if it fails use CmsMessageBundleEditorTypes.getDescriptor()
try {
m_desc = m_cms.readResource(m_sitepath + m_basename + CmsMessageBundleEditorTypes.Descriptor.POSTFIX);
} catch (CmsVfsResourceNotFoundException e) {
m_desc = CmsMessageBundleEditorTypes.getDescriptor(m_cms, m_basename);
}
}
unmarshalDescriptor();
} | [
"private",
"void",
"initDescriptor",
"(",
")",
"throws",
"CmsXmlException",
",",
"CmsException",
"{",
"if",
"(",
"m_bundleType",
".",
"equals",
"(",
"CmsMessageBundleEditorTypes",
".",
"BundleType",
".",
"DESCRIPTOR",
")",
")",
"{",
"m_desc",
"=",
"m_resource",
... | Reads the bundle descriptor, sets m_desc and m_descContent.
@throws CmsXmlException thrown when unmarshalling fails.
@throws CmsException thrown when reading the resource fails or several bundle descriptors for the bundle exist. | [
"Reads",
"the",
"bundle",
"descriptor",
"sets",
"m_desc",
"and",
"m_descContent",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1323-L1337 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initEditorStates | private void initEditorStates() {
m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>();
List<TableProperty> cols = null;
switch (m_bundleType) {
case PROPERTY:
case XML:
if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState());
if (hasMasterMode()) { // the bundle descriptor is editable
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState());
}
} else { // no bundle descriptor given - implies no master mode
cols = new ArrayList<TableProperty>(1);
cols.add(TableProperty.KEY);
cols.add(TableProperty.TRANSLATION);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
}
break;
case DESCRIPTOR:
cols = new ArrayList<TableProperty>(3);
cols.add(TableProperty.KEY);
cols.add(TableProperty.DESCRIPTION);
cols.add(TableProperty.DEFAULT);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
break;
default:
throw new IllegalArgumentException();
}
} | java | private void initEditorStates() {
m_editorState = new HashMap<CmsMessageBundleEditorTypes.EditMode, EditorState>();
List<TableProperty> cols = null;
switch (m_bundleType) {
case PROPERTY:
case XML:
if (hasDescriptor()) { // bundle descriptor is present, keys are not editable in default mode, maybe master mode is available
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, getDefaultState());
if (hasMasterMode()) { // the bundle descriptor is editable
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.MASTER, getMasterState());
}
} else { // no bundle descriptor given - implies no master mode
cols = new ArrayList<TableProperty>(1);
cols.add(TableProperty.KEY);
cols.add(TableProperty.TRANSLATION);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
}
break;
case DESCRIPTOR:
cols = new ArrayList<TableProperty>(3);
cols.add(TableProperty.KEY);
cols.add(TableProperty.DESCRIPTION);
cols.add(TableProperty.DEFAULT);
m_editorState.put(CmsMessageBundleEditorTypes.EditMode.DEFAULT, new EditorState(cols, true));
break;
default:
throw new IllegalArgumentException();
}
} | [
"private",
"void",
"initEditorStates",
"(",
")",
"{",
"m_editorState",
"=",
"new",
"HashMap",
"<",
"CmsMessageBundleEditorTypes",
".",
"EditMode",
",",
"EditorState",
">",
"(",
")",
";",
"List",
"<",
"TableProperty",
">",
"cols",
"=",
"null",
";",
"switch",
... | Initializes the editor states for the different modes, depending on the type of the opened file. | [
"Initializes",
"the",
"editor",
"states",
"for",
"the",
"different",
"modes",
"depending",
"on",
"the",
"type",
"of",
"the",
"opened",
"file",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1342-L1372 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initHasMasterMode | private void initHasMasterMode() throws CmsException {
if (hasDescriptor()
&& m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) {
m_hasMasterMode = true;
} else {
m_hasMasterMode = false;
}
} | java | private void initHasMasterMode() throws CmsException {
if (hasDescriptor()
&& m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) {
m_hasMasterMode = true;
} else {
m_hasMasterMode = false;
}
} | [
"private",
"void",
"initHasMasterMode",
"(",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"hasDescriptor",
"(",
")",
"&&",
"m_cms",
".",
"hasPermissions",
"(",
"m_desc",
",",
"CmsPermissionSet",
".",
"ACCESS_WRITE",
",",
"false",
",",
"CmsResourceFilter",
".",... | Initializes the information on an available master mode.
@throws CmsException thrown if the write permission check on the bundle descriptor fails. | [
"Initializes",
"the",
"information",
"on",
"an",
"available",
"master",
"mode",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1378-L1386 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initKeySetForXmlBundle | private void initKeySetForXmlBundle() {
// consider only available locales
for (Locale l : m_locales) {
if (m_xmlBundle.hasLocale(l)) {
Set<Object> keys = new HashSet<Object>();
for (I_CmsXmlContentValue msg : m_xmlBundle.getValueSequence("Message", l).getValues()) {
String msgpath = msg.getPath();
keys.add(m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", l));
}
m_keyset.updateKeySet(null, keys);
}
}
} | java | private void initKeySetForXmlBundle() {
// consider only available locales
for (Locale l : m_locales) {
if (m_xmlBundle.hasLocale(l)) {
Set<Object> keys = new HashSet<Object>();
for (I_CmsXmlContentValue msg : m_xmlBundle.getValueSequence("Message", l).getValues()) {
String msgpath = msg.getPath();
keys.add(m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", l));
}
m_keyset.updateKeySet(null, keys);
}
}
} | [
"private",
"void",
"initKeySetForXmlBundle",
"(",
")",
"{",
"// consider only available locales",
"for",
"(",
"Locale",
"l",
":",
"m_locales",
")",
"{",
"if",
"(",
"m_xmlBundle",
".",
"hasLocale",
"(",
"l",
")",
")",
"{",
"Set",
"<",
"Object",
">",
"keys",
... | Initialize the key set for an xml bundle. | [
"Initialize",
"the",
"key",
"set",
"for",
"an",
"xml",
"bundle",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1391-L1405 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initLocales | private Collection<Locale> initLocales() {
Collection<Locale> locales = null;
switch (m_bundleType) {
case DESCRIPTOR:
locales = new ArrayList<Locale>(1);
locales.add(Descriptor.LOCALE);
break;
case XML:
case PROPERTY:
locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource);
break;
default:
throw new IllegalArgumentException();
}
return locales;
} | java | private Collection<Locale> initLocales() {
Collection<Locale> locales = null;
switch (m_bundleType) {
case DESCRIPTOR:
locales = new ArrayList<Locale>(1);
locales.add(Descriptor.LOCALE);
break;
case XML:
case PROPERTY:
locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource);
break;
default:
throw new IllegalArgumentException();
}
return locales;
} | [
"private",
"Collection",
"<",
"Locale",
">",
"initLocales",
"(",
")",
"{",
"Collection",
"<",
"Locale",
">",
"locales",
"=",
"null",
";",
"switch",
"(",
"m_bundleType",
")",
"{",
"case",
"DESCRIPTOR",
":",
"locales",
"=",
"new",
"ArrayList",
"<",
"Locale",... | Initializes the locales that can be selected via the language switcher in the bundle editor.
@return the locales for which keys can be edited. | [
"Initializes",
"the",
"locales",
"that",
"can",
"be",
"selected",
"via",
"the",
"language",
"switcher",
"in",
"the",
"bundle",
"editor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1411-L1428 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initPropertyBundle | private void initPropertyBundle() throws CmsLoaderException, CmsException, IOException {
for (Locale l : m_locales) {
String filePath = m_sitepath + m_basename + "_" + l.toString();
CmsResource resource = null;
if (m_cms.existsResource(
filePath,
CmsResourceFilter.requireType(
OpenCms.getResourceManager().getResourceType(BundleType.PROPERTY.toString())))) {
resource = m_cms.readResource(filePath);
SortedProperties props = new SortedProperties();
CmsFile file = m_cms.readFile(resource);
props.load(
new InputStreamReader(
new ByteArrayInputStream(file.getContents()),
CmsFileUtil.getEncoding(m_cms, file)));
m_keyset.updateKeySet(null, props.keySet());
m_bundleFiles.put(l, resource);
}
}
} | java | private void initPropertyBundle() throws CmsLoaderException, CmsException, IOException {
for (Locale l : m_locales) {
String filePath = m_sitepath + m_basename + "_" + l.toString();
CmsResource resource = null;
if (m_cms.existsResource(
filePath,
CmsResourceFilter.requireType(
OpenCms.getResourceManager().getResourceType(BundleType.PROPERTY.toString())))) {
resource = m_cms.readResource(filePath);
SortedProperties props = new SortedProperties();
CmsFile file = m_cms.readFile(resource);
props.load(
new InputStreamReader(
new ByteArrayInputStream(file.getContents()),
CmsFileUtil.getEncoding(m_cms, file)));
m_keyset.updateKeySet(null, props.keySet());
m_bundleFiles.put(l, resource);
}
}
} | [
"private",
"void",
"initPropertyBundle",
"(",
")",
"throws",
"CmsLoaderException",
",",
"CmsException",
",",
"IOException",
"{",
"for",
"(",
"Locale",
"l",
":",
"m_locales",
")",
"{",
"String",
"filePath",
"=",
"m_sitepath",
"+",
"m_basename",
"+",
"\"_\"",
"+... | Initialization necessary for editing a property bundle.
@throws CmsLoaderException thrown if loading a bundle file fails.
@throws CmsException thrown if loading a bundle file fails.
@throws IOException thrown if loading a bundle file fails. | [
"Initialization",
"necessary",
"for",
"editing",
"a",
"property",
"bundle",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1437-L1458 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.initXmlBundle | private void initXmlBundle() throws CmsException {
CmsFile file = m_cms.readFile(m_resource);
m_bundleFiles.put(null, m_resource);
m_xmlBundle = CmsXmlContentFactory.unmarshal(m_cms, file);
initKeySetForXmlBundle();
} | java | private void initXmlBundle() throws CmsException {
CmsFile file = m_cms.readFile(m_resource);
m_bundleFiles.put(null, m_resource);
m_xmlBundle = CmsXmlContentFactory.unmarshal(m_cms, file);
initKeySetForXmlBundle();
} | [
"private",
"void",
"initXmlBundle",
"(",
")",
"throws",
"CmsException",
"{",
"CmsFile",
"file",
"=",
"m_cms",
".",
"readFile",
"(",
"m_resource",
")",
";",
"m_bundleFiles",
".",
"put",
"(",
"null",
",",
"m_resource",
")",
";",
"m_xmlBundle",
"=",
"CmsXmlCont... | Unmarshals the XML content and adds the file to the bundle files.
@throws CmsException thrown if reading the file or unmarshaling fails. | [
"Unmarshals",
"the",
"XML",
"content",
"and",
"adds",
"the",
"file",
"to",
"the",
"bundle",
"files",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1464-L1471 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.isBundleProperty | private boolean isBundleProperty(Object property) {
return (property.equals(TableProperty.KEY) || property.equals(TableProperty.TRANSLATION));
} | java | private boolean isBundleProperty(Object property) {
return (property.equals(TableProperty.KEY) || property.equals(TableProperty.TRANSLATION));
} | [
"private",
"boolean",
"isBundleProperty",
"(",
"Object",
"property",
")",
"{",
"return",
"(",
"property",
".",
"equals",
"(",
"TableProperty",
".",
"KEY",
")",
"||",
"property",
".",
"equals",
"(",
"TableProperty",
".",
"TRANSLATION",
")",
")",
";",
"}"
] | Check if values in the column "property" are written to the bundle files.
@param property the property id of the table column.
@return a flag, indicating if values of the table column are stored to the bundle files. | [
"Check",
"if",
"values",
"in",
"the",
"column",
"property",
"are",
"written",
"to",
"the",
"bundle",
"files",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1478-L1481 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.isDescriptorProperty | private boolean isDescriptorProperty(Object property) {
return (getBundleType().equals(BundleType.DESCRIPTOR)
|| (hasDescriptor()
&& (property.equals(TableProperty.KEY)
|| property.equals(TableProperty.DEFAULT)
|| property.equals(TableProperty.DESCRIPTION))));
} | java | private boolean isDescriptorProperty(Object property) {
return (getBundleType().equals(BundleType.DESCRIPTOR)
|| (hasDescriptor()
&& (property.equals(TableProperty.KEY)
|| property.equals(TableProperty.DEFAULT)
|| property.equals(TableProperty.DESCRIPTION))));
} | [
"private",
"boolean",
"isDescriptorProperty",
"(",
"Object",
"property",
")",
"{",
"return",
"(",
"getBundleType",
"(",
")",
".",
"equals",
"(",
"BundleType",
".",
"DESCRIPTOR",
")",
"||",
"(",
"hasDescriptor",
"(",
")",
"&&",
"(",
"property",
".",
"equals",... | Check if values in the column "property" are written to the bundle descriptor.
@param property the property id of the table column.
@return a flag, indicating if values of the table column are stored to the bundle descriptor. | [
"Check",
"if",
"values",
"in",
"the",
"column",
"property",
"are",
"written",
"to",
"the",
"bundle",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1488-L1495 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.loadAllRemainingLocalizations | private void loadAllRemainingLocalizations() throws CmsException, UnsupportedEncodingException, IOException {
if (!m_alreadyLoadedAllLocalizations) {
// is only necessary for property bundles
if (m_bundleType.equals(BundleType.PROPERTY)) {
for (Locale l : m_locales) {
if (null == m_localizations.get(l)) {
CmsResource resource = m_bundleFiles.get(l);
if (resource != null) {
CmsFile file = m_cms.readFile(resource);
m_bundleFiles.put(l, file);
SortedProperties props = new SortedProperties();
props.load(
new InputStreamReader(
new ByteArrayInputStream(file.getContents()),
CmsFileUtil.getEncoding(m_cms, file)));
m_localizations.put(l, props);
}
}
}
}
if (m_bundleType.equals(BundleType.XML)) {
for (Locale l : m_locales) {
if (null == m_localizations.get(l)) {
loadLocalizationFromXmlBundle(l);
}
}
}
m_alreadyLoadedAllLocalizations = true;
}
} | java | private void loadAllRemainingLocalizations() throws CmsException, UnsupportedEncodingException, IOException {
if (!m_alreadyLoadedAllLocalizations) {
// is only necessary for property bundles
if (m_bundleType.equals(BundleType.PROPERTY)) {
for (Locale l : m_locales) {
if (null == m_localizations.get(l)) {
CmsResource resource = m_bundleFiles.get(l);
if (resource != null) {
CmsFile file = m_cms.readFile(resource);
m_bundleFiles.put(l, file);
SortedProperties props = new SortedProperties();
props.load(
new InputStreamReader(
new ByteArrayInputStream(file.getContents()),
CmsFileUtil.getEncoding(m_cms, file)));
m_localizations.put(l, props);
}
}
}
}
if (m_bundleType.equals(BundleType.XML)) {
for (Locale l : m_locales) {
if (null == m_localizations.get(l)) {
loadLocalizationFromXmlBundle(l);
}
}
}
m_alreadyLoadedAllLocalizations = true;
}
} | [
"private",
"void",
"loadAllRemainingLocalizations",
"(",
")",
"throws",
"CmsException",
",",
"UnsupportedEncodingException",
",",
"IOException",
"{",
"if",
"(",
"!",
"m_alreadyLoadedAllLocalizations",
")",
"{",
"// is only necessary for property bundles",
"if",
"(",
"m_bund... | Loads all localizations not already loaded.
@throws CmsException thrown if locking a file fails.
@throws UnsupportedEncodingException thrown if reading a file fails.
@throws IOException thrown if reading a file fails. | [
"Loads",
"all",
"localizations",
"not",
"already",
"loaded",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1503-L1534 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.loadLocalizationFromXmlBundle | private void loadLocalizationFromXmlBundle(Locale locale) {
CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale);
SortedProperties props = new SortedProperties();
if (null != messages) {
for (I_CmsXmlContentValue msg : messages.getValues()) {
String msgpath = msg.getPath();
props.put(
m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale),
m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale));
}
}
m_localizations.put(locale, props);
} | java | private void loadLocalizationFromXmlBundle(Locale locale) {
CmsXmlContentValueSequence messages = m_xmlBundle.getValueSequence("Message", locale);
SortedProperties props = new SortedProperties();
if (null != messages) {
for (I_CmsXmlContentValue msg : messages.getValues()) {
String msgpath = msg.getPath();
props.put(
m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", locale),
m_xmlBundle.getStringValue(m_cms, msgpath + "/Value", locale));
}
}
m_localizations.put(locale, props);
} | [
"private",
"void",
"loadLocalizationFromXmlBundle",
"(",
"Locale",
"locale",
")",
"{",
"CmsXmlContentValueSequence",
"messages",
"=",
"m_xmlBundle",
".",
"getValueSequence",
"(",
"\"Message\"",
",",
"locale",
")",
";",
"SortedProperties",
"props",
"=",
"new",
"SortedP... | Loads the localization for the current locale from a bundle of type xmlvfsbundle.
It assumes, the content has already been unmarshalled before.
@param locale the locale for which the localization should be loaded | [
"Loads",
"the",
"localization",
"for",
"the",
"current",
"locale",
"from",
"a",
"bundle",
"of",
"type",
"xmlvfsbundle",
".",
"It",
"assumes",
"the",
"content",
"has",
"already",
"been",
"unmarshalled",
"before",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1584-L1597 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.lockDescriptor | private void lockDescriptor() throws CmsException {
if ((null == m_descFile) && (null != m_desc)) {
m_descFile = LockedFile.lockResource(m_cms, m_desc);
}
} | java | private void lockDescriptor() throws CmsException {
if ((null == m_descFile) && (null != m_desc)) {
m_descFile = LockedFile.lockResource(m_cms, m_desc);
}
} | [
"private",
"void",
"lockDescriptor",
"(",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"(",
"null",
"==",
"m_descFile",
")",
"&&",
"(",
"null",
"!=",
"m_desc",
")",
")",
"{",
"m_descFile",
"=",
"LockedFile",
".",
"lockResource",
"(",
"m_cms",
",",
"m_d... | Locks the bundle descriptor.
@throws CmsException thrown if locking fails. | [
"Locks",
"the",
"bundle",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1617-L1622 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.lockLocalization | private void lockLocalization(Locale l) throws CmsException {
if (null == m_lockedBundleFiles.get(l)) {
LockedFile lf = LockedFile.lockResource(m_cms, m_bundleFiles.get(l));
m_lockedBundleFiles.put(l, lf);
}
} | java | private void lockLocalization(Locale l) throws CmsException {
if (null == m_lockedBundleFiles.get(l)) {
LockedFile lf = LockedFile.lockResource(m_cms, m_bundleFiles.get(l));
m_lockedBundleFiles.put(l, lf);
}
} | [
"private",
"void",
"lockLocalization",
"(",
"Locale",
"l",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"null",
"==",
"m_lockedBundleFiles",
".",
"get",
"(",
"l",
")",
")",
"{",
"LockedFile",
"lf",
"=",
"LockedFile",
".",
"lockResource",
"(",
"m_cms",
",... | Locks the bundle file that contains the translation for the provided locale.
@param l the locale for which the bundle file should be locked.
@throws CmsException thrown if locking fails. | [
"Locks",
"the",
"bundle",
"file",
"that",
"contains",
"the",
"translation",
"for",
"the",
"provided",
"locale",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1629-L1636 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.lockOnChange | private void lockOnChange(Object propertyId) throws CmsException {
if (isDescriptorProperty(propertyId)) {
lockDescriptor();
} else {
Locale l = m_bundleType.equals(BundleType.PROPERTY) ? m_locale : null;
lockLocalization(l);
}
} | java | private void lockOnChange(Object propertyId) throws CmsException {
if (isDescriptorProperty(propertyId)) {
lockDescriptor();
} else {
Locale l = m_bundleType.equals(BundleType.PROPERTY) ? m_locale : null;
lockLocalization(l);
}
} | [
"private",
"void",
"lockOnChange",
"(",
"Object",
"propertyId",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"isDescriptorProperty",
"(",
"propertyId",
")",
")",
"{",
"lockDescriptor",
"(",
")",
";",
"}",
"else",
"{",
"Locale",
"l",
"=",
"m_bundleType",
".... | Lock a file lazily, if a value that should be written to the file has changed.
@param propertyId the table column in which the value has changed (e.g., KEY, TRANSLATION, ...)
@throws CmsException thrown if locking fails. | [
"Lock",
"a",
"file",
"lazily",
"if",
"a",
"value",
"that",
"should",
"be",
"written",
"to",
"the",
"file",
"has",
"changed",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1643-L1652 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.removeKeyForAllLanguages | private boolean removeKeyForAllLanguages(String key) {
try {
if (hasDescriptor()) {
lockDescriptor();
}
loadAllRemainingLocalizations();
lockAllLocalizations(key);
} catch (CmsException | IOException e) {
LOG.warn("Not able lock all localications for bundle.", e);
return false;
}
if (!hasDescriptor()) {
for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) {
SortedProperties localization = entry.getValue();
if (localization.containsKey(key)) {
localization.remove(key);
m_changedTranslations.add(entry.getKey());
}
}
}
return true;
} | java | private boolean removeKeyForAllLanguages(String key) {
try {
if (hasDescriptor()) {
lockDescriptor();
}
loadAllRemainingLocalizations();
lockAllLocalizations(key);
} catch (CmsException | IOException e) {
LOG.warn("Not able lock all localications for bundle.", e);
return false;
}
if (!hasDescriptor()) {
for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) {
SortedProperties localization = entry.getValue();
if (localization.containsKey(key)) {
localization.remove(key);
m_changedTranslations.add(entry.getKey());
}
}
}
return true;
} | [
"private",
"boolean",
"removeKeyForAllLanguages",
"(",
"String",
"key",
")",
"{",
"try",
"{",
"if",
"(",
"hasDescriptor",
"(",
")",
")",
"{",
"lockDescriptor",
"(",
")",
";",
"}",
"loadAllRemainingLocalizations",
"(",
")",
";",
"lockAllLocalizations",
"(",
"ke... | Remove a key for all language versions. If a descriptor is present, the key is only removed in the descriptor.
@param key the key to remove.
@return <code>true</code> if removing was successful, <code>false</code> otherwise. | [
"Remove",
"a",
"key",
"for",
"all",
"language",
"versions",
".",
"If",
"a",
"descriptor",
"is",
"present",
"the",
"key",
"is",
"only",
"removed",
"in",
"the",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1660-L1683 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.removeXmlBundleFile | private void removeXmlBundleFile() throws CmsException {
lockLocalization(null);
m_cms.deleteResource(m_resource, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_resource = null;
} | java | private void removeXmlBundleFile() throws CmsException {
lockLocalization(null);
m_cms.deleteResource(m_resource, CmsResource.DELETE_PRESERVE_SIBLINGS);
m_resource = null;
} | [
"private",
"void",
"removeXmlBundleFile",
"(",
")",
"throws",
"CmsException",
"{",
"lockLocalization",
"(",
"null",
")",
";",
"m_cms",
".",
"deleteResource",
"(",
"m_resource",
",",
"CmsResource",
".",
"DELETE_PRESERVE_SIBLINGS",
")",
";",
"m_resource",
"=",
"null... | Deletes the VFS XML bundle file.
@throws CmsException thrown if the delete operation fails. | [
"Deletes",
"the",
"VFS",
"XML",
"bundle",
"file",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1689-L1695 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.renameKeyForAllLanguages | private boolean renameKeyForAllLanguages(String oldKey, String newKey) {
try {
loadAllRemainingLocalizations();
lockAllLocalizations(oldKey);
if (hasDescriptor()) {
lockDescriptor();
}
} catch (CmsException | IOException e) {
LOG.error(e.getLocalizedMessage(), e);
return false;
}
for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) {
SortedProperties localization = entry.getValue();
if (localization.containsKey(oldKey)) {
String value = localization.getProperty(oldKey);
localization.remove(oldKey);
localization.put(newKey, value);
m_changedTranslations.add(entry.getKey());
}
}
if (hasDescriptor()) {
CmsXmlContentValueSequence messages = m_descContent.getValueSequence(
Descriptor.N_MESSAGE,
Descriptor.LOCALE);
for (int i = 0; i < messages.getElementCount(); i++) {
String prefix = messages.getValue(i).getPath() + "/";
String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms);
if (key == oldKey) {
m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).setStringValue(m_cms, newKey);
break;
}
}
m_descriptorHasChanges = true;
}
m_keyset.renameKey(oldKey, newKey);
return true;
} | java | private boolean renameKeyForAllLanguages(String oldKey, String newKey) {
try {
loadAllRemainingLocalizations();
lockAllLocalizations(oldKey);
if (hasDescriptor()) {
lockDescriptor();
}
} catch (CmsException | IOException e) {
LOG.error(e.getLocalizedMessage(), e);
return false;
}
for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) {
SortedProperties localization = entry.getValue();
if (localization.containsKey(oldKey)) {
String value = localization.getProperty(oldKey);
localization.remove(oldKey);
localization.put(newKey, value);
m_changedTranslations.add(entry.getKey());
}
}
if (hasDescriptor()) {
CmsXmlContentValueSequence messages = m_descContent.getValueSequence(
Descriptor.N_MESSAGE,
Descriptor.LOCALE);
for (int i = 0; i < messages.getElementCount(); i++) {
String prefix = messages.getValue(i).getPath() + "/";
String key = m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).getStringValue(m_cms);
if (key == oldKey) {
m_descContent.getValue(prefix + Descriptor.N_KEY, Descriptor.LOCALE).setStringValue(m_cms, newKey);
break;
}
}
m_descriptorHasChanges = true;
}
m_keyset.renameKey(oldKey, newKey);
return true;
} | [
"private",
"boolean",
"renameKeyForAllLanguages",
"(",
"String",
"oldKey",
",",
"String",
"newKey",
")",
"{",
"try",
"{",
"loadAllRemainingLocalizations",
"(",
")",
";",
"lockAllLocalizations",
"(",
"oldKey",
")",
";",
"if",
"(",
"hasDescriptor",
"(",
")",
")",
... | Rename a key for all languages.
@param oldKey the key to rename
@param newKey the new key name
@return <code>true</code> if renaming was successful, <code>false</code> otherwise. | [
"Rename",
"a",
"key",
"for",
"all",
"languages",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1703-L1741 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.replaceValues | private boolean replaceValues(Locale locale) {
try {
SortedProperties localization = getLocalization(locale);
if (hasDescriptor()) {
for (Object itemId : m_container.getItemIds()) {
Item item = m_container.getItem(itemId);
String key = item.getItemProperty(TableProperty.KEY).getValue().toString();
Object value = localization.get(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value);
}
} else {
m_container.removeAllItems();
Set<Object> keyset = m_keyset.getKeySet();
for (Object key : keyset) {
Object itemId = m_container.addItem();
Item item = m_container.getItem(itemId);
item.getItemProperty(TableProperty.KEY).setValue(key);
Object value = localization.get(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value);
}
if (m_container.getItemIds().isEmpty()) {
m_container.addItem();
}
}
return true;
} catch (IOException | CmsException e) {
// The problem should typically be a problem with locking or reading the file containing the translation.
// This should be reported in the editor, if false is returned here.
return false;
}
} | java | private boolean replaceValues(Locale locale) {
try {
SortedProperties localization = getLocalization(locale);
if (hasDescriptor()) {
for (Object itemId : m_container.getItemIds()) {
Item item = m_container.getItem(itemId);
String key = item.getItemProperty(TableProperty.KEY).getValue().toString();
Object value = localization.get(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value);
}
} else {
m_container.removeAllItems();
Set<Object> keyset = m_keyset.getKeySet();
for (Object key : keyset) {
Object itemId = m_container.addItem();
Item item = m_container.getItem(itemId);
item.getItemProperty(TableProperty.KEY).setValue(key);
Object value = localization.get(key);
item.getItemProperty(TableProperty.TRANSLATION).setValue(null == value ? "" : value);
}
if (m_container.getItemIds().isEmpty()) {
m_container.addItem();
}
}
return true;
} catch (IOException | CmsException e) {
// The problem should typically be a problem with locking or reading the file containing the translation.
// This should be reported in the editor, if false is returned here.
return false;
}
} | [
"private",
"boolean",
"replaceValues",
"(",
"Locale",
"locale",
")",
"{",
"try",
"{",
"SortedProperties",
"localization",
"=",
"getLocalization",
"(",
"locale",
")",
";",
"if",
"(",
"hasDescriptor",
"(",
")",
")",
"{",
"for",
"(",
"Object",
"itemId",
":",
... | Replaces the translations in an existing container with the translations for the provided locale.
@param locale the locale for which translations should be loaded.
@return <code>true</code> if replacing succeeded, <code>false</code> otherwise. | [
"Replaces",
"the",
"translations",
"in",
"an",
"existing",
"container",
"with",
"the",
"translations",
"for",
"the",
"provided",
"locale",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1748-L1779 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.saveLocalization | private void saveLocalization() {
SortedProperties localization = new SortedProperties();
for (Object itemId : m_container.getItemIds()) {
Item item = m_container.getItem(itemId);
String key = item.getItemProperty(TableProperty.KEY).getValue().toString();
String value = item.getItemProperty(TableProperty.TRANSLATION).getValue().toString();
if (!(key.isEmpty() || value.isEmpty())) {
localization.put(key, value);
}
}
m_keyset.updateKeySet(m_localizations.get(m_locale).keySet(), localization.keySet());
m_localizations.put(m_locale, localization);
} | java | private void saveLocalization() {
SortedProperties localization = new SortedProperties();
for (Object itemId : m_container.getItemIds()) {
Item item = m_container.getItem(itemId);
String key = item.getItemProperty(TableProperty.KEY).getValue().toString();
String value = item.getItemProperty(TableProperty.TRANSLATION).getValue().toString();
if (!(key.isEmpty() || value.isEmpty())) {
localization.put(key, value);
}
}
m_keyset.updateKeySet(m_localizations.get(m_locale).keySet(), localization.keySet());
m_localizations.put(m_locale, localization);
} | [
"private",
"void",
"saveLocalization",
"(",
")",
"{",
"SortedProperties",
"localization",
"=",
"new",
"SortedProperties",
"(",
")",
";",
"for",
"(",
"Object",
"itemId",
":",
"m_container",
".",
"getItemIds",
"(",
")",
")",
"{",
"Item",
"item",
"=",
"m_contai... | Saves the current translations from the container to the respective localization. | [
"Saves",
"the",
"current",
"translations",
"from",
"the",
"container",
"to",
"the",
"respective",
"localization",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1795-L1809 | train |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java | CmsMessageBundleEditorModel.saveToBundleDescriptor | private void saveToBundleDescriptor() throws CmsException {
if (null != m_descFile) {
m_removeDescriptorOnCancel = false;
updateBundleDescriptorContent();
m_descFile.getFile().setContents(m_descContent.marshal());
m_cms.writeFile(m_descFile.getFile());
}
} | java | private void saveToBundleDescriptor() throws CmsException {
if (null != m_descFile) {
m_removeDescriptorOnCancel = false;
updateBundleDescriptorContent();
m_descFile.getFile().setContents(m_descContent.marshal());
m_cms.writeFile(m_descFile.getFile());
}
} | [
"private",
"void",
"saveToBundleDescriptor",
"(",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"null",
"!=",
"m_descFile",
")",
"{",
"m_removeDescriptorOnCancel",
"=",
"false",
";",
"updateBundleDescriptorContent",
"(",
")",
";",
"m_descFile",
".",
"getFile",
"(... | Save the values to the bundle descriptor.
@throws CmsException thrown if saving fails. | [
"Save",
"the",
"values",
"to",
"the",
"bundle",
"descriptor",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorModel.java#L1815-L1823 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.