_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q16700
ElementTreeView.activateChildren
train
@Override public void activateChildren(boolean activate) { if (activePane == null || !activePane.isVisible()) { ElementBase active = getFirstVisibleChild(); setActivePane((ElementTreePane) active); } if (activePane != null) { activePane.activate(activate); } }
java
{ "resource": "" }
q16701
ElementTreeView.setActivePane
train
protected void setActivePane(ElementTreePane pane) { if (pane == activePane) { return; } if (activePane != null) { activePane.makeActivePane(false); } activePane = pane; if (activePane != null) { activePane.makeActivePane(true); } }
java
{ "resource": "" }
q16702
AliasTypeRegistry.get
train
@Override public AliasType get(String key) { key = key.toUpperCase(); AliasType type = super.get(key); if (type == null) { register(type = new AliasType(key)); } return type; }
java
{ "resource": "" }
q16703
AliasTypeRegistry.setApplicationContext
train
@Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (StringUtils.isEmpty(propertyFile)) { return; } for (String pf : propertyFile.split("\\,")) { loadAliases(applicationContext, pf); } if (fileCount > 0) { log.info("Loaded " + entryCount + " aliases from " + fileCount + " files."); } }
java
{ "resource": "" }
q16704
AliasTypeRegistry.loadAliases
train
private void loadAliases(ApplicationContext applicationContext, String propertyFile) { if (propertyFile.isEmpty()) { return; } Resource[] resources; try { resources = applicationContext.getResources(propertyFile); } catch (IOException e) { log.error("Failed to locate alias property file: " + propertyFile, e); return; } for (Resource resource : resources) { if (!resource.exists()) { log.info("Did not find alias property file: " + resource.getFilename()); continue; } try (InputStream is = resource.getInputStream();) { Properties props = new Properties(); props.load(is); for (Entry<Object, Object> entry : props.entrySet()) { try { register((String) entry.getKey(), (String) entry.getValue()); entryCount++; } catch (Exception e) { log.error("Error registering alias for '" + entry.getKey() + "'.", e); } } fileCount++; } catch (IOException e) { log.error("Failed to load alias property file: " + resource.getFilename(), e); } } }
java
{ "resource": "" }
q16705
AliasTypeRegistry.register
train
private void register(String key, String alias) { String[] pcs = key.split(PREFIX_DELIM_REGEX, 2); if (pcs.length != 2) { throw new IllegalArgumentException("Illegal key value: " + key); } register(pcs[0], pcs[1], alias); }
java
{ "resource": "" }
q16706
ComparablePair.naturalOrder
train
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> Comparator<Pair<T1, T2>> naturalOrder() { return new Comparator<Pair<T1,T2>>() { @Override public int compare(Pair<T1, T2> lhs, Pair<T1, T2> rhs) { return compareTo(lhs, rhs); } }; }
java
{ "resource": "" }
q16707
PHS398ResearchPlanBaseGenerator.getAppendixAttachedFileDataTypes
train
protected AttachedFileDataType[] getAppendixAttachedFileDataTypes() { return pdDoc.getDevelopmentProposal().getNarratives().stream() .filter(narrative -> narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == APPENDIX) .map(this::getAttachedFileType) .filter(Objects::nonNull) .toArray(AttachedFileDataType[]::new); }
java
{ "resource": "" }
q16708
S2SAdobeFormAttachmentBaseGenerator.nodeToDom
train
public Document nodeToDom(org.w3c.dom.Node node) throws S2SException { try { javax.xml.transform.TransformerFactory tf = javax.xml.transform.TransformerFactory.newInstance(); javax.xml.transform.Transformer xf = tf.newTransformer(); javax.xml.transform.dom.DOMResult dr = new javax.xml.transform.dom.DOMResult(); xf.transform(new javax.xml.transform.dom.DOMSource(node), dr); return (Document) dr.getNode(); } catch (javax.xml.transform.TransformerException ex) { throw new S2SException(ex.getMessage()); } }
java
{ "resource": "" }
q16709
S2SAdobeFormAttachmentBaseGenerator.stringToDom
train
public Document stringToDom(String xmlSource) throws S2SException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(xmlSource))); } catch (SAXException | IOException | ParserConfigurationException ex) { throw new S2SException(ex.getMessage(), ex); } }
java
{ "resource": "" }
q16710
S2SAdobeFormAttachmentBaseGenerator.docToString
train
public String docToString(Document node) throws S2SException { try { DOMSource domSource = new DOMSource(node); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result); return writer.toString(); } catch (Exception e) { throw new S2SException(e.getMessage(),e); } }
java
{ "resource": "" }
q16711
S2SAdobeFormAttachmentBaseGenerator.addSubAwdAttachments
train
protected void addSubAwdAttachments(BudgetSubAwardsContract budgetSubAwards) { List<? extends BudgetSubAwardAttachmentContract> subAwardAttachments = budgetSubAwards.getBudgetSubAwardAttachments(); for (BudgetSubAwardAttachmentContract budgetSubAwardAttachment : subAwardAttachments) { AttachmentData attachmentData = new AttachmentData(); attachmentData.setContent(budgetSubAwardAttachment.getData()); attachmentData.setContentId(budgetSubAwardAttachment.getName()); attachmentData.setContentType(budgetSubAwardAttachment.getType()); attachmentData.setFileName(budgetSubAwardAttachment.getName()); addAttachment(attachmentData); } }
java
{ "resource": "" }
q16712
S2SAdobeFormAttachmentBaseGenerator.findBudgetSubawards
train
@SuppressWarnings("unchecked") private List<BudgetSubAwardsContract> findBudgetSubawards(String namespace, BudgetContract budget,boolean checkNull) { List<BudgetSubAwardsContract> budgetSubAwardsList = new ArrayList<>(); for (BudgetSubAwardsContract subAwards : budget.getBudgetSubAwards()) { if (StringUtils.equals(namespace, subAwards.getNamespace()) || (checkNull && StringUtils.isBlank(subAwards.getNamespace()))) { budgetSubAwardsList.add(subAwards); } } return budgetSubAwardsList; }
java
{ "resource": "" }
q16713
PerformanceMetrics.createNew
train
public static PerformanceMetrics createNew(String action, String descriptor, String correlationId) { return new PerformanceMetrics(KEY_GEN.getAndIncrement(), 0, action, null, descriptor, correlationId); }
java
{ "resource": "" }
q16714
PerformanceMetrics.getStartAction
train
public Action0 getStartAction() { return new Action0() { @Override public void call() { if (startTime == null) { startTime = new Date().getTime(); } } }; }
java
{ "resource": "" }
q16715
PathTools.createTempFolder
train
public static Path createTempFolder(String prefix) throws IOException { Path parent = Paths.get(System.getProperty("java.io.tmpdir")); if (!Files.isDirectory(parent)) { throw new IOException("java.io.tmpdir points to a non-existing folder: " + parent); } Path ret = null; int i = 0; do { ret = parent.resolve(Objects.requireNonNull(prefix)+Long.toHexString(System.currentTimeMillis())+"-"+Integer.toHexString(RND.nextInt())); i++; if (i>=100) { throw new IOException("Failed to create temporary folder."); } } while (!ret.toFile().mkdirs()); return ret; }
java
{ "resource": "" }
q16716
PathTools.deleteRecursive
train
public static void deleteRecursive(Path start, boolean deleteStart) throws IOException { Files.walkFileTree(start, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { if (deleteStart || !Files.isSameFile(dir, start)) { Files.delete(dir); } return FileVisitResult.CONTINUE; } else { // directory iteration failed throw e; } } }); }
java
{ "resource": "" }
q16717
MainController.afterInitialized
train
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); propertyGrid = PropertyGrid.create(null, comp, true); getPlugin().registerProperties(this, "provider", "group"); }
java
{ "resource": "" }
q16718
MainController.setProvider
train
public void setProvider(String beanId) { provider = getAppContext().getBean(beanId, ISettingsProvider.class); providerBeanId = beanId; init(); }
java
{ "resource": "" }
q16719
MainController.init
train
private void init() { if (provider != null) { propertyGrid.setTarget(StringUtils.isEmpty(groupId) ? null : new Settings(groupId, provider)); } }
java
{ "resource": "" }
q16720
FixtureAnnotationClassScanner.addCollectionProviderFixtureType
train
private void addCollectionProviderFixtureType(Class<?> clazz, List<FixtureType> listFixtureType, Set<Method> methods) { for (Method method : methods) { if (Collection.class.isAssignableFrom(method.getReturnType())) { FixtureType fixtureType = new FixtureType(); if (method.isAnnotationPresent(FixtureCollection.class)) { FixtureCollection annotation = method.getAnnotation(FixtureCollection.class); if (annotation.deprecated()) { fixtureType.setDeprecated(annotation.deprecated()); } else { fixtureType.setBestpractice(annotation.bestPractice()); } } Type genericReturnType = method.getGenericReturnType(); Class<?> typeClass; if (ParameterizedType.class.isAssignableFrom(genericReturnType.getClass())) { ParameterizedType parameterizedReturnType = (ParameterizedType) genericReturnType; LOGGER.debug("Checking the Collection Generic type: {}", parameterizedReturnType); typeClass = (Class<?>) parameterizedReturnType.getActualTypeArguments()[0]; } else { // We take the Object class typeClass = Object.class; } fixtureType.setClazz(returnTypeToString(clazz) + "/" + method.getName()); List<MemberType> listMembreType = fixtureType.getMember(); if (Modifier.isAbstract(clazz.getModifiers())) { fixtureType.setCategory(CAT_FIXTURES_ABSTRAITES); } else { @SuppressWarnings("unchecked") Set<Field> allFields = getAllFields(typeClass, and(or(withModifier(Modifier.PUBLIC), withModifier(Modifier.PRIVATE)), not(withModifier(Modifier.STATIC)))); for (Field field : allFields) { MemberType membreType = new MemberType(); membreType.setName(field.getName()); membreType.setType(TypeMemberEnum.QUERY); membreType.setReturntype(returnTypeToString(field.getType().getSimpleName())); listMembreType.add(membreType); } } listFixtureType.add(fixtureType); } else { LOGGER.warn("A method matching the CollectionIterpreter is not returning a Collection: {}", method.toString()); } } }
java
{ "resource": "" }
q16721
Command.unbind
train
public void unbind(BaseUIComponent component) { if (componentBindings.remove(component)) { keyEventListener.registerComponent(component, false); CommandUtil.updateShortcuts(component, shortcutBindings, true); setCommandTarget(component, null); } }
java
{ "resource": "" }
q16722
Command.shortcutChanged
train
private void shortcutChanged(String shortcut, boolean unbind) { Set<String> bindings = new HashSet<>(); bindings.add(shortcut); for (BaseUIComponent component : componentBindings) { CommandUtil.updateShortcuts(component, bindings, unbind); } }
java
{ "resource": "" }
q16723
Command.setCommandTarget
train
private void setCommandTarget(BaseComponent component, BaseComponent commandTarget) { if (commandTarget == null) { commandTarget = (BaseComponent) component.removeAttribute(getTargetAttributeName()); if (commandTarget != null && commandTarget.hasAttribute(ATTR_DUMMY)) { commandTarget.detach(); } } else { component.setAttribute(getTargetAttributeName(), commandTarget); } }
java
{ "resource": "" }
q16724
Command.getCommandTarget
train
private BaseComponent getCommandTarget(BaseComponent component) { BaseComponent commandTarget = (BaseComponent) component.getAttribute(getTargetAttributeName()); return commandTarget == null ? component : commandTarget; }
java
{ "resource": "" }
q16725
HelpModule.getLocalizedId
train
public static String getLocalizedId(String id, Locale locale) { String locstr = locale == null ? "" : ("_" + locale.toString()); return id + locstr; }
java
{ "resource": "" }
q16726
GrantApplicationHash.computeAttachmentHash
train
public static String computeAttachmentHash(byte[] attachment) { byte[] rawDigest = MESSAGE_DIGESTER.digest(attachment); return Base64.encode(rawDigest); }
java
{ "resource": "" }
q16727
EventsModule.mapEventSources
train
@SuppressWarnings("unchecked") @VisibleForTesting Map<String, Class<? extends Service>> mapEventSources() throws IOException { /* Obtains all classpath's top level classes */ ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Set<ClassPath.ClassInfo> classes = ClassPath.from(classLoader).getAllClasses(); ClassLoaderRepository repository = new ClassLoaderRepository(classLoader); LOGGER.info("Scanning classpath for EventHandlers...."); /* iterates over all classes, filter by HandlesEvent annotation and transforms stream to needed form */ Map<String, Class<? extends Service>> collected = classes.parallelStream() /* loads class infos */ .map(classInfo -> { try { /* sometimes exception occurs during class loading. Return empty/absent in this case */ return Optional.of(repository.loadClass(classInfo.getName())); } catch (ClassNotFoundException e) { LOGGER.trace("Class cannot be loaded: {}", classInfo.getName(), e); return Optional.<JavaClass>empty(); } }) /* filters classes which is present and marked with EventSource annotation */ .filter(((Predicate<Optional<JavaClass>>) Optional::isPresent) .and(javaClassOptional -> { return Arrays.stream(javaClassOptional.get().getAnnotationEntries()).anyMatch(annotationEntry -> { return Type.getType(annotationEntry.getAnnotationType()).toString().equals(EventSource.class.getCanonicalName()); }); }) .and(javaClassOptional -> { try { return Arrays.stream(javaClassOptional.get().getAllInterfaces()).anyMatch(iface -> { return iface.getClassName().equals(Service.class.getCanonicalName()); }); } catch (ClassNotFoundException e) { LOGGER.trace("Class annotations cannot be loaded: {}", javaClassOptional.get().getClassName(), e); return false; } })) /* transforms from Optional<JavaClass> to Class (obtaining values from Optionals) */ .map(javaClassOptional -> { try { return (Class<? extends Service>) classLoader.loadClass(javaClassOptional.get().getClassName()); } catch (ClassNotFoundException e) { LOGGER.trace("Class cannot be loaded: {}", javaClassOptional.get().getClassName(), e); return null; } }) .filter(Objects::nonNull) .collect(Collectors.toMap(clazz -> clazz.getAnnotation(EventSource.class).value(), clazz -> clazz)); LOGGER.info("Found {} event handlers", collected.size()); return collected; }
java
{ "resource": "" }
q16728
JMSUtil.getClientId
train
public static String getClientId(Connection connection) { String clientId = null; try { clientId = connection == null ? null : connection.getClientID(); } catch (JMSException e) {} return clientId; }
java
{ "resource": "" }
q16729
JMSUtil.getMessageSelector
train
public static String getMessageSelector(String eventName, IPublisherInfo publisherInfo) { StringBuilder sb = new StringBuilder( "(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL"); if (publisherInfo != null) { for (String selector : publisherInfo.getAttributes().values()) { addRecipientSelector(selector, sb); } } sb.append(')'); return sb.toString(); }
java
{ "resource": "" }
q16730
JMSUtil.addRecipientSelector
train
private static void addRecipientSelector(String value, StringBuilder sb) { if (value != null) { sb.append(" OR Recipients LIKE '%,").append(value).append(",%'"); } }
java
{ "resource": "" }
q16731
JashingServer.getAggregationHandler
train
private HttpHandler getAggregationHandler() throws ServletException { DeploymentInfo deploymentInfo = Servlets .deployment() .setClassLoader(JashingServer.class.getClassLoader()) .setContextPath("/") .setDeploymentName("jashing") .addFilterUrlMapping("wro4j", "/*", DispatcherType.REQUEST) .addFilter(Servlets.filter("wro4j", ConfigurableWroFilter.class, new InstanceFactory<ConfigurableWroFilter>() { @Override public InstanceHandle<ConfigurableWroFilter> createInstance() throws InstantiationException { ConfigurableWroFilter filter = new ConfigurableWroFilter(); filter.setWroManagerFactory(new WroManagerFactory()); return new ImmediateInstanceHandle<>(filter); } })); DeploymentManager deployment = Servlets.defaultContainer().addDeployment(deploymentInfo); deployment.deploy(); return deployment.start(); }
java
{ "resource": "" }
q16732
PrepareLibs.loadLibFiles
train
public static String[] loadLibFiles(String fileSuffix, String... libAbsoluteClassPaths) { Set<String> failedDllPaths = new HashSet<String>(); for (String libAbsoluteClassPath : libAbsoluteClassPaths) { String libraryName = libAbsoluteClassPath .substring(libAbsoluteClassPath.lastIndexOf("/") + 1, libAbsoluteClassPath.lastIndexOf(fileSuffix)); try { prepareLibFile(true, libAbsoluteClassPath); System.loadLibrary(libraryName); LOGGER.info("Success load library: " + libraryName); } catch (Exception e) { LOGGER.info("Load library: " + libraryName + " failed!", e); failedDllPaths.add(libAbsoluteClassPath); } } return failedDllPaths.toArray(new String[failedDllPaths.size()]); }
java
{ "resource": "" }
q16733
RelatedClassMap.getCardinalities
train
public Cardinalities getCardinalities(Class<? extends ElementBase> sourceClass) { Class<?> clazz = sourceClass; Cardinalities cardinalities = null; while (cardinalities == null && clazz != null) { cardinalities = map.get(clazz); clazz = clazz == ElementBase.class ? null : clazz.getSuperclass(); } return cardinalities; }
java
{ "resource": "" }
q16734
RelatedClassMap.getOrCreateCardinalities
train
private Cardinalities getOrCreateCardinalities(Class<? extends ElementBase> sourceClass) { Cardinalities cardinalities = map.get(sourceClass); if (cardinalities == null) { map.put(sourceClass, cardinalities = new Cardinalities()); } return cardinalities; }
java
{ "resource": "" }
q16735
RelatedClassMap.addCardinality
train
public void addCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass, int maxOccurrences) { Cardinality cardinality = new Cardinality(sourceClass, targetClass, maxOccurrences); getOrCreateCardinalities(sourceClass).addCardinality(cardinality); }
java
{ "resource": "" }
q16736
RelatedClassMap.getTotalCardinality
train
public int getTotalCardinality(Class<? extends ElementBase> sourceClass) { Cardinalities cardinalities = getCardinalities(sourceClass); return cardinalities == null ? 0 : cardinalities.total; }
java
{ "resource": "" }
q16737
RelatedClassMap.isRelated
train
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
java
{ "resource": "" }
q16738
RelatedClassMap.getCardinality
train
public Cardinality getCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { Cardinalities cardinalities = getCardinalities(sourceClass); Cardinality cardinality = cardinalities == null ? null : cardinalities.getCardinality(targetClass); return cardinality == null ? new Cardinality(sourceClass, targetClass, 0) : cardinality; }
java
{ "resource": "" }
q16739
AppFramework.setApplicationContext
train
@Override public void setApplicationContext(ApplicationContext appContext) throws BeansException { if (this.appContext != null) { throw new ApplicationContextException("Attempt to reinitialize application context."); } this.appContext = appContext; }
java
{ "resource": "" }
q16740
AppFramework.unregisterObject
train
public synchronized boolean unregisterObject(Object object) { int i = MiscUtil.indexOfInstance(registeredObjects, object); if (i > -1) { registeredObjects.remove(i); for (IRegisterEvent onRegister : onRegisterList) { onRegister.unregisterObject(object); } if (object instanceof IRegisterEvent) { onRegisterList.remove(object); } return true; } return false; }
java
{ "resource": "" }
q16741
AppFramework.findObject
train
public synchronized Object findObject(Class<?> clazz, Object previousInstance) { int i = previousInstance == null ? -1 : MiscUtil.indexOfInstance(registeredObjects, previousInstance); for (i++; i < registeredObjects.size(); i++) { Object object = registeredObjects.get(i); if (clazz.isInstance(object)) { return object; } } return null; }
java
{ "resource": "" }
q16742
AppFramework.postProcessAfterInitialization
train
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { registerObject(bean); return bean; }
java
{ "resource": "" }
q16743
ElementLayout.afterInitialize
train
@Override public void afterInitialize(boolean deserializing) throws Exception { super.afterInitialize(deserializing); if (linked) { internalDeserialize(false); } initializing = false; }
java
{ "resource": "" }
q16744
ElementLayout.internalDeserialize
train
private void internalDeserialize(boolean forced) { if (!forced && loaded) { return; } lockDescendants(false); removeChildren(); loaded = true; try { if (linked) { checkForCircularReference(); } getLayout().materialize(this); if (linked) { lockDescendants(true); } } catch (Exception e) { CWFException.raise("Error loading layout.", e); } }
java
{ "resource": "" }
q16745
ElementLayout.checkForCircularReference
train
private void checkForCircularReference() { ElementLayout layout = this; while ((layout = layout.getAncestor(ElementLayout.class)) != null) { if (layout.linked && layout.shared == shared && layout.layoutName.equals(layoutName)) { CWFException.raise("Circular reference to layout " + layoutName); } } }
java
{ "resource": "" }
q16746
ElementLayout.lockDescendants
train
private void lockDescendants(Iterable<ElementBase> children, boolean lock) { for (ElementBase child : children) { child.setLocked(lock); lockDescendants(child.getChildren(), lock); } }
java
{ "resource": "" }
q16747
ElementLayout.setLinked
train
public void setLinked(boolean linked) { if (linked != this.linked) { this.linked = linked; if (!initializing) { internalDeserialize(true); getRoot().activate(true); } } }
java
{ "resource": "" }
q16748
Configs.getSelfConfigDecimal
train
public static BigDecimal getSelfConfigDecimal(String configAbsoluteClassPath, IConfigKey key) { OneProperties configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { addSelfConfigs(configAbsoluteClassPath, null); configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { return VOID_CONFIGS.getDecimalConfig(key); } } return configs.getDecimalConfig(key); }
java
{ "resource": "" }
q16749
Configs.isHavePathSelfConfig
train
public static boolean isHavePathSelfConfig(IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return isSelfConfig(configAbsoluteClassPath, key); }
java
{ "resource": "" }
q16750
Configs.modifySystemConfig
train
public static void modifySystemConfig(IConfigKey key, String value) throws IOException { systemConfigs.modifyConfig(key, value); }
java
{ "resource": "" }
q16751
EventManager.hostSubscribe
train
private void hostSubscribe(String eventName, boolean subscribe) { if (globalEventDispatcher != null) { try { globalEventDispatcher.subscribeRemoteEvent(eventName, subscribe); } catch (Throwable e) { log.error( "Error " + (subscribe ? "subscribing to" : "unsubscribing from") + " remote event '" + eventName + "'", e); } } }
java
{ "resource": "" }
q16752
AbstractQueueFactory.setDefaultObserver
train
public AbstractQueueFactory<T, ID, DATA> setDefaultObserver( IQueueObserver<ID, DATA> defaultObserver) { this.defaultObserver = defaultObserver; return this; }
java
{ "resource": "" }
q16753
AbstractQueueFactory.initQueue
train
protected void initQueue(T queue, QueueSpec spec) throws Exception { queue.setObserver(defaultObserver); queue.init(); }
java
{ "resource": "" }
q16754
AbstractQueueFactory.createAndInitQueue
train
protected T createAndInitQueue(QueueSpec spec) throws Exception { T queue = createQueueInstance(spec); queue.setQueueName(spec.name); initQueue(queue, spec); return queue; }
java
{ "resource": "" }
q16755
RRBudgetV1_0Generator.getBudgetYear1DataType
train
private BudgetYear1DataType getBudgetYear1DataType( BudgetPeriodDto periodInfo) { BudgetYear1DataType budgetYear = BudgetYear1DataType.Factory .newInstance(); budgetYear.setBudgetPeriodStartDate(s2SDateTimeService .convertDateToCalendar(periodInfo.getStartDate())); budgetYear.setBudgetPeriodEndDate(s2SDateTimeService .convertDateToCalendar(periodInfo.getEndDate())); BudgetPeriod.Enum budgetPeriod = BudgetPeriod.Enum.forInt(periodInfo .getBudgetPeriod()); budgetYear.setBudgetPeriod(budgetPeriod); budgetYear.setKeyPersons(getKeyPersons(periodInfo)); budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo)); if (periodInfo.getTotalCompensation() != null) { budgetYear.setTotalCompensation(periodInfo.getTotalCompensation() .bigDecimalValue()); } budgetYear.setEquipment(getEquipment(periodInfo)); budgetYear.setTravel(getTravel(periodInfo)); budgetYear .setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo)); budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo)); budgetYear.setDirectCosts(periodInfo.getDirectCostsTotal() .bigDecimalValue()); IndirectCosts indirectCosts = getIndirectCosts(periodInfo); if (indirectCosts != null) { budgetYear.setIndirectCosts(indirectCosts); budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue().add(indirectCosts.getTotalIndirectCosts())); }else{ budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue()); } budgetYear .setCognizantFederalAgency(periodInfo.getCognizantFedAgency()); AttachedFileDataType attachedFileDataType = null; for (NarrativeContract narrative : pdDoc.getDevelopmentProposal() .getNarratives()) { if (narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == BUDGET_JUSTIFICATION_ATTACHMENT) { attachedFileDataType = getAttachedFileType(narrative); if(attachedFileDataType != null){ budgetYear.setBudgetJustificationAttachment(attachedFileDataType); break; } } } return budgetYear; }
java
{ "resource": "" }
q16756
RRBudgetV1_0Generator.getBudgetSummary
train
private BudgetSummary getBudgetSummary(BudgetSummaryDto budgetSummaryData) { BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance(); // Set default values for mandatory fields budgetSummary .setCumulativeTotalFundsRequestedSeniorKeyPerson(BigDecimal.ZERO); budgetSummary .setCumulativeTotalFundsRequestedPersonnel(BigDecimal.ZERO); budgetSummary .setCumulativeTotalFundsRequestedDirectCosts(BigDecimal.ZERO); if (budgetSummaryData != null) { if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedSeniorKeyPerson(budgetSummaryData .getCumTotalFundsForSrPersonnel() .bigDecimalValue()); } if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedOtherPersonnel(budgetSummaryData .getCumTotalFundsForOtherPersonnel() .bigDecimalValue()); } if (budgetSummaryData.getCumNumOtherPersonnel() != null) { budgetSummary .setCumulativeTotalNoOtherPersonnel(budgetSummaryData .getCumNumOtherPersonnel().intValue()); } if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedPersonnel(budgetSummaryData .getCumTotalFundsForPersonnel() .bigDecimalValue()); } budgetSummary .setCumulativeEquipments(getCumulativeEquipments(budgetSummaryData)); budgetSummary .setCumulativeTravels(getCumulativeTravels(budgetSummaryData)); budgetSummary .setCumulativeTrainee(getCumulativeTrainee(budgetSummaryData)); budgetSummary .setCumulativeOtherDirect(getCumulativeOtherDirect(budgetSummaryData)); if (budgetSummaryData.getCumTotalDirectCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedDirectCosts(budgetSummaryData .getCumTotalDirectCosts().bigDecimalValue()); } if (budgetSummaryData.getCumTotalIndirectCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedIndirectCost(budgetSummaryData .getCumTotalIndirectCosts().bigDecimalValue()); } if (budgetSummaryData.getCumTotalCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedDirectIndirectCosts(budgetSummaryData .getCumTotalCosts().bigDecimalValue()); } if (budgetSummaryData.getCumFee() != null) { budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee() .bigDecimalValue()); } } return budgetSummary; }
java
{ "resource": "" }
q16757
RRBudgetV1_0Generator.getCumulativeTravels
train
private CumulativeTravels getCumulativeTravels( BudgetSummaryDto budgetSummaryData) { CumulativeTravels cumulativeTravels = CumulativeTravels.Factory .newInstance(); if (budgetSummaryData.getCumDomesticTravel() != null) { cumulativeTravels .setCumulativeDomesticTravelCosts(budgetSummaryData .getCumDomesticTravel().bigDecimalValue()); } if (budgetSummaryData.getCumForeignTravel() != null) { cumulativeTravels.setCumulativeForeignTravelCosts(budgetSummaryData .getCumForeignTravel().bigDecimalValue()); } if (budgetSummaryData.getCumTravel() != null) { cumulativeTravels .setCumulativeTotalFundsRequestedTravel(budgetSummaryData .getCumTravel().bigDecimalValue()); } return cumulativeTravels; }
java
{ "resource": "" }
q16758
RRBudgetV1_0Generator.getOtherPersonnel
train
private OtherPersonnel getOtherPersonnel(BudgetPeriodDto periodInfo) { OtherPersonnel otherPersonnel = OtherPersonnel.Factory.newInstance(); int OtherpersonalCount = 0; List<OtherPersonnelDataType> otherPersonnelList = new ArrayList<>(); OtherPersonnelDataType otherPersonnelDataTypeArray[] = new OtherPersonnelDataType[1]; if (periodInfo != null) { for (OtherPersonnelDto otherPersonnelInfo : periodInfo .getOtherPersonnel()) { if (OTHERPERSONNEL_POSTDOC.equals(otherPersonnelInfo .getPersonnelType())) { otherPersonnel .setPostDocAssociates(getPostDocAssociates(otherPersonnelInfo)); } else if (OTHERPERSONNEL_GRADUATE.equals(otherPersonnelInfo .getPersonnelType())) { otherPersonnel .setGraduateStudents(getGraduateStudents(otherPersonnelInfo)); } else if (OTHERPERSONNEL_UNDERGRADUATE .equals(otherPersonnelInfo.getPersonnelType())) { otherPersonnel .setUndergraduateStudents(getUndergraduateStudents(otherPersonnelInfo)); } else if (OTHERPERSONNEL_SECRETARIAL.equals(otherPersonnelInfo .getPersonnelType())) { otherPersonnel .setSecretarialClerical(getSecretarialClerical(otherPersonnelInfo)); } else if (OtherpersonalCount < OTHERPERSONNEL_MAX_ALLOWED) {// Max // allowed // is 6 OtherPersonnelDataType otherPersonnelDataType = OtherPersonnelDataType.Factory .newInstance(); otherPersonnelDataType .setNumberOfPersonnel(otherPersonnelInfo .getNumberPersonnel()); otherPersonnelDataType.setProjectRole(otherPersonnelInfo .getRole()); otherPersonnelDataType .setCompensation(getSectBCompensationDataType(otherPersonnelInfo .getCompensation())); otherPersonnelList.add(otherPersonnelDataType); OtherpersonalCount++; } } otherPersonnelDataTypeArray = otherPersonnelList .toArray(otherPersonnelDataTypeArray); otherPersonnel.setOtherArray(otherPersonnelDataTypeArray); if (periodInfo.getOtherPersonnelTotalNumber() != null) { otherPersonnel.setOtherPersonnelTotalNumber(periodInfo .getOtherPersonnelTotalNumber().intValue()); } if (periodInfo.getTotalOtherPersonnelFunds() != null) { otherPersonnel.setTotalOtherPersonnelFund(periodInfo .getTotalOtherPersonnelFunds().bigDecimalValue()); } } return otherPersonnel; }
java
{ "resource": "" }
q16759
RRBudgetV1_0Generator.getEquipment
train
private Equipment getEquipment(BudgetPeriodDto periodInfo) { Equipment equipment = Equipment.Factory.newInstance(); NarrativeContract extraEquipmentNarr = null; if (periodInfo != null && periodInfo.getEquipment() != null && periodInfo.getEquipment().size() > 0) { // Evaluating Equipments. List<EquipmentList> equipmentArrayList = new ArrayList<>(); ScaleTwoDecimal totalFund = ScaleTwoDecimal.ZERO; for (CostDto costInfo : periodInfo.getEquipment().get(0) .getEquipmentList()) { EquipmentList equipmentList = EquipmentList.Factory .newInstance(); equipmentList.setEquipmentItem(costInfo.getDescription()); if (costInfo.getCost() != null) { equipmentList.setFundsRequested(costInfo.getCost() .bigDecimalValue()); } totalFund = totalFund.add(costInfo.getCost()); equipmentArrayList.add(equipmentList); } // Evaluating Extra Equipments. List<CostDto> extraEquipmentArrayList = new ArrayList<>(); ScaleTwoDecimal totalExtraEquipFund = ScaleTwoDecimal.ZERO; for(CostDto costInfo:periodInfo.getEquipment().get(0).getExtraEquipmentList()){ extraEquipmentArrayList.add(costInfo); totalExtraEquipFund = totalExtraEquipFund.add(costInfo.getCost()); } EquipmentList[] equipmentArray = new EquipmentList[0]; equipmentArray = equipmentArrayList.toArray(equipmentArray); equipment.setEquipmentListArray(equipmentArray); TotalFundForAttachedEquipment totalFundForAttachedEquipment = TotalFundForAttachedEquipment.Factory .newInstance(); totalFundForAttachedEquipment.setTotalFundForAttachedEquipmentExist(YesNoDataType.YES); totalFundForAttachedEquipment.setBigDecimalValue(periodInfo.getEquipment().get(0) .getTotalExtraFund().bigDecimalValue()); totalFund = totalFund.add(totalExtraEquipFund); equipment.setTotalFundForAttachedEquipment(totalFundForAttachedEquipment); equipment.setTotalFund(totalFund.bigDecimalValue()); extraEquipmentNarr = saveAdditionalEquipments(periodInfo,extraEquipmentArrayList); } if(extraEquipmentNarr!=null){ AdditionalEquipmentsAttachment equipmentAttachment = AdditionalEquipmentsAttachment.Factory .newInstance(); FileLocation fileLocation = FileLocation.Factory.newInstance(); equipmentAttachment.setFileLocation(fileLocation); String contentId = createContentId(extraEquipmentNarr); fileLocation.setHref(contentId); equipmentAttachment.setFileLocation(fileLocation); equipmentAttachment.setFileName(extraEquipmentNarr.getNarrativeAttachment().getName()); equipmentAttachment .setMimeType(InfastructureConstants.CONTENT_TYPE_OCTET_STREAM); equipmentAttachment.setHashValue(getHashValue(extraEquipmentNarr .getNarrativeAttachment().getData())); AttachmentData attachmentData = new AttachmentData(); attachmentData.setContent(extraEquipmentNarr .getNarrativeAttachment().getData()); attachmentData.setContentId(contentId); attachmentData .setContentType(InfastructureConstants.CONTENT_TYPE_OCTET_STREAM); attachmentData.setFileName(extraEquipmentNarr.getNarrativeAttachment().getName()); addAttachment(attachmentData); equipmentAttachment .setTotalFundForAttachedEquipmentExist(YesNoDataType.YES); equipment .setAdditionalEquipmentsAttachment(equipmentAttachment); } return equipment; }
java
{ "resource": "" }
q16760
RRBudgetV1_0Generator.getTravel
train
private Travel getTravel(BudgetPeriodDto periodInfo) { Travel travel = Travel.Factory.newInstance(); if (periodInfo != null) { if (periodInfo.getDomesticTravelCost() != null) { travel.setDomesticTravelCost(periodInfo.getDomesticTravelCost() .bigDecimalValue()); } if (periodInfo.getForeignTravelCost() != null) { travel.setForeignTravelCost(periodInfo.getForeignTravelCost() .bigDecimalValue()); } if (periodInfo.getTotalTravelCost() != null) { travel.setTotalTravelCost(periodInfo.getTotalTravelCost() .bigDecimalValue()); } } return travel; }
java
{ "resource": "" }
q16761
RRBudgetV1_0Generator.getParticipantTraineeSupportCosts
train
private ParticipantTraineeSupportCosts getParticipantTraineeSupportCosts( BudgetPeriodDto periodInfo) { ParticipantTraineeSupportCosts traineeSupportCosts = ParticipantTraineeSupportCosts.Factory .newInstance(); if (periodInfo != null) { traineeSupportCosts.setTuitionFeeHealthInsurance(periodInfo .getPartTuition().bigDecimalValue()); traineeSupportCosts.setStipends(periodInfo.getpartStipendCost() .bigDecimalValue()); traineeSupportCosts.setTravel(periodInfo.getpartTravelCost() .bigDecimalValue()); traineeSupportCosts.setSubsistence(periodInfo.getPartSubsistence() .bigDecimalValue()); traineeSupportCosts.setOther(getOtherPTSupportCosts(periodInfo)); traineeSupportCosts.setParticipantTraineeNumber(periodInfo .getparticipantCount()); traineeSupportCosts .setTotalCost(traineeSupportCosts .getTuitionFeeHealthInsurance() .add( traineeSupportCosts .getStipends() .add( traineeSupportCosts .getTravel() .add( traineeSupportCosts .getSubsistence() .add( traineeSupportCosts .getOther() .getCost()))))); } return traineeSupportCosts; }
java
{ "resource": "" }
q16762
XMLViewer.showXML
train
public static Window showXML(Document document, BaseUIComponent parent) { Map<String, Object> args = Collections.singletonMap("document", document); boolean modal = parent == null; Window dialog = PopupDialog.show(XMLConstants.VIEW_DIALOG, args, modal, modal, modal, null); if (parent != null) { dialog.setParent(parent); } return dialog; }
java
{ "resource": "" }
q16763
XMLViewer.showCWF
train
public static Window showCWF(BaseComponent root, String... excludedProperties) { Window window = showXML(CWF2XML.toDocument(root, excludedProperties)); window.setTitle("CWF Markup"); return window; }
java
{ "resource": "" }
q16764
FrameworkUtil.setAttribute
train
public static void setAttribute(String key, Object value) { assertInitialized(); getAppFramework().setAttribute(key, value); }
java
{ "resource": "" }
q16765
PluginController.afterInitialized
train
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); PluginContainer container = comp.getAncestor(PluginContainer.class, true); plugin = (ElementPlugin) ElementUI.getAssociatedElement(container); }
java
{ "resource": "" }
q16766
PluginController.attachController
train
public void attachController(BaseComponent comp, IAutoWired controller) { plugin.tryRegisterListener(controller, true); comp.wireController(controller); }
java
{ "resource": "" }
q16767
PluginController.removeThread
train
@Override protected IAbortable removeThread(IAbortable thread) { super.removeThread(thread); if (!hasActiveThreads()) { showBusy(null); } return thread; }
java
{ "resource": "" }
q16768
ActionListener.bindActionListeners
train
public static void bindActionListeners(IActionTarget target, List<ActionListener> actionListeners) { if (actionListeners != null) { for (ActionListener actionListener : actionListeners) { actionListener.bind(target); } } }
java
{ "resource": "" }
q16769
ActionListener.unbindActionListeners
train
public static void unbindActionListeners(IActionTarget target, List<ActionListener> actionListeners) { if (actionListeners != null) { for (ActionListener listener : actionListeners) { listener.unbind(target); } } }
java
{ "resource": "" }
q16770
ActionListener.eventCallback
train
@Override public void eventCallback(String eventName, Object eventData) { for (IActionTarget target : new ArrayList<>(targets)) { try { target.doAction(action); } catch (Throwable t) { } } }
java
{ "resource": "" }
q16771
ActionListener.bind
train
private void bind(IActionTarget target) { if (targets.isEmpty()) { getEventManager().subscribe(eventName, this); } targets.add(target); }
java
{ "resource": "" }
q16772
ActionListener.unbind
train
private void unbind(IActionTarget target) { if (targets.remove(target) && targets.isEmpty()) { getEventManager().unsubscribe(eventName, this); } }
java
{ "resource": "" }
q16773
ConsumerService.getCallbacks
train
private synchronized LinkedHashSet<IMessageCallback> getCallbacks(String channel, boolean autoCreate, boolean clone) { LinkedHashSet<IMessageCallback> result = callbacks.get(channel); if (result == null && autoCreate) { callbacks.put(channel, result = new LinkedHashSet<>()); } return result == null ? null : clone ? new LinkedHashSet<>(result) : result; }
java
{ "resource": "" }
q16774
ConsumerService.onMessage
train
@Override public void onMessage(String channel, Message message) { if (MessageUtil.isMessageExcluded(message, RecipientType.CONSUMER, nodeId)) { return; } if (updateDelivered(message)) { LinkedHashSet<IMessageCallback> callbacks = getCallbacks(channel, false, true); if (callbacks != null) { dispatchMessages(channel, message, callbacks); } } }
java
{ "resource": "" }
q16775
ConsumerService.updateDelivered
train
private boolean updateDelivered(Message message) { if (consumers.size() <= 1) { return true; } String pubid = (String) message.getMetadata("cwf.pub.event"); return deliveredMessageCache.putIfAbsent(pubid, "") == null; }
java
{ "resource": "" }
q16776
ConsumerService.dispatchMessages
train
protected void dispatchMessages(String channel, Message message, Set<IMessageCallback> callbacks) { for (IMessageCallback callback : callbacks) { try { callback.onMessage(channel, message); } catch (Exception e) { } } }
java
{ "resource": "" }
q16777
CaptionedFormController.updateStyle
train
private void updateStyle() { CaptionStyle cs = captionStyle == null ? CaptionStyle.HIDDEN : captionStyle; String background = null; switch (cs) { case FRAME: break; case TITLE: break; case LEFT: background = getGradValue(color1, color2); break; case RIGHT: background = getGradValue(color2, color1); break; case CENTER: background = getGradValue(color1, color2, color1); break; } panel.addClass("sharedForms-captioned sharedForms-captioned-caption-" + cs.name().toLowerCase()); String css = "##{id}-titlebar "; if (cs == CaptionStyle.HIDDEN) { css += "{display:none}"; } else { css += "{background: " + background + "}"; } panel.setCss(css); }
java
{ "resource": "" }
q16778
DefaultTaskSystem.getPath
train
static List<TaskGroupInformation> getPath(TaskGroupFactoryMakerService imf, TaskSystemInformation def, String locale) throws TaskSystemException { Set<TaskGroupInformation> specs = imf.list(locale); Map<String, List<TaskGroupInformation>> byInput = byInput(specs); return getPathSpecifications(def.getInputType().getIdentifier(), def.getOutputType().getIdentifier(), byInput); }
java
{ "resource": "" }
q16779
ElementToolbar.addToolbarComponent
train
public void addToolbarComponent(BaseComponent component, String action) { BaseComponent ref = toolbar.getFirstChild(); if (component instanceof Toolbar) { BaseComponent child; while ((child = component.getFirstChild()) != null) { toolbar.addChild(child, ref); } } else { toolbar.addChild(component, ref); ActionUtil.addAction(component, action); } }
java
{ "resource": "" }
q16780
BaseTransform.extractAttribute
train
protected String extractAttribute(String name, String line) { int i = line.indexOf(name + "=\""); i = i == -1 ? i : i + name.length() + 2; int j = i == -1 ? -1 : line.indexOf("\"", i); return j == -1 ? null : line.substring(i, j); }
java
{ "resource": "" }
q16781
BaseTransform.write
train
protected void write(OutputStream outputStream, String data, boolean terminate, int level) { try { if (data != null) { if (level > 0) { outputStream.write(StringUtils.repeat(" ", level).getBytes(CS_UTF8)); } outputStream.write(data.getBytes(CS_UTF8)); if (terminate) { outputStream.write("\n".getBytes()); } } } catch (IOException e) { throw new RuntimeException(e); } }
java
{ "resource": "" }
q16782
PopupSupport.closeAll
train
public synchronized void closeAll() { for (Window window : windows) { try { window.removeEventListener("close", this); window.destroy(); } catch (Throwable e) { } } windows.clear(); resetPosition(); }
java
{ "resource": "" }
q16783
PopupSupport.eventCallback
train
@SuppressWarnings("deprecation") @Override public void eventCallback(String eventName, Object eventData) { try { PopupData popupData = null; if (eventData instanceof PopupData) { popupData = (PopupData) eventData; } else { popupData = new PopupData(eventData.toString()); } if (popupData.isEmpty()) { return; } Page currentPage = ExecutionContext.getPage(); Window window = getPopupWindow(); window.setTitle(popupData.getTitle()); window.setParent(currentPage); String pos = getPosition(); window.addStyle("left", pos); window.addStyle("top", pos); window.addEventListener("close", this); Label label = window.findByName("messagetext", Label.class); label.setLabel(popupData.getMessage()); window.setMode(Mode.POPUP); } catch (Exception e) {} }
java
{ "resource": "" }
q16784
PopupSupport.getPopupWindow
train
private synchronized Window getPopupWindow() throws Exception { if (popupDefinition == null) { popupDefinition = PageParser.getInstance().parse(RESOURCE_PREFIX + "popupWindow.fsp"); } Window window = (Window) popupDefinition.materialize(null); windows.add(window); return window; }
java
{ "resource": "" }
q16785
BeanRegistry.postProcessAfterInitialization
train
@SuppressWarnings("unchecked") @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (clazz.isInstance(bean)) { register((V) bean); } return bean; }
java
{ "resource": "" }
q16786
BeanRegistry.postProcessBeforeDestruction
train
@SuppressWarnings("unchecked") @Override public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException { if (clazz.isInstance(bean)) { unregister((V) bean); } }
java
{ "resource": "" }
q16787
DateRangePicker.loadChoices
train
public void loadChoices(Iterable<String> choices) { clear(); if (choices != null) { for (String choice : choices) { addChoice(choice, false); } } checkSelection(true); }
java
{ "resource": "" }
q16788
DateRangePicker.addChoice
train
public Dateitem addChoice(DateRange range, boolean isCustom) { Dateitem item; if (isCustom) { item = findMatchingItem(range); if (item != null) { return item; } } item = new Dateitem(); item.setLabel(range.getLabel()); item.setData(range); addChild(item, isCustom ? null : customItem); if (range.isDefault()) { setSelectedItem(item); } return item; }
java
{ "resource": "" }
q16789
DateRangePicker.findMatchingItem
train
public Dateitem findMatchingItem(DateRange range) { for (BaseComponent item : getChildren()) { if (range.equals(item.getData())) { return (Dateitem) item; } } return null; }
java
{ "resource": "" }
q16790
DateRangePicker.findMatchingItem
train
public Dateitem findMatchingItem(String label) { for (BaseComponent child : getChildren()) { Dateitem item = (Dateitem) child; if (label.equalsIgnoreCase(item.getLabel())) { return item; } } return null; }
java
{ "resource": "" }
q16791
DateRangePicker.checkSelection
train
private void checkSelection(boolean suppressEvent) { Dateitem selectedItem = getSelectedItem(); if (selectedItem == null) { selectedItem = lastSelectedItem; setSelectedItem(selectedItem); } else if (selectedItem != customItem && lastSelectedItem != selectedItem) { lastSelectedItem = selectedItem; if (!suppressEvent) { EventUtil.send(new Event(ON_SELECT_RANGE, this)); } } updateSelection(); }
java
{ "resource": "" }
q16792
DateRangePicker.updateSelection
train
private void updateSelection() { Dateitem selectedItem = getSelectedItem(); if (selectedItem == null) { addStyle("color", "gray"); } else { addStyle("color", "inherit"); } setFocus(false); }
java
{ "resource": "" }
q16793
DateRangePicker.onChange
train
@EventHandler("change") private void onChange(ChangeEvent event) { // When the custom range item is selected, triggers the display of the date range dialog. if (event.getRelatedTarget() == customItem) { event.stopPropagation(); DateRangeDialog.show((range) -> { setSelectedItem(range == null ? lastSelectedItem : addChoice(range, true)); checkSelection(false); }); }
java
{ "resource": "" }
q16794
FrameworkBeanFactory.getAttribute
train
private String getAttribute(BeanDefinition beanDefinition, String attributeName) { String value = null; while (beanDefinition != null) { value = (String) beanDefinition.getAttribute(attributeName); if (value != null) { break; } beanDefinition = beanDefinition.getOriginatingBeanDefinition(); } return value; }
java
{ "resource": "" }
q16795
PropertyUtil.getValue
train
public static String getValue(String propertyName, String instanceName) { return getPropertyService().getValue(propertyName, instanceName); }
java
{ "resource": "" }
q16796
PropertyUtil.getValues
train
public static List<String> getValues(String propertyName, String instanceName) { return getPropertyService().getValues(propertyName, instanceName); }
java
{ "resource": "" }
q16797
PropertyUtil.saveValue
train
public static void saveValue(String propertyName, String instanceName, boolean asGlobal, String value) { getPropertyService().saveValue(propertyName, instanceName, asGlobal, value); }
java
{ "resource": "" }
q16798
PropertyUtil.saveValues
train
public static void saveValues(String propertyName, String instanceName, boolean asGlobal, List<String> value) { getPropertyService().saveValues(propertyName, instanceName, asGlobal, value); }
java
{ "resource": "" }
q16799
PropertyUtil.getInstances
train
public static List<String> getInstances(String propertyName, boolean asGlobal) { return getPropertyService().getInstances(propertyName, asGlobal); }
java
{ "resource": "" }