hexsha
stringlengths
40
40
size
int64
8
1.04M
content
stringlengths
8
1.04M
avg_line_length
float64
2.24
100
max_line_length
int64
4
1k
alphanum_fraction
float64
0.25
0.97
1fa55b9797a3d5ec0387bca00d98d854a0c962d1
691
package arrays101; public class FindNumberswithEvenNumberofDigits { /** * Solution */ public class Solution { public int findNumbers(int[] nums) { int ans = 0; for (int n : nums) { if (is_even_digits(n)) { ans++; } } return ans; } public boolean is_even_digits(int num) { String num_string = String.valueOf(num); return ((num_string.length() % 2) == 0); } public static void main(String[] args) { int a = -234; System.out.println(String.valueOf(a).length()); } } }
23.033333
59
0.467438
58719cdec612e1730fee082de303d968d529dbfb
12,259
package in.hocg.boot.named.autoconfiguration.aspect; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import in.hocg.boot.named.annotation.InjectNamed; import in.hocg.boot.named.annotation.Named; import in.hocg.boot.named.autoconfiguration.core.CachePool; import in.hocg.boot.named.autoconfiguration.core.NamedCacheService; import in.hocg.boot.named.autoconfiguration.core.NamedRow; import in.hocg.boot.named.autoconfiguration.core.convert.NamedRowsConvert; import in.hocg.boot.named.autoconfiguration.properties.NamedProperties; import in.hocg.boot.named.autoconfiguration.utils.NamedUtils; import in.hocg.boot.named.ifc.NamedArgs; import in.hocg.boot.utils.LangUtils; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Lazy; import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.util.CollectionUtils; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.*; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.stream.Collectors; /** * @author hocgin * @date 2017/11/17 * email: hocgin@gmail.com * 自动填充类型对应的名称 */ @Slf4j @Aspect @RequiredArgsConstructor(onConstructor = @__(@Lazy)) public class NamedAspect implements InitializingBean { private final ApplicationContext context; private final List<NamedRowsConvert> converts; private final NamedProperties properties; private NamedCacheService cacheService; @Pointcut("@within(org.springframework.stereotype.Service) && execution((*) *(..))") public void pointcut() { } @Around("pointcut()") public Object around(ProceedingJoinPoint point) throws Throwable { Stopwatch started = null; if (log.isDebugEnabled()) { started = Stopwatch.createStarted(); log.debug("=> @Named 调用开始, 时间: [{}]", started); } try { NamedContext.push(); Object proceed = point.proceed(); if (log.isDebugEnabled()) { log.debug("=> @Named Service 层处理完成, 时间: [{}]", started); } return handleResult(proceed); } finally { NamedContext.pop(); if (log.isDebugEnabled()) { log.debug("=> @Named 调用结束, 时间: [{}]", LangUtils.callIfNotNull(started, Stopwatch::stop).orElse(null)); } } } public Object handleResult(Object result) { Stopwatch started = null; if (log.isDebugEnabled()) { started = Stopwatch.createStarted(); } List<NamedRow> namedRows = getNamedRows(result); if (log.isDebugEnabled()) { log.debug("1. 查找需要匹配的 @Named 数量: [{}], 时间: [{}]", namedRows.size(), started); } if (CollectionUtils.isEmpty(namedRows)) { return result; } Map<String, List<NamedRow>> namedGroup = namedRows.parallelStream().collect(Collectors.groupingBy(this::getGroupKey)); if (log.isDebugEnabled()) { log.debug("2. @Named 分组数量: [{}], 时间: [{}]", namedGroup.size(), started); } namedGroup.values().parallelStream().forEach(this::injectValue); if (log.isDebugEnabled()) { log.debug("3. @Named 处理完成: [{}], 时间: [{}]", namedGroup.size(), LangUtils.callIfNotNull(started, Stopwatch::stop).orElse(null)); } return result; } private boolean isSupportClass(Class<?> aClass) { return CachePool.isSupportNamed(aClass, clazz -> Arrays.class.isAssignableFrom(clazz) || Collection.class.isAssignableFrom(clazz) || clazz.isAnnotationPresent(InjectNamed.class) || this.converts.stream().anyMatch(convert -> convert.isMatch(clazz))); } protected List<NamedRow> getNamedRows(Object result) { if (!NamedContext.add(NamedContext.id(result))) { return Collections.emptyList(); } // ===================================================================== if (Objects.isNull(result) || !this.isSupportClass(result.getClass())) { return Collections.emptyList(); } if (result instanceof Collection) { return getCollectionNamedRows((Collection<?>) result); } else if (result instanceof Object[]) { return getArrayNamedRows((Object[]) result); } // 扩展点 Optional<NamedRowsConvert> convertOpt = this.converts.stream() .filter(namedRowsConvert -> namedRowsConvert.isMatch(result.getClass())).findFirst(); if (convertOpt.isPresent()) { NamedRowsConvert convert = convertOpt.get(); Object tResult = convert.convert(result); if (Objects.isNull(tResult) || tResult.getClass().equals(result.getClass())) { log.warn("在 @Named 扩展了非法转换器[{}], 请及时更正", convert.getClass()); return Collections.emptyList(); } return getNamedRows(tResult); } return getObjectNamedRows(result); } private List<NamedRow> getObjectNamedRows(Object result) { // 解析对象的字段 ConcurrentLinkedQueue<NamedRow> namedRows = new ConcurrentLinkedQueue<>(); Map<String, Field> fieldMap = NamedUtils.getAllField(result.getClass()); fieldMap.values().parallelStream().forEach(field -> { if (AnnotatedElementUtils.hasAnnotation(field, Named.class)) { getNamedRow(result, fieldMap, field).ifPresent(namedRows::add); } else if (isSupportClass(field.getType())) { final Object value = NamedUtils.getFieldValue(result, field); namedRows.addAll(getNamedRows(value)); } }); return Lists.newArrayList(namedRows); } /** * 获取需要 * * @param target 当前对象 * @param fieldMap 当前对象的所有字段 * @param targetField 等待@Named的对象 * @return */ private Optional<NamedRow> getNamedRow(Object target, Map<String, Field> fieldMap, Field targetField) { final Named named = AnnotatedElementUtils.getMergedAnnotation(targetField, Named.class); final Field idField = fieldMap.get(named.idFor()); if (Objects.isNull(idField)) { return Optional.empty(); } Class<?> nameServiceClass = named.useService(); Object serviceBean = this.getNamedServiceClassMaps().get(nameServiceClass); return Optional.of(new NamedRow() .setUseCache(named.useCache()) .setTarget(target) .setIdValue(NamedUtils.getFieldValue(target, idField)) .setArgs(named.args()) .setServiceObject(serviceBean) .setTargetField(targetField) .setNamedType(named.type())); } private List<NamedRow> getArrayNamedRows(Object[] result) { return getCollectionNamedRows(Lists.newArrayList(result)); } private List<NamedRow> getCollectionNamedRows(Collection<?> result) { return result.parallelStream().flatMap(o -> getNamedRows(o).parallelStream()) .collect(Collectors.toList()); } private void injectValue(List<NamedRow> namedRows) { injectValueWithCache(namedRows); injectValueWithMethod(namedRows); } /** * 从缓存中读取 * * @param namedRows */ private void injectValueWithCache(List<NamedRow> namedRows) { Map<String, List<NamedRow>> namedRowMaps = namedRows.stream() .filter(NamedRow::getUseCache) .filter(namedRow -> Objects.isNull(namedRow.getTargetValue()) && Objects.nonNull(namedRow.getIdValue())) .collect(Collectors.groupingBy(this::getCacheKey)); if (CollUtil.isEmpty(namedRowMaps)) { return; } // 读取缓存内容 Map<String, Object> values = cacheService.batchGet(namedRowMaps.keySet()); if (CollUtil.isEmpty(values)) { return; } values.entrySet().parallelStream().filter(entry -> Objects.nonNull(entry.getValue())).forEach(entry -> namedRowMaps.getOrDefault(entry.getKey(), Collections.emptyList()).forEach(row -> setValue(row, entry.getValue())) ); } /** * 从 Service 中读取 * * @param namedRows */ private void injectValueWithMethod(List<NamedRow> namedRows) { Map<Object, List<NamedRow>> idNamedRowGroup = namedRows.stream() .filter(namedRow -> Objects.isNull(namedRow.getTargetValue()) && Objects.nonNull(namedRow.getIdValue())) .collect(Collectors.groupingBy(row -> String.valueOf(row.getIdValue()))); if (CollUtil.isEmpty(idNamedRowGroup)) { return; } // 提取关键信息 NamedRow namedRow = namedRows.get(0); String namedType = namedRow.getNamedType(); Object serviceObject = namedRow.getServiceObject(); String[] args = namedRow.getArgs(); Object[] ids = idNamedRowGroup.keySet().toArray(); Map<String, Object> values = this.callNamedHandleMethod(serviceObject, namedType, ids, args); log.debug("===> {}-{}-{}::{}", namedType, ids, args, values); if (CollUtil.isEmpty(values)) { return; } // 进行翻译工作 Map<String, Object> caches = Maps.newConcurrentMap(); values.entrySet().parallelStream().filter(entry -> Objects.nonNull(entry.getValue())).forEach(entry -> idNamedRowGroup.getOrDefault(entry.getKey(), Collections.emptyList()).forEach(row -> caches.put(getCacheKey(row), setValue(row, entry.getValue()))) ); if (CollUtil.isNotEmpty(caches)) { // 批量更新到缓存中.. cacheService.batchPut(caches); } } private Object setValue(NamedRow namedRow, Object value) { if (Objects.isNull(value)) { return null; } namedRow.setTargetValue(value); NamedUtils.setFieldValue(namedRow.getTarget(), namedRow.getTargetField(), value); return value; } private String getGroupKey(NamedRow namedRow) { return StrUtil.format("{}@{}", namedRow.getNamedType(), Arrays.toString(namedRow.getArgs())); } private String getCacheKey(NamedRow namedRow) { String prefix = StrUtil.nullToEmpty(properties.getCache().getPrefix()); return StrUtil.format("{}:{}", prefix, cacheService.getCacheKey(namedRow)); } private Map<String, Object> callNamedHandleMethod(Object namedService, String namedType, Object[] ids, String[] args) { Method method = NamedUtils.getNamedHandleMethod(namedService.getClass(), namedType); if (Objects.isNull(method)) { return Collections.emptyMap(); } NamedArgs namedArgs = new NamedArgs().setArgs(args).setValues(Lists.newArrayList(ids)); try { Object invokeResult = method.invoke(namedService, namedArgs); if (Objects.isNull(invokeResult)) { return Collections.emptyMap(); } else if (invokeResult instanceof Map) { return (Map) invokeResult; } else { return Collections.emptyMap(); } } catch (Exception e) { log.warn("服务调用失败, 请检查参数 @Named 提供者[{}], 函数[{}], 参数[{}]", namedService, method, JSONUtil.toJsonStr(namedArgs), e); return Collections.emptyMap(); } } public Map<Class<?>, Object> getNamedServiceClassMaps() { return CachePool.NAMED_SERVICE_CLASS_MAPS; } @Override public void afterPropertiesSet() throws Exception { cacheService = context.getBean(NamedCacheService.class); try { CachePool.load(context); } catch (Exception e) { log.warn("@Named 预缓存发生错误", e); } } }
38.794304
159
0.635615
7017f8fdf7041be722fd761c7700ae039ebb50ac
3,563
/* * Copyright The OpenTelemetry Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.opentelemetry.auto.instrumentation.rabbitmq.amqp; import static io.opentelemetry.auto.instrumentation.rabbitmq.amqp.RabbitCommandInstrumentation.SpanHolder.CURRENT_RABBIT_SPAN; import static io.opentelemetry.auto.instrumentation.rabbitmq.amqp.RabbitDecorator.DECORATE; import static io.opentelemetry.auto.tooling.ClassLoaderMatcher.hasClassesNamed; import static io.opentelemetry.auto.tooling.bytebuddy.matcher.AgentElementMatchers.implementsInterface; import static java.util.Collections.singletonMap; import static net.bytebuddy.matcher.ElementMatchers.isConstructor; import static net.bytebuddy.matcher.ElementMatchers.named; import com.google.auto.service.AutoService; import com.rabbitmq.client.Command; import io.opentelemetry.auto.tooling.Instrumenter; import io.opentelemetry.trace.Span; import java.util.Map; import net.bytebuddy.asm.Advice; import net.bytebuddy.description.method.MethodDescription; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.matcher.ElementMatcher; @AutoService(Instrumenter.class) public class RabbitCommandInstrumentation extends Instrumenter.Default { public RabbitCommandInstrumentation() { super("amqp", "rabbitmq"); } @Override public ElementMatcher<ClassLoader> classLoaderMatcher() { // Optimization for expensive typeMatcher. return hasClassesNamed("com.rabbitmq.client.Command"); } @Override public ElementMatcher<TypeDescription> typeMatcher() { return implementsInterface(named("com.rabbitmq.client.Command")); } @Override public String[] helperClassNames() { return new String[] { packageName + ".RabbitDecorator", // These are only used by muzzleCheck: packageName + ".TextMapExtractAdapter", packageName + ".TracedDelegatingConsumer", RabbitCommandInstrumentation.class.getName() + "$SpanHolder" }; } @Override public Map<? extends ElementMatcher<? super MethodDescription>, String> transformers() { return singletonMap( isConstructor(), RabbitCommandInstrumentation.class.getName() + "$CommandConstructorAdvice"); } public static class SpanHolder { public static final ThreadLocal<Span> CURRENT_RABBIT_SPAN = new ThreadLocal<>(); } public static class CommandConstructorAdvice { @Advice.OnMethodExit public static void setSpanNameAddHeaders(@Advice.This final Command command) { final Span span = CURRENT_RABBIT_SPAN.get(); if (span != null && command.getMethod() != null) { DECORATE.onCommand(span, command); } } /** * This instrumentation will match with 2.6, but the channel instrumentation only matches with * 2.7 because of TracedDelegatingConsumer. This unused method is added to ensure consistent * muzzle validation by preventing match with 2.6. */ public static void muzzleCheck(final TracedDelegatingConsumer consumer) { consumer.handleRecoverOk(null); } } }
37.114583
126
0.762279
a2959cb89541c8f98f019e4280388ac1a680d632
374
public class Matriz { public static float[][] transpose(float A[][]) { int Rows = A.length, int Columns = A[0].length; float[][] resultant = new float[Columns][Rows]; for(int i = 0; i < Rows; i++) for (int j = 0; j < Columns; j++) resultant[j][i] = a[i][j]; return resultant; } }
20.777778
55
0.465241
4a3c4a981e2169ee731630a95594986f0bc12f7d
1,684
package com.sen.concurrency2.chapter2; import java.util.stream.IntStream; import java.util.stream.Stream; /** * @Author: Sen * @Date: 2019/12/8 23:24 * @Description: 多线程的休息室,调用 {@code wait()} 的线程会进入waitSet等待队列 */ public class WaitSet { private final static Object LOCK = new Object(); private static void test() { System.out.println("thread come in lock"); synchronized (LOCK) { System.out.println("thread begin to wait"); try { LOCK.wait(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("thread end to wait"); } } public static void main(String[] args) throws InterruptedException { /*new Thread(WaitSet::test).start(); Thread.sleep(3000); synchronized (LOCK) { LOCK.notify(); }*/ IntStream.rangeClosed(1, 10).forEach(i->new Thread(String.valueOf(i)){ @Override public void run() { synchronized (LOCK) { System.out.println(Thread.currentThread().getName() + " come in wait set --"); try { LOCK.wait(); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName() + " leaves wait set =="); } } }.start()); Thread.sleep(1000); IntStream.rangeClosed(1, 10).forEach(i->{ synchronized (LOCK) { LOCK.notify(); } }); } }
28.066667
98
0.505344
e45a6ef520e25f5ce3d67e895bfe98dc5d5e998b
92
/** * @author Aaron Ponti * */ package ch.ethz.scu.obit.at.gui.viewers.data.model.icons;
18.4
57
0.673913
01e6730dba4b5d4b8a0944f865e906b9bc8299d6
933
package com.ternsip.glade.universe.common; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.Setter; import org.joml.Vector3f; import org.joml.Vector3fc; @RequiredArgsConstructor @Getter @Setter public class Balance { private float playerArmLength = 5; private float playerExamineLength = 10; private float fogDensity = 0.0075f; private float fogGradient = 5.0f; private Vector3f fogColor = new Vector3f(0.0f, 0.5f, 0.75f); private float underwaterFogDensity = 0.15f; private float underwaterFogGradient = 5.0f; private Vector3f underwaterFogColor = new Vector3f(0.097f, 0.097f, 0.43f); private int viewDistance = 8; // TODO move it to Options class, and fog and split this into client and server option-balance private int physicalTicksPerSecond = 128; private int networkTicksPerSecond = 20; private Vector3fc gravity = new Vector3f(0, -0.005f, 0); }
30.096774
128
0.748124
c3f6854ca349d13716178c53625035264d831b43
790
package school.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import school.mapper.HouseMapper; import school.service.HouseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import school.support.pojo.HousePojo; import tk.mybatis.mapper.entity.Example; @Service @Transactional public class HouseServiceImpl implements HouseService { @Autowired private HouseMapper houseMapper; @Override public PageInfo<HousePojo> selectReByExample(Example example, Integer pageSize, Integer pageNum) { PageHelper.startPage(pageNum, pageSize); return new PageInfo<>(houseMapper.selectReByExample(example), 5); } }
30.384615
99
0.831646
e026914db8f8fd8c080d14a3ad12d314153a0ee7
9,751
package org.smartregister.anc.library.listener; import android.app.AlertDialog; import android.content.Context; import android.view.View; import org.smartregister.anc.library.constants.ANCJsonFormConstants; import com.vijay.jsonwizard.domain.ExpansionPanelValuesModel; import com.vijay.jsonwizard.utils.FormUtils; import org.apache.commons.lang3.StringUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.smartregister.anc.library.R; import org.smartregister.anc.library.fragment.ProfileTasksFragment; import org.smartregister.anc.library.model.Task; import org.smartregister.anc.library.util.ANCFormUtils; import org.smartregister.anc.library.util.ANCJsonFormUtils; import java.util.Calendar; import java.util.HashMap; import java.util.Map; import timber.log.Timber; public class ContactTaskDisplayClickListener implements View.OnClickListener { private ProfileTasksFragment profileTasksFragment; private ANCFormUtils ANCFormUtils = new ANCFormUtils(); public ContactTaskDisplayClickListener(ProfileTasksFragment profileTasksFragment) { this.profileTasksFragment = profileTasksFragment; } @Override public void onClick(View view) { if (view != null) { if (view.getId() == R.id.accordion_info_icon) { infoAlertDialog(view); } else if (view.getId() == R.id.undo_button) { undoTasksEntries(view); } else { prepFormForLaunch(view); } } } /** * Displays the extra info on the expansion panel widget. * * @param view {@link View} */ private void infoAlertDialog(View view) { Context context = ((Context) view.getTag(R.id.accordion_context)); AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, R.style.AppThemeAlertDialog); builderSingle.setTitle((String) view.getTag(R.id.accordion_info_title)); builderSingle.setMessage((String) view.getTag(R.id.accordion_info_text)); builderSingle.setIcon(com.vijay.jsonwizard.R.drawable.dialog_info_filled); builderSingle.setNegativeButton(context.getResources().getString(R.string.ok), (dialog, which) -> dialog.dismiss()); builderSingle.show(); } /** * Intitiates the undo tasks functionality * * @param view {@link View} */ private void undoTasksEntries(View view) { Context context = ((Context) view.getTag(R.id.accordion_context)); Task task = ((Task) view.getTag(R.id.task_object)); JSONObject taskValue = ((JSONObject) view.getTag(R.id.accordion_jsonObject)); if (context != null && task != null && taskValue != null) { Task newTask = createTask(removeTestResults(taskValue), task); profileTasksFragment.updateTask(newTask); } } /** * This performs all the necessary calculations to get the form ready for launch. This updates the title, * Adds the new form fields * * @param view {@link View} */ private void prepFormForLaunch(View view) { Context context = ((Context) view.getTag(R.id.accordion_context)); Task task = ((Task) view.getTag(R.id.task_object)); JSONObject taskValue = ((JSONObject) view.getTag(R.id.accordion_jsonObject)); if (context != null && task != null && taskValue != null) { JSONArray taskValues = getExpansionPanelValues(taskValue, task.getKey()); Map<String, ExpansionPanelValuesModel> secondaryValuesMap = getSecondaryValues(taskValues); JSONArray subFormFields = ANCFormUtils.addExpansionPanelFormValues(loadSubFormFields(taskValue, context).entrySet().iterator().next().getValue(), secondaryValuesMap); String taskKey = taskValue.optString(ANCJsonFormConstants.KEY); String formTitle = ANCFormUtils.getTranslatedFormTitle(taskKey, context); JSONObject form = ANCFormUtils.loadTasksForm(context); if (StringUtils.isNotBlank(formTitle)) { updateFormTitle(form, formTitle); } ANCFormUtils.updateFormFields(form, subFormFields); // Update form properties file name according to the test fields populated ANCFormUtils.updateFormPropertiesFileName(form, taskValue, context); profileTasksFragment.startTaskForm(form, task); } } private void addMlsPropertyFile(JSONObject form, String mlsPropertyFile) { try { if (form != null && StringUtils.isNotBlank(mlsPropertyFile)) { form.put(ANCJsonFormConstants.MLS.PROPERTIES_FILE_NAME, mlsPropertyFile); } } catch (JSONException e) { Timber.e(e, " --> add mls property file"); } } /** * Creates the new updated tasks with the the new values * * @param taskValue {@link JSONObject} * @param task {@link Task} * @return task {@link Task} */ private Task createTask(JSONObject taskValue, Task task) { Task newTask = new Task(); newTask.setId(task.getId()); newTask.setBaseEntityId(task.getBaseEntityId()); newTask.setKey(task.getKey()); newTask.setValue(String.valueOf(taskValue)); newTask.setUpdated(true); newTask.setComplete(ANCJsonFormUtils.checkIfTaskIsComplete(taskValue)); newTask.setCreatedAt(Calendar.getInstance().getTimeInMillis()); return newTask; } /** * Removes the task values & sets it to empty. * * @param taskValue {@link JSONObject} * @return task {@link JSONObject} */ private JSONObject removeTestResults(JSONObject taskValue) { JSONObject task = new JSONObject(); if (taskValue != null && taskValue.has(ANCJsonFormConstants.VALUE)) { taskValue.remove(ANCJsonFormConstants.VALUE); task = taskValue; } return task; } /** * Returns the expansion panel values which were selected from the forms. * * @param taskValue {@link JSONObject} * @param taskKey {@link String} * @return values {@link JSONArray} */ private JSONArray getExpansionPanelValues(JSONObject taskValue, String taskKey) { JSONArray values = new JSONArray(); if (taskValue != null && StringUtils.isNotBlank(taskKey)) { JSONArray taskValueArray = new JSONArray(); taskValueArray.put(taskValue); values = ANCFormUtils.loadExpansionPanelValues(taskValueArray, taskKey); } return values; } /** * Returns a map of the expansion panel values * * @param secondaryValues {@link JSONArray} * @return expansionPanelValuesMap = {@link Map} */ private Map<String, ExpansionPanelValuesModel> getSecondaryValues(JSONArray secondaryValues) { Map<String, ExpansionPanelValuesModel> stringExpansionPanelValuesModelMap = new HashMap<>(); if (secondaryValues != null && secondaryValues.length() > 0) { stringExpansionPanelValuesModelMap = ANCFormUtils.createSecondaryValuesMap(secondaryValues); } return stringExpansionPanelValuesModelMap; } /** * Loads the sub forms using the name on the accordion. It returns the sub form fields * * @param taskValue {@link JSONObject} * @param context {@link Context} * @return fields {@link JSONArray} */ private Map<String, JSONArray> loadSubFormFields(JSONObject taskValue, Context context) { String mlsPropertyFile = ""; JSONArray fields = new JSONArray(); Map<String, JSONArray> stringJSONArrayMap = new HashMap<>(); try { if (taskValue != null && taskValue.has(ANCJsonFormConstants.CONTENT_FORM)) { String subFormName = taskValue.getString(ANCJsonFormConstants.CONTENT_FORM); JSONObject subForm = FormUtils.getSubFormJson(subFormName, "", context); if (subForm.has(ANCJsonFormConstants.CONTENT_FORM)) { fields = subForm.getJSONArray(ANCJsonFormConstants.CONTENT_FORM); } if (subForm.has(ANCJsonFormConstants.MLS.PROPERTIES_FILE_NAME)) { mlsPropertyFile = subForm.getString(ANCJsonFormConstants.MLS.PROPERTIES_FILE_NAME); } stringJSONArrayMap.put(mlsPropertyFile, fields); } } catch (JSONException e) { Timber.e(e, " --> loadSubFormFields"); } catch (Exception e) { Timber.e(e, " --> loadSubFormFields"); } return stringJSONArrayMap; } /** * Get the form title for the accordion text * * @param taskValue {@link JSONObject} * @return title {@link String} */ private String getFormTitle(JSONObject taskValue) { String title = ""; if (taskValue != null && taskValue.has(ANCJsonFormConstants.TEXT)) { title = taskValue.optString(ANCJsonFormConstants.TEXT); } return title; } /** * Updates the form step1 title to match the test header * * @param form {@link JSONObject} * @param title {@link String} */ private void updateFormTitle(JSONObject form, String title) { try { if (form != null && StringUtils.isNotBlank(title) && form.has(ANCJsonFormConstants.STEP1)) { JSONObject stepOne = form.getJSONObject(ANCJsonFormConstants.STEP1); stepOne.put(ANCJsonFormConstants.STEP_TITLE, title); } } catch (JSONException e) { Timber.e(e, " --> updateFormTitle"); } } }
39.004
178
0.651933
fbf5942a3df469156695fb501bb3a6f98242079c
461
package br.com.ermig.cliente.repository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.repository.PagingAndSortingRepository; import br.com.ermig.cliente.model.Cliente; public interface ClienteRepository extends PagingAndSortingRepository<Cliente, Long> { Page<Cliente> findByCpfContainsAndNomeContains(final String cpf, final String nome, final Pageable pageable); }
32.928571
113
0.828633
fa3fbb6cbb759745167a78f4d6c13fbf2f211fbe
2,515
package ru.job4j.additionaltasks.robotwalk; import java.util.*; /** * Задан двухмерный массив. Массив заполнен нулями и единицами. * Робот может ходить только по единицам. Задана начальная и конечная точки. * Робот может ходить вверх, вниз, влево и вправо. * Необходимо найти минимальный путь до конечной точки. */ public class RobotWalk { /** * Обход по ширине. * * @param board массив, по которому идёт движение. * @param sx Х координата стартовой точки. * @param sy Y координата стартовой точки. * @param fx X координата финишной точки. * @param fy Y координата финишной точки. * @return расстояние от начальной точки до конечной. * Если координаты точек совпадают- вернёт 0. * Если до финишной точки не добраться * или значение board[fx][fy] является 0 - вернёт -1. */ public int minWay(int[][] board, int sx, int sy, int fx, int fy) { int result = -1; if (board[fx][fy] == 0) { return result; } int boardLength = board.length; NodeForWalk buffer; int stepX; int stepY; int newWay; boolean[][] control = new boolean[boardLength][boardLength]; Queue<NodeForWalk> search = new LinkedList<>(Arrays.asList(new NodeForWalk(sx, sy, 0))); while (!search.isEmpty()) { buffer = search.poll(); stepX = buffer.getX(); stepY = buffer.getY(); newWay = buffer.getWay(); control[stepX][stepY] = true; if (stepX == fx && stepY == fy) { return buffer.getWay(); } else { newWay++; if (stepX + 1 < boardLength && board[stepX + 1][stepY] == 1 && !control[stepX + 1][stepY]) { search.add(new NodeForWalk(stepX + 1, stepY, newWay)); } if (stepX - 1 >= 0 && board[stepX - 1][stepY] == 1 && !control[stepX - 1][stepY]) { search.add(new NodeForWalk(stepX - 1, stepY, newWay)); } if (stepY + 1 < boardLength && board[stepX][stepY + 1] == 1 && !control[stepX][stepY + 1]) { search.add(new NodeForWalk(stepX, stepY + 1, newWay)); } if (stepY - 1 >= 0 && board[stepX][stepY - 1] == 1 && !control[stepX][stepY - 1]) { search.add(new NodeForWalk(stepX, stepY - 1, newWay)); } } } return result; } }
39.296875
108
0.539563
f4a7bc1699d0652ad602e944c82b1c8db41f61b8
2,799
package cucumber.formatter; import cucumber.io.ClasspathResourceLoader; import cucumber.runtime.Backend; import cucumber.runtime.Runtime; import cucumber.runtime.RuntimeOptions; import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit; import org.junit.Test; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import static java.util.Arrays.asList; import static junit.framework.Assert.assertTrue; import static org.mockito.Mockito.mock; public class JUnitFormatterTest { @Test public void featureSimpleTest() throws Exception { File report = runFeaturesWithJunitFormatter(asList("cucumber/formatter/JUnitFormatterTest_1.feature")); assertXmlEqual("cucumber/formatter/JUnitFormatterTest_1.report.xml", report); } @Test public void featureWithBackgroundTest() throws Exception { File report = runFeaturesWithJunitFormatter(asList("cucumber/formatter/JUnitFormatterTest_2.feature")); assertXmlEqual("cucumber/formatter/JUnitFormatterTest_2.report.xml", report); } @Test public void featureWithOutlineTest() throws Exception { File report = runFeaturesWithJunitFormatter(asList("cucumber/formatter/JUnitFormatterTest_3.feature")); assertXmlEqual("cucumber/formatter/JUnitFormatterTest_3.report.xml", report); } private File runFeaturesWithJunitFormatter(final List<String> featurePaths) throws IOException { File report = File.createTempFile("cucumber-jvm-junit", "xml"); final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader(classLoader); List<String> args = new ArrayList<String>(); args.add("--format"); args.add("junit:" + report.getAbsolutePath()); args.addAll(featurePaths); RuntimeOptions runtimeOptions = new RuntimeOptions(args.toArray(new String[args.size()])); final cucumber.runtime.Runtime runtime = new Runtime(resourceLoader, classLoader, asList(mock(Backend.class)), runtimeOptions); runtime.run(); return report; } private void assertXmlEqual(String expected, File actual) throws IOException, ParserConfigurationException, SAXException { XMLUnit.setIgnoreWhitespace(true); InputStreamReader control = new InputStreamReader(Thread.currentThread().getContextClassLoader().getResourceAsStream(expected), "UTF-8"); Diff diff = new Diff(control, new FileReader(actual)); assertTrue("XML files are similar " + diff, diff.identical()); } }
41.161765
145
0.754555
8188c4574f3c7a47e52cf54ffd95e9d9f9373ad4
2,489
/** * Copyright 2005-2015 The Kuali Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.opensource.org/licenses/ecl2.php * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.kuali.rice.krad.bo; import org.hibernate.annotations.Type; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * */ @Entity @Table(name="KRNS_NTE_TYP_T") public class NoteType extends PersistableBusinessObjectBase { @Id @Column(name="NTE_TYP_CD") private String noteTypeCode; @Column(name="TYP_DESC_TXT") private String noteTypeDescription; @Type(type="yes_no") @Column(name="ACTV_IND") private boolean noteTypeActiveIndicator; /** * Default constructor. */ public NoteType() { } /** * Gets the noteTypeCode attribute. * * @return Returns the noteTypeCode * */ public String getNoteTypeCode() { return noteTypeCode; } /** * Sets the noteTypeCode attribute. * * @param noteTypeCode The noteTypeCode to set. * */ public void setNoteTypeCode(String noteTypeCode) { this.noteTypeCode = noteTypeCode; } /** * Gets the noteTypeDescription attribute. * * @return Returns the noteTypeDescription * */ public String getNoteTypeDescription() { return noteTypeDescription; } /** * Sets the noteTypeDescription attribute. * * @param noteTypeDescription The noteTypeDescription to set. * */ public void setNoteTypeDescription(String noteTypeDescription) { this.noteTypeDescription = noteTypeDescription; } /** * Gets the noteTypeActiveIndicator attribute. * * @return Returns the noteTypeActiveIndicator * */ public boolean isNoteTypeActiveIndicator() { return noteTypeActiveIndicator; } /** * Sets the noteTypeActiveIndicator attribute. * * @param noteTypeActiveIndicator The noteTypeActiveIndicator to set. * */ public void setNoteTypeActiveIndicator(boolean noteTypeActiveIndicator) { this.noteTypeActiveIndicator = noteTypeActiveIndicator; } }
22.026549
81
0.734431
8a88f9371fa0ff936c37350ce947f7e7b45f17b3
2,303
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.spi.extexecution.destroy; import java.util.Map; import org.netbeans.api.extexecution.base.Processes; import org.netbeans.spi.extexecution.base.ProcessesImplementation; /** * A service capable of properly terminating external process along with any * child processes created during execution. * <p> * Implementation of this interface should be published in default lookup * in order to be used by * {@link org.netbeans.api.extexecution.ExternalProcessSupport#destroy(java.lang.Process, java.util.Map)} * and {@link org.netbeans.api.extexecution.ExternalProcessBuilder}. * <p> * Note: not to be implemented by modules, might not be present in all versions * of the application. * Please use {@link org.netbeans.api.extexecution.ExternalProcessSupport#destroy(java.lang.Process, java.util.Map)} * for accessing the service. * * @author mkleint * @since 1.16 * @deprecated use {@link ProcessesImplementation} and {@link Processes} */ public interface ProcessDestroyPerformer { /** * Destroys the process passed as parameter and attempts to terminate all child * processes created during the process' execution. * * @param process process to kill * @param env Map containing environment variable names and values. * Any process running with such envvar's value will be * terminated. Improves localization of child processes. */ void destroy(Process process, Map<String, String> env); }
40.403509
116
0.743378
c958a20ea5c330e266f2a6451c12ecc06ae87e37
1,503
package org.diplomatiq.diplomatiqbackend.configuration; import org.neo4j.ogm.session.SessionFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.transaction.Neo4jTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableNeo4jRepositories("org.diplomatiq.diplomatiqbackend.repositories") @EnableTransactionManagement public class Neo4jConfiguration { @Value("${neo4j.uri}") private String uri; @Value("${neo4j.username}") private String username; @Value("${neo4j.password}") private String password; @Value("${neo4j.database}") private String database; @Bean public SessionFactory sessionFactory() { return new SessionFactory(configuration(), "org.diplomatiq.diplomatiqbackend.domain.entities"); } @Bean public org.neo4j.ogm.config.Configuration configuration() { return new org.neo4j.ogm.config.Configuration.Builder() .uri(uri) .credentials(username, password) .database(database) .autoIndex("update") .build(); } @Bean public Neo4jTransactionManager transactionManager() { return new Neo4jTransactionManager(sessionFactory()); } }
31.978723
103
0.739854
a5436f0680e610a29de0fd0d5410dbcbf14cb393
8,115
package org.swiftboot.auth.service.impl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.swiftboot.auth.config.SwiftbootAuthConfigBean; import org.swiftboot.auth.service.Session; import org.swiftboot.auth.service.SessionService; import org.swiftboot.service.service.RedisService; import org.swiftboot.web.exception.ErrMessageException; import org.swiftboot.web.exception.ErrorCodeSupport; import redis.clients.jedis.Jedis; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.annotation.Resource; import java.io.IOException; import static org.apache.commons.lang3.StringUtils.isBlank; /** * 用 Redis 实现会话(Session)控制,客户端采用 Jedis * 当部署集群时或多服务器时启用,非集群时使用 {@code SessionServiceImpl} * * @author swiftech */ public class SessionServiceRedisImpl implements SessionService { private final Logger log = LoggerFactory.getLogger(SessionServiceRedisImpl.class); private final ObjectMapper mapper = new ObjectMapper(); @Resource private RedisService redisService; @Resource private SwiftbootAuthConfigBean config; @PostConstruct public void init() { } @PreDestroy public void destroy() { try (Jedis jedis = redisService.getJedis()) { if (jedis != null && jedis.isConnected()) { jedis.disconnect(); } } } @Override public void addSession(String token, Session session) throws RuntimeException { if (isBlank(token) || session == null) { throw new RuntimeException("Params for session not provided"); } try { // Session 中的超时时间覆盖配置中的超时时间 if (session.getExpireTime() == null) { if (config.getSession().getExpiresIn() > 0) { session.setExpireTime(System.currentTimeMillis() + (config.getSession().getExpiresIn() * 1000L)); } } else { if (session.getExpireTime() <= 0) { // session 没有超时时间 session.setExpireTime(null); } } this.saveSession(token, session); } catch (JsonProcessingException e) { e.printStackTrace(); throw new RuntimeException(String.format("Save session of %s failed", session.getUserId())); } } private void saveSession(String token, Session session) throws JsonProcessingException { byte[] bytes = mapper.writeValueAsBytes(session); long ret; try (Jedis jedis = redisService.getJedis()) { if (isBlank(session.getGroup())) { if (StringUtils.isNotBlank(config.getSession().getGroup())) { ret = jedis.hset(config.getSession().getGroup(), token, new String(bytes));// group -> token -> 会话 log.debug(String.format("Session %s %s, expired at %s", token, ret == 0 ? "updated" : "created", session.getExpireTime() == null ? "never" : DateFormatUtils.format(session.getExpireTime(), "yyyy-MM-dd HH:mm:ss"))); } else { jedis.set(token.getBytes(), bytes); // token -> 会话 } } else { ret = jedis.hset(session.getGroup(), token, new String(bytes));// group -> token -> 会话 log.debug(String.format("Session %s %s, expired at %s", token, ret == 0 ? "updated" : "created", session.getExpireTime() == null ? "never" : DateFormatUtils.format(session.getExpireTime(), "yyyy-MM-dd HH:mm:ss"))); } } } @Override public Session getSession(String token) { return getSession(config.getSession().getGroup(), token); } @Override public Session getSession(String group, String token) { if (isBlank(token)) { return null; } if (StringUtils.isBlank(group)) { group = config.getSession().getGroup(); } log.debug(String.format("token: %s", token)); byte[] bytes; try (Jedis jedis = redisService.getJedis()) { String jsonSession; if (StringUtils.isNotBlank(group)) { jsonSession = jedis.hget(group, token); if (isBlank(jsonSession)) { return null; } else { bytes = jsonSession.getBytes(); } } else { bytes = jedis.get(token.getBytes()); if (bytes == null || bytes.length == 0) { return null; } } log.debug(new String(bytes)); try { return mapper.readValue(bytes, Session.class); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException("Session is invalid"); } } catch (Exception e) { log.error("Get session error, token=" + token, e); return null; } } @Override public void removeSession(String token) { this.removeSession(config.getSession().getGroup(), token); } @Override public void removeSession(String group, String token) { Long result; try (Jedis jedis = redisService.getJedis()) { if (StringUtils.isNotBlank(group)) { result = jedis.hdel(group, token); } else { if (StringUtils.isNotBlank(config.getSession().getGroup())) { result = jedis.hdel(config.getSession().getGroup(), token); } else { result = jedis.del(token); } } } if (result <= 0) { throw new RuntimeException("Remove session failed, token: " + token); } } @Override public Session verifySession(String token) { return this.verifySession(config.getSession().getGroup(), token); } @Override public Session verifySession(String group, String token) { Session session = null; try { session = this.getSession(group, token); } catch (Exception e) { e.printStackTrace(); log.warn(String.format("Retrieve session failed: %s", token)); throw new ErrMessageException(ErrorCodeSupport.CODE_SYS_ERR); } if (session == null) { throw new ErrMessageException(ErrorCodeSupport.CODE_USER_SESSION_NOT_EXIST); } if (session.getExpireTime() != null) { if (session.getExpireTime() < System.currentTimeMillis()) { // Delete session if it is already timeout this.removeSession(group, token); throw new ErrMessageException(ErrorCodeSupport.CODE_SESSION_TIMEOUT); } else { if (config.getSession().isUpdateExpireTime()) { // Update expire time if allowed and there is expired time in session session.setExpireTime(System.currentTimeMillis() + (config.getSession().getExpiresIn() * 1000L)); try { this.saveSession(token, session); } catch (JsonProcessingException e) { e.printStackTrace(); throw new RuntimeException(String.format("Save session of %s failed", session.getUserId())); } } return session; } } return session; } @Override public void clearAllSessions() { if (StringUtils.isNoneBlank(config.getSession().getGroup())) { redisService.del(config.getSession().getGroup()); } } }
35.592105
145
0.56414
fd49921816e6b4bd6e66d0b30d0bb2243b68e127
535
package com.liuyj.secondkill.service.impl; import com.liuyj.secondkill.pojo.SeckillOrder; import com.liuyj.secondkill.mapper.SeckillOrderMapper; import com.liuyj.secondkill.service.ISeckillOrderService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; /** * <p> * 服务实现类 * </p> * * @author LiuYunJie * @since 2022-01-23 */ @Service public class SeckillOrderServiceImpl extends ServiceImpl<SeckillOrderMapper, SeckillOrder> implements ISeckillOrderService { }
25.47619
124
0.801869
e8ce4f4b2a941f980e1c82bd79a188631181cc18
8,349
/* * This project constitutes a work of the United States Government and is * not subject to domestic copyright protection under 17 USC § 105. * * However, because the project utilizes code licensed from contributors * and other third parties, it therefore is licensed under the MIT * License. http://opensource.org/licenses/mit-license.php. Under that * license, permission is granted free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the conditions that any appropriate copyright notices and this * permission notice are included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package gov.whitehouse.utils; import android.app.Activity; import android.content.Context; import android.widget.Toast; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import gov.whitehouse.R; import gov.whitehouse.core.FavoritesMap; import gov.whitehouse.core.FeedItem; import static android.widget.Toast.LENGTH_SHORT; public class FavoritesUtils { public static final String FAVORITE_ARTICLES = "articles"; public static final String FAVORITE_PHOTOS = "photos"; public static final String FAVORITE_VIDEOS = "videos"; public static final String FAVORITES_FILE = "favorites_map.json"; public static FileInputStream getInputStream(final Context context) throws FileNotFoundException { return context.openFileInput(FAVORITES_FILE); } public static FileOutputStream getOutputStream(final Context context) { try { return context.openFileOutput(FAVORITES_FILE, 0); } catch (FileNotFoundException e) { return null; } } public static File getFileDescriptor(final Context context) { return context.getFileStreamPath(FAVORITES_FILE); } public static boolean isFavorited(final Context context, final FeedItem item) { try { FavoritesMap map = GsonUtils .fromJson(new InputStreamReader(getInputStream(context)), FavoritesMap.class); if (map == null) { return false; } if (map.getArticles() != null) { final ArrayList<FeedItem> articles = new ArrayList<FeedItem>(); articles.addAll(map.getArticles()); for (FeedItem i : articles) { if (i.getPubDate().equals(item.getPubDate()) && i.getLink() .equals(item.getLink())) { return true; } } } if (map.getPhotos() != null) { final ArrayList<FeedItem> photos = new ArrayList<FeedItem>(); photos.addAll(map.getPhotos()); for (FeedItem i : photos) { if (i.getPubDate().equals(item.getPubDate()) && i.getLink() .equals(item.getLink())) { return true; } } } if (map.getVideos() != null) { final ArrayList<FeedItem> videos = new ArrayList<FeedItem>(); videos.addAll(map.getVideos()); for (FeedItem i : videos) { if (i.getPubDate().equals(item.getPubDate()) && i.getLink() .equals(item.getLink())) { return true; } } } } catch (FileNotFoundException e) { return false; } return false; } public static void addToFavorites(final Activity context, final String type, final FeedItem item) { FavoritesMap map = null; try { map = GsonUtils .fromJson(new InputStreamReader(getInputStream(context)), FavoritesMap.class); } catch (FileNotFoundException e) { map = null; } if (map == null) { map = new FavoritesMap(); } if (FAVORITE_ARTICLES.equals(type)) { if (map.getArticles() == null) { map.setArticles(new ArrayList<FeedItem>()); } map.getArticles().add(item); } else if (FAVORITE_PHOTOS.equals(type)) { if (map.getPhotos() == null) { map.setPhotos(new ArrayList<FeedItem>()); } map.getPhotos().add(item); } else if (FAVORITE_VIDEOS.equals(type)) { if (map.getVideos() == null) { map.setVideos(new ArrayList<FeedItem>()); } map.getVideos().add(item); } OutputStreamWriter out = new OutputStreamWriter(getOutputStream(context)); try { out.write(GsonUtils.toJson(map)); out.close(); Toast.makeText(context, R.string.favorites_added, LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); } } public static void removeFromFavorites(final Activity context, final String type, final FeedItem item) { FavoritesMap map = null; try { map = GsonUtils .fromJson(new InputStreamReader(getInputStream(context)), FavoritesMap.class); } catch (FileNotFoundException e) { map = null; } if (map == null) { return; } if (FAVORITE_ARTICLES.equals(type) && (map.getArticles() == null || map.getArticles() .size() < 1)) { return; } else if (FAVORITE_PHOTOS.equals(type) && (map.getPhotos() == null || map.getPhotos() .size() < 1)) { return; } else if (FAVORITE_VIDEOS.equals(type) && (map.getVideos() == null || map.getVideos() .size() < 1)) { return; } final LinkedList llist; if (FAVORITE_ARTICLES.equals(type)) { llist = new LinkedList(map.getArticles()); } else if (FAVORITE_PHOTOS.equals(type)) { llist = new LinkedList(map.getPhotos()); } else if (FAVORITE_VIDEOS.equals(type)) { llist = new LinkedList(map.getVideos()); } else { llist = new LinkedList(); } final int len = llist.size(); for (Iterator itr = llist.iterator(); itr.hasNext(); ) { FeedItem i = (FeedItem) itr.next(); if (i.getPubDate().equals(item.getPubDate()) && i.getLink().equals(item.getLink())) { itr.remove(); } } if (FAVORITE_ARTICLES.equals(type)) { map.getArticles().clear(); map.getArticles().addAll(llist); } else if (FAVORITE_PHOTOS.equals(type)) { map.getPhotos().clear(); map.getPhotos().addAll(llist); } else if (FAVORITE_VIDEOS.equals(type)) { map.getVideos().clear(); map.getVideos().addAll(llist); } OutputStreamWriter out = new OutputStreamWriter(getOutputStream(context)); try { out.write(GsonUtils.toJson(map)); out.close(); Toast.makeText(context, R.string.favorites_removed, LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); } } }
35.987069
98
0.587136
1a50cdc27abb60122aa101227d778f03b4bc1130
9,337
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.netbeans.installer.utils; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * * @author Kirill Sorokin * @author Dmitry Lipin */ public final class ResourceUtils { ///////////////////////////////////////////////////////////////////////////////// // Static private static HashMap<String, ResourceBundle> loadedBundles = new HashMap<String, ResourceBundle>(); // strings ////////////////////////////////////////////////////////////////////// public static String getString(final String baseName, final String key) { return getString(baseName, key, ResourceUtils.class.getClassLoader()); } public static String getString(final String baseName, final String key, final ClassLoader loader) { return getBundleMessage(baseName, Locale.getDefault(), loader, key); } public static String getString(final Class clazz, final String key) { return getBundleMessage(getBundleResource(clazz), Locale.getDefault(), clazz.getClassLoader(), key); } public static String getString( final String baseName, final String key, final Object... arguments) { return getString(baseName, key, ResourceUtils.class.getClassLoader(), arguments); } public static String getString( final String baseName, final String key, final ClassLoader loader, final Object... arguments) { return format(getString(baseName, key, loader), arguments); } public static String getString( final Class clazz, final String key, final Object... arguments) { return format(getString(clazz, key), arguments); } public static Map <Locale, String> getStrings( final String baseName, final String key, final ClassLoader loader, final Object... arguments) { Map <Locale, String> map = getBundleMessagesMapForKey(baseName, key, loader); if(arguments.length == 0) { return map; } else { Map <Locale, String> result = new HashMap<Locale, String>(); for(Locale locale : map.keySet()) { result.put(locale, format(map.get(locale), arguments)); } return result; } } public static Map <Locale, String> getStrings( final String baseName, final String key, final Object... arguments) { return getStrings(baseName, key, ResourceUtils.class.getClassLoader(), arguments); } public static Map <Locale, String> getStrings( final Class clazz, final String key, final Object... arguments) { return getStrings(getBundleResource(clazz), key, clazz.getClassLoader(), arguments); } private static String format( final String message, final Object... arguments) { return message == null ? null : StringUtils.format(message, arguments); } // resources //////////////////////////////////////////////////////////////////// public static InputStream getResource( final String name) { return getResource(name, ResourceUtils.class.getClassLoader()); } public static InputStream getResource( final String path, final ClassLoader loader) { return loader.getResourceAsStream(path); } /** * Returns the size of the resource file. * @param resource Resource name * @return size of the resource or * <i>-1</i> if the resource was not found or any other error occured */ public static long getResourceSize( final String resource) { InputStream is = null; long size = 0; try { is = getResource(resource); if(is==null) { // resource was not found return -1; } byte [] buf = new byte [BUFFER_SIZE]; while(is.available()>0) { size += is.read(buf); } } catch (IOException ex) { size = -1; } finally { try { if(is!=null) { is.close(); } } catch (IOException e){ } } return size; } public static String getResourceFileName( final String resource) { return resource.substring(resource.lastIndexOf("/")+1); } public static String getResourceClassName(Class c) { return getResourceClassName(c.getName()); } public static String getResourceClassName(String className) { return (className.replace(".", "/") + ".class"); } // private ////////////////////////////////////////////////////////////////////// private static ResourceBundle loadBundle( final String baseName, final Locale locale, final ClassLoader loader) { final String bundleId = loader.toString() + baseName + (locale.toString().equals(StringUtils.EMPTY_STRING) ? StringUtils.EMPTY_STRING : ("_" + locale)); ResourceBundle bundle = (ResourceBundle) loadedBundles.get(bundleId); if (bundle == null && !loadedBundles.containsKey(bundleId)) { try { bundle = ResourceBundle.getBundle(baseName, locale, loader); } catch (MissingResourceException e) { LogManager.log("Can`t find bundle " + baseName + " using [" + locale + "] locale" + " and [" + loader + "] classloader", e); //throw e; } loadedBundles.put(bundleId, bundle); } return bundle; } private static String getBundleMessage( final String baseName, final Locale locale, final ClassLoader loader, final String key) { ResourceBundle bundle = loadBundle(baseName, locale, loader); String message = null; if (bundle != null) { try { message = bundle.getString(key); } catch (MissingResourceException e) { if(locale.toString().length() > 0) { String [] parts = locale.toString().split(StringUtils.UNDERSCORE); String upLocale = StringUtils.asString(parts, 0, parts.length - 1, StringUtils.UNDERSCORE); return getBundleMessage(baseName, StringUtils.parseLocale(upLocale), loader, key); } else { LogManager.log("Can`t load message in bundle " + baseName + " for key " + key + " using [" + loader + "] classloader"); } } } return message; } private static Map <Locale, String> getBundleMessagesMapForKey( final String baseName, final String key, final ClassLoader loader) { Map <Locale, String> map = new HashMap <Locale, String> (); List <Locale> list = new ArrayList <Locale> (); list.add(new Locale(StringUtils.EMPTY_STRING)); list.addAll(Arrays.asList(Locale.getAvailableLocales())); for(Locale locale : list) { ResourceBundle bundle = loadBundle(baseName, locale, loader); if(bundle!=null && locale.equals(bundle.getLocale()) && !map.containsKey(bundle.getLocale())) { map.put(locale, getBundleMessage(baseName, locale, loader, key)); } } return map; } private static String getBundleResource(final Class clazz) { return clazz.getPackage().getName() + BUNDLE_FILE_SUFFIX; } ///////////////////////////////////////////////////////////////////////////////// // Instance private ResourceUtils() { // does nothing } ///////////////////////////////////////////////////////////////////////////////// // Constants public static final int BUFFER_SIZE = 40960; // NOMAGI public static final String BUNDLE_FILE_SUFFIX = ".Bundle"; // NOI18N }
36.472656
131
0.560458
08885034f22061ed2a3812ae9148756e491906b2
3,451
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: Stefan Irimescu, Can Berker Cikis * */ package org.rumbledb.runtime.functions.sequences.aggregate; import org.rumbledb.api.Item; import org.rumbledb.context.DynamicContext; import org.rumbledb.context.Name; import org.rumbledb.exceptions.ExceptionMetadata; import org.rumbledb.expressions.ExecutionMode; import org.rumbledb.expressions.arithmetic.MultiplicativeExpression; import org.rumbledb.items.ItemFactory; import org.rumbledb.runtime.AtMostOneItemLocalRuntimeIterator; import org.rumbledb.runtime.RuntimeIterator; import org.rumbledb.runtime.arithmetics.MultiplicativeOperationIterator; import org.rumbledb.runtime.primary.VariableReferenceIterator; import java.math.BigInteger; import java.util.List; import java.util.Map; import java.util.TreeMap; public class AvgFunctionIterator extends AtMostOneItemLocalRuntimeIterator { private static final long serialVersionUID = 1L; private Item item; public AvgFunctionIterator( List<RuntimeIterator> arguments, ExecutionMode executionMode, ExceptionMetadata iteratorMetadata ) { super(arguments, executionMode, iteratorMetadata); } @Override public Item materializeFirstItemOrNull(DynamicContext context) { Item count = CountFunctionIterator.computeCount( this.children.get(0), context, getMetadata() ); if (count.isInt() && count.getIntValue() == 0) { return null; } if (count.isInteger() && count.getIntegerValue().equals(BigInteger.ZERO)) { return null; } Item sum = SumFunctionIterator.computeSum( ItemFactory.getInstance().createIntegerItem(BigInteger.ZERO), this.children.get(0), context, getMetadata() ); this.item = MultiplicativeOperationIterator.processItem( sum, count, MultiplicativeExpression.MultiplicativeOperator.DIV, getMetadata() ); return this.item; } public Map<Name, DynamicContext.VariableDependency> getVariableDependencies() { if (this.children.get(0) instanceof VariableReferenceIterator) { VariableReferenceIterator expr = (VariableReferenceIterator) this.children.get(0); Map<Name, DynamicContext.VariableDependency> result = new TreeMap<Name, DynamicContext.VariableDependency>(); result.put(expr.getVariableName(), DynamicContext.VariableDependency.AVG); return result; } else { return super.getVariableDependencies(); } } }
36.712766
94
0.706462
47676fa99dd6e0a9457adfc93c533f17e701adcc
2,402
package com.idealista.fpe.algorithm.ff1; import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import com.idealista.fpe.component.functions.prf.DefaultPseudoRandomFunction; @RunWith(Parameterized.class) public class FF1AlgorithmWithRadix45NoEmptyDataKey256Should { @Parameterized.Parameters(name = "{index}: plain text is {0}") public static Iterable<int[]> data() { return Arrays.asList( new int[] {18, 27, 13, 34, 44, 6, 37, 28, 10, 9, 16, 3, 2}, new int[] {4, 4, 5, 4, 7, 0, 9, 4, 3, 2}, new int[] {11, 33, 44}, new int[] {37, 25, 16} ); } @Parameterized.Parameter public int[] input; Integer radix = 45; byte[] key = { (byte) 0x2B, (byte) 0x7E, (byte) 0x15, (byte) 0x16, (byte) 0x28, (byte) 0xAE, (byte) 0xD2, (byte) 0xF7, (byte) 0x15, (byte) 0x88, (byte) 0x09, (byte) 0xCF, (byte) 0x4F, (byte) 0xAB, (byte) 0x3C, (byte) 0x2B, (byte) 0x7E, (byte) 0x15, (byte) 0x16, (byte) 0x28, (byte) 0xAE, (byte) 0xD2, (byte) 0xF7, (byte) 0x15, (byte) 0x88, (byte) 0x09, (byte) 0xCF, (byte) 0x4F, (byte) 0xAB, (byte) 0x3C, (byte) 0x3C, (byte) 0x3C }; byte[] tweak = { (byte) 0x39, (byte) 0x38, (byte) 0x37, (byte) 0x36, (byte) 0x35, (byte) 0x34, (byte) 0x33, (byte) 0x32, (byte) 0x31, (byte) 0x30 }; @Test public void given_a_plain_text_return_the_cipher_text () throws Exception { int[] cipherText = FF1Algorithm.encrypt(input, radix, tweak, new DefaultPseudoRandomFunction(key)); assertThat(input.length).isEqualTo(cipherText.length); assertThat(input).isNotEqualTo(cipherText); assertThat(input).isEqualTo(FF1Algorithm.decrypt(cipherText, radix, tweak, new DefaultPseudoRandomFunction(key))); } @Test public void given_a_cipher_text_return_the_plain_text () throws Exception { int[] plainText = FF1Algorithm.decrypt(input, radix, tweak, new DefaultPseudoRandomFunction(key)); assertThat(input.length).isEqualTo(plainText.length); assertThat(input).isNotEqualTo(plainText); assertThat(input).isEqualTo(FF1Algorithm.encrypt(plainText, radix, tweak, new DefaultPseudoRandomFunction(key))); } }
40.033333
140
0.64363
e8623a5f0b9cf42f8c55e46cbd0e94bef290fe1d
2,448
package com.pge.e1; import java.util.Scanner; import com.pge.rateCompare.NotInBillPeriodException; public class Tester { public static double[] e1Bill(String baseLineTerritory, String fullStartDate, String fullEndDate, String heatSource, double chargingLevel, double weekdayDistance, double weekendDistance, int chargeStartTime, String dataFile) throws NotInBillPeriodException { com.pge.e1.FileReader.readBaselineUsageFile(); boolean isGas = false; if(heatSource.toLowerCase().equals("gas")) { isGas = true; } Scanner parseDate = new Scanner(fullStartDate); parseDate.useDelimiter("-"); int startMonth = parseDate.nextInt(); int startDay = parseDate.nextInt(); int startYear = parseDate.nextInt(); if(parseDate.hasNext()) { parseDate.next();//remove anything still in there } Scanner parseEndDate = new Scanner(fullEndDate); parseEndDate.useDelimiter("-"); int endMonth = parseEndDate.nextInt(); int endDay = parseEndDate.nextInt(); int endYear = parseEndDate.nextInt(); long[] numSummerWinterDays = BaselineQuantity.calcNumDays(startMonth, startDay, startYear, endMonth, endDay, endYear); boolean isSummer = true; double summerRate = FileReader.getBaselineAmount(baseLineTerritory, isSummer, isGas);//summerRate is the baseline Amount per day under specified constraints double summerDaysBaseline = numSummerWinterDays[0] * summerRate; isSummer = false; double winterRate = FileReader.getBaselineAmount(baseLineTerritory, isSummer, isGas);//baseline Amount per day double winterDaysBaseline = numSummerWinterDays[1] * winterRate; parseDate.close(); parseEndDate.close(); double[] usageAmounts = com.pge.e1.XMLReader.findUsage(dataFile, startMonth, startDay, startYear, endMonth, endDay, endYear, chargingLevel, weekdayDistance, weekendDistance, chargeStartTime); double e1BillPartsSummer[] = com.pge.e1.PrintBill.calcBill(usageAmounts, summerDaysBaseline, numSummerWinterDays[0], true); double e1BillPartsWinter[] = com.pge.e1.PrintBill.calcBill(usageAmounts, winterDaysBaseline, numSummerWinterDays[1], false); double e1BillParts[] = {e1BillPartsSummer[0] + e1BillPartsWinter[0],e1BillPartsSummer[1] + e1BillPartsWinter[1],e1BillPartsSummer[2] + e1BillPartsWinter[2],e1BillPartsSummer[3] + e1BillPartsWinter[3],e1BillPartsSummer[4] + e1BillPartsWinter[4]}; return e1BillParts; } }
43.714286
258
0.752859
6a32f643aeb960efbbb2cf859a35059048aa164d
2,056
package de.immomio.importer.worker.is24; import de.immomio.data.landlord.entity.credential.Credential; import de.immomio.exporter.utils.credential.CredentialUtils; import de.immomio.model.repository.service.landlord.customer.credential.CredentialRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import java.util.Optional; @Controller public class IS24ImportController { @Autowired private Immoscout24Importer i24i; @Autowired private CredentialRepository baseCredentialRepository; @Value("${encryption.credentials.key}") private String encryptionKey; @RequestMapping(value = "/import/is24", method = RequestMethod.GET) public ResponseEntity<Object> IS24Import(@RequestParam("userid") long userID, @RequestParam("customerid") long customerId, @RequestParam("credentialid") long credentialId, @RequestParam("max") int max) { Optional<Credential> credentialOpt = baseCredentialRepository.findById(credentialId); if (credentialOpt.isPresent()) { Credential credential = credentialOpt.get(); String token = CredentialUtils.getToken(credential, encryptionKey); String tokenSecret = CredentialUtils.getTokenSecret(credential, encryptionKey); i24i.init(); i24i.login(token, tokenSecret); i24i.importAll(userID, customerId, max); return new ResponseEntity<>(HttpStatus.OK); } else { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } } }
39.538462
93
0.706712
56aa4b484b53eeeb2cf89ac08c6e87d06d3b415c
1,120
// Copyright © 2017-2018 Andy Goryachev <andy@goryachev.com> package goryachev.fx.edit; import goryachev.common.util.CList; /** * Simple Styled Text Model. * * TODO insert, delete, allAll, setAll etc. */ public class SimpleStyledTextModel extends FxEditorModel { private CList<LineBox> lines = new CList(); public SimpleStyledTextModel() { } public LineBox getLineBox(int line) { if(lines.isValidIndex(line)) { return lines.get(line); } return null; } public LoadInfo getLoadInfo() { return null; } public int getLineCount() { return lines.size(); } public Edit edit(Edit ed) throws Exception { throw new Error(); } public void add(TStyle s, String text) { LineBox b = new LineBox(); b.addText(s, text); lines.add(b); } public void add(Object ... styleTextPairs) { LineBox b = new LineBox(); for(int i=0; i<styleTextPairs.length; ) { TStyle s = (TStyle)styleTextPairs[i++]; String text = (String)styleTextPairs[i++]; b.addText(s, text); } lines.add(b); } }
16
61
0.617857
149b39ee74e1c259ebef640be1f0a5160724e120
4,827
/* * Copyright 2019 Patrik Karlström. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package se.trixon.toolbox.io.file.asc; import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.util.Locale; import javax.swing.filechooser.FileNameExtensionFilter; import se.trixon.toolbox.io.file.CoordinateFile; /** * * @author Patrik Karlsson */ public class Asc extends CoordinateFile { private double[][] mData; private AscHeader mHeader; public Asc() { mHeader = new AscHeader(); } public Asc(Charset charset) { this(); mCharset = charset; } public static FileNameExtensionFilter getFileNameExtensionFilter() { return new FileNameExtensionFilter("*.asc", "asc"); } @Override public Rectangle2D getBounds2D() { return mHeader.getBounds2D(); } public double[][] getData() { return mData; } public AscHeader getHeader() { return mHeader; } @Override public Path2D.Double getPath2D() { return mHeader.getPath2D(); } public boolean isValid() { return (mHeader != null && mHeader.getNcols() > 0 && mHeader.getNrows() > 0 && mHeader.getCellSize() > Double.MIN_VALUE && mHeader.getXllcorner() > Double.MIN_VALUE && mHeader.getYllcorner() > Double.MIN_VALUE); } @Override public boolean isValid(File file) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void openWriter(File file) throws IOException { String llFormat = String.format(Locale.ENGLISH, "%%s %%.%df\r\n", mXYPrecision); StringBuilder builder = new StringBuilder(); builder.append(String.format(Locale.ENGLISH, "ncols %d\r\n", mHeader.getNcols())); builder.append(String.format(Locale.ENGLISH, "nrows %d\r\n", mHeader.getNrows())); builder.append(String.format(Locale.ENGLISH, llFormat, "xllcorner", mHeader.getXllcorner())); builder.append(String.format(Locale.ENGLISH, llFormat, "yllcorner", mHeader.getYllcorner())); builder.append(String.format(Locale.ENGLISH, "cellsize %f\r\n", mHeader.getCellSize())); builder.append(String.format(Locale.ENGLISH, "nodata_value %f\r\n", mHeader.getNodata())); mWriter = Files.newBufferedWriter(file.toPath(), mCharset); mWriter.write(builder.toString()); } public void read(File file, boolean... headerOnly) throws IOException, NumberFormatException { boolean quickRead = headerOnly.length > 0 && headerOnly[0] == true; if (file.isFile() && file.exists()) { mPath = file.toPath(); mReader = Files.newBufferedReader(mPath, mCharset); mHeader = new AscHeader(mReader, mPath); if (!quickRead) { mData = new double[mHeader.getNrows()][mHeader.getNcols()]; for (int row = 0; row < mHeader.getNrows(); row++) { String[] rowData = mReader.readLine().split(" "); for (int col = 0; col < mHeader.getNcols(); col++) { mData[row][col] = Double.parseDouble(rowData[col]); } } } } else { throw new IOException(); } } public void readHeader(File file) throws IOException, NumberFormatException { read(file, true); } public void setData(double[][] data) { mData = data; } public void write(File file) throws IOException { openWriter(file); String format = String.format(Locale.ENGLISH, "%%.%df ", mValuePrecision); for (int row = 0; row < mData.length; row++) { StringBuilder builder = new StringBuilder(); for (double value : mData[row]) { builder.append(String.format(Locale.ENGLISH, format, value)); } builder.deleteCharAt(builder.length() - 1); builder.append("\r\n"); mWriter.write(builder.toString()); } closeWriter(); } }
33.289655
135
0.620468
9d8f243f25bbd4e961959089eca6b1fd38eb336e
1,099
package com.jakubeeee.iotaccess.core.plugindeployer; import com.jakubeeee.iotaccess.core.BaseIsolatedIntegrationTest; import com.jakubeeee.iotaccess.core.CoreApplicationEntryPoint; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.util.Set; import static com.jakubeeee.iotaccess.core.plugindeployer.PluginDeployerPackageITConstants.*; @SpringBootTest( classes = CoreApplicationEntryPoint.class, args = "--regstrat=db" ) class DatabasePluginDeployerIT extends BaseIsolatedIntegrationTest { @Autowired private PluginDeployerPackageITHelper helper; @Test void databaseDeployerRegistrationIntegrationTest() { helper.insertTestPluginIntoDatabase(); helper.validatePluginDeployed( DB_RANDOM_NUMBER_PLUGIN_IDENTIFIER, Set.of(DB_SINGLE_RANDOM_NUMBER_FETCH_PROCESS, DB_THREE_RANDOM_NUMBERS_FETCH_PROCESS, DB_TEN_RANDOM_NUMBERS_FETCH_PROCESS)); } }
33.30303
93
0.760692
b320a7a56c37722da69d3a74d8786e86829ca3c0
2,153
package eu.nets.ms.pia.config; import java.util.logging.Level; import java.util.logging.Logger; import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.wadl.internal.WadlResource; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; import eu.nets.ms.pia.service.rest.CallbackRESTServiceImpl; import eu.nets.ms.pia.service.rest.JsonProcessingExceptionMapper; import eu.nets.ms.pia.service.rest.MerchantPaymentRESTService; import eu.nets.ms.pia.service.rest.MerchantPaymentRESTServiceImpl; import io.swagger.jaxrs.config.BeanConfig; import io.swagger.jaxrs.listing.ApiListingResource; import io.swagger.jaxrs.listing.SwaggerSerializers; @Configuration @Component @ApplicationPath("/pia/merchantdemo/v2") public class JerseyConfig extends ResourceConfig { private static final String LOGGER_ID = "serviceLogger"; private static final int MAX_ENTITY_SIZE = 3000; public JerseyConfig() { registerEndpoints(); configureSwagger(); } private void registerEndpoints() { register(MerchantPaymentRESTServiceImpl.class); register(CallbackRESTServiceImpl.class); register(JsonProcessingExceptionMapper.class); register(WadlResource.class); register(new LoggingFeature(Logger.getLogger(LOGGER_ID), Level.FINE, LoggingFeature.Verbosity.PAYLOAD_ANY, MAX_ENTITY_SIZE)); } private void configureSwagger() { BeanConfig beanConfig = new BeanConfig(); beanConfig.setSchemes(new String[]{"http"}); beanConfig.setHost("localhost:8080"); beanConfig.setBasePath("/pia/merchantdemo/v2"); beanConfig.setVersion(MerchantPaymentRESTService.API_VERSION); beanConfig.setTitle("Merchant backend demo"); beanConfig.setResourcePackage(MerchantPaymentRESTService.class.getPackage().getName()); beanConfig.setPrettyPrint(true); beanConfig.setScan(false); register(ApiListingResource.class); register(SwaggerSerializers.class ); } }
37.77193
130
0.767301
314104126a78873b8866b19a1ee40e5aceebf914
1,939
package net.csdn.blog.chaijunkun.aop; import javax.validation.constraints.NotNull; import net.csdn.blog.chaijunkun.entity.Resp; import org.aspectj.lang.ProceedingJoinPoint; import org.hibernate.validator.constraints.NotBlank; import org.hibernate.validator.constraints.NotEmpty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; /** * JSR303验证框架统一处理 * @author chaijunkun * @since 2015年4月1日 */ public class JSRValidationAdvice { Logger logger = LoggerFactory.getLogger(JSRValidationAdvice.class); /** * 判断验证错误代码是否属于字段为空的情况 * @param code 验证错误代码 */ private boolean isMissingParamsError(String code){ if (code.equals(NotNull.class.getSimpleName()) || code.equals(NotBlank.class.getSimpleName()) || code.equals(NotEmpty.class.getSimpleName())){ return true; }else{ return false; } } /** * 切点处理 * @param joinPoint * @return * @throws Throwable */ public Object aroundMethod(ProceedingJoinPoint joinPoint) throws Throwable { BindingResult result = null; Object[] args = joinPoint.getArgs(); if (args != null && args.length != 0){ for (Object object : args) { if (object instanceof BindingResult){ result = (BindingResult)object; break; } } } if (result != null && result.hasErrors()){ FieldError fieldError = result.getFieldError(); String targetName = joinPoint.getTarget().getClass().getSimpleName(); String method = joinPoint.getSignature().getName(); logger.info("验证失败.控制器:{}, 方法:{}, 参数:{}, 属性:{}, 错误:{}, 消息:{}", targetName, method, fieldError.getObjectName(), fieldError.getField(), fieldError.getCode(), fieldError.getDefaultMessage()); String firstCode = fieldError.getCode(); if (isMissingParamsError(firstCode)){ return Resp.fail("必选参数丢失"); }else{ return Resp.fail("其他错误"); } } return joinPoint.proceed(); } }
28.101449
190
0.717896
3221f990665a7b25830d17e75cf97a6c3a895cdf
6,374
package uk.gov.hmcts.ccd.domain.service.validate; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import javax.inject.Inject; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; import uk.gov.hmcts.ccd.data.definition.CachedCaseDefinitionRepository; import uk.gov.hmcts.ccd.data.definition.CaseDefinitionRepository; import uk.gov.hmcts.ccd.domain.model.definition.CaseTypeDefinition; import uk.gov.hmcts.ccd.domain.model.std.CaseDataContent; import uk.gov.hmcts.ccd.domain.service.common.CaseTypeService; import uk.gov.hmcts.ccd.domain.service.processor.FieldProcessorService; import uk.gov.hmcts.ccd.endpoint.exceptions.ValidationException; @Service public class DefaultValidateCaseFieldsOperation implements ValidateCaseFieldsOperation { private final CaseDefinitionRepository caseDefinitionRepository; private final CaseTypeService caseTypeService; private final FieldProcessorService fieldProcessorService; public static final String ORGANISATION_POLICY_ROLE = "OrgPolicyCaseAssignedRole"; @Inject DefaultValidateCaseFieldsOperation( @Qualifier(CachedCaseDefinitionRepository.QUALIFIER) final CaseDefinitionRepository caseDefinitionRepository, final CaseTypeService caseTypeService, final FieldProcessorService fieldProcessorService ) { this.caseDefinitionRepository = caseDefinitionRepository; this.caseTypeService = caseTypeService; this.fieldProcessorService = fieldProcessorService; } @Override public final Map<String, JsonNode> validateCaseDetails(String caseTypeId, CaseDataContent content) { if (content == null || content.getEvent() == null || content.getEventId() == null) { throw new ValidationException("Cannot validate case field because of event is not specified"); } final CaseTypeDefinition caseTypeDefinition = caseDefinitionRepository.getCaseType(caseTypeId); if (caseTypeDefinition == null) { throw new ValidationException("Cannot find case type definition for " + caseTypeId); } if (!hasEventId(caseTypeDefinition, content.getEventId())) { throw new ValidationException("Cannot validate case field because of event " + content.getEventId() + " is not found in case type definition"); } content.setData(fieldProcessorService.processData(content.getData(), caseTypeDefinition, content.getEventId())); caseTypeService.validateData(content.getData(), caseTypeDefinition); validateOrganisationPolicy(caseTypeId, content); return content.getData(); } private void validateOrganisationPolicy(String caseTypeId, CaseDataContent content) { final List<String> errorList = new ArrayList<>(); caseDefinitionRepository.getCaseType(caseTypeId) .findCaseEvent(content.getEventId()) .ifPresent(caseEventDefinition -> caseEventDefinition.getCaseFields() .stream() .forEach(eventFieldDefinition -> eventFieldDefinition.getCaseEventFieldComplexDefinitions().stream() .filter(cefcDefinition -> isOrgPolicyCaseAssignedRole(cefcDefinition.getReference())) .forEach(cefcDefinition -> { String reference = cefcDefinition.getReference(); validateContent(content, eventFieldDefinition.getCaseFieldId(), reference, cefcDefinition.getDefaultValue(), errorList); }))); if (errorList.size() != 0) { throw new ValidationException("Roles validation error: " + String.join(", ", errorList)); } } private String[] convertReference(String reference) { return reference.split(Pattern.quote(".")); } private boolean isOrgPolicyCaseAssignedRole(String reference) { String[] referenceArray = convertReference(reference); return ORGANISATION_POLICY_ROLE.equals(referenceArray[referenceArray.length - 1]); } private void validateContent(final CaseDataContent content, final String caseFieldId, final String reference, final String defaultValue, final List<String> errorList) { final JsonNode existingData = new ObjectMapper().convertValue(content.getData(), JsonNode.class); JsonNode caseFieldNode = existingData.findPath(caseFieldId); if (caseFieldNode != null) { String[] referenceArray = convertReference(reference); int length = referenceArray.length; String nodeReference = length > 1 ? referenceArray[length - 2] : referenceArray[length - 1]; List<JsonNode> parentNodes = caseFieldNode.findParents(nodeReference); parentNodes.stream().forEach(parentNode -> { JsonNode orgPolicyNode = findOrgPolicyNode(nodeReference, parentNode, length); if (orgPolicyNode.isNull()) { errorList.add(caseFieldId + " cannot have an empty value."); } else if (!defaultValue.equalsIgnoreCase(orgPolicyNode.textValue())) { errorList.add(caseFieldId + " has an incorrect value " + orgPolicyNode.textValue()); } }); } } private JsonNode findOrgPolicyNode(final String nodeReference, final JsonNode parentNode, final int length) { if (length > 1) { return parentNode .findPath(nodeReference) .findPath(ORGANISATION_POLICY_ROLE); } return parentNode.findPath(ORGANISATION_POLICY_ROLE); } private boolean hasEventId(CaseTypeDefinition caseTypeDefinition, String eventId) { return caseTypeDefinition.hasEventId(eventId); } @Override public void validateData(Map<String, JsonNode> data, CaseTypeDefinition caseTypeDefinition) { caseTypeService.validateData(data, caseTypeDefinition); } }
47.567164
155
0.67995
e6320071546ee14be650dc65d7ede11e8ace7c32
777
package com.stevesun.solutions; public class MinimumMovestoEqualArrayElements { /**Looked at this solution: https://discuss.leetcode.com/topic/66557/java-o-n-solution-short * i.e. Add 1 to n-1 elements basically equals to subtracting 1 from one element. So the easiest way * to make all elements in this array equal is to make all of them equal to the minimum element.*/ public static int minMoves(int[] nums) { if(nums.length == 0) return 0; int min = nums[0]; for(int n : nums) min = Math.min(min, n); int res = 0; for(int n : nums) res += n - min; return res; } public static void main(String...args){ int[] nums = new int[]{1,2,3}; System.out.println(minMoves(nums)); } }
35.318182
104
0.625483
0a44e1e8f1eb2eb02d1aa6f1479f90340198eb88
3,206
package mage.cards.m; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.FilterCard; import mage.filter.FilterPermanent; import mage.filter.common.FilterCreatureCard; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import java.util.UUID; /** * @author TheElk801 */ public final class MaraudingRaptor extends CardImpl { private static final FilterCard filter = new FilterCreatureCard("creature spells"); private static final FilterPermanent filter2 = new FilterCreaturePermanent("another creature"); static { filter2.add(AnotherPredicate.instance); } public MaraudingRaptor(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.subtype.add(SubType.DINOSAUR); this.power = new MageInt(2); this.toughness = new MageInt(3); // Creature spells you cast cost {1} less to cast. this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 1))); // Whenever another creature enters the battlefield under your control, Marauding Raptor deals 2 damage to it. If a Dinosaur is dealt damage this way, Marauding Raptor gets +2/+0 until end of turn. this.addAbility(new EntersBattlefieldControlledTriggeredAbility( Zone.BATTLEFIELD, new MaraudingRaptorEffect(), filter2, false, SetTargetPointer.PERMANENT, "Whenever another creature enters the battlefield under your control, " + "{this} deals 2 damage to it. If a Dinosaur is dealt damage this way, " + "{this} gets +2/+0 until end of turn." )); } private MaraudingRaptor(final MaraudingRaptor card) { super(card); } @Override public MaraudingRaptor copy() { return new MaraudingRaptor(this); } } class MaraudingRaptorEffect extends OneShotEffect { MaraudingRaptorEffect() { super(Outcome.Benefit); } private MaraudingRaptorEffect(final MaraudingRaptorEffect effect) { super(effect); } @Override public MaraudingRaptorEffect copy() { return new MaraudingRaptorEffect(this); } @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source)); if (permanent == null) { return false; } if (permanent.damage(2, source.getSourceId(), game) > 0 && permanent.hasSubtype(SubType.DINOSAUR, game)) { game.addEffect(new BoostSourceEffect(2, 0, Duration.EndOfTurn), source); } return true; } }
35.230769
205
0.706176
fd3abec7c7951eddab563bcf9419383cff445e96
6,414
package com.ack.adventureandconquer.game.creature.npc.humanoid; import com.ack.adventureandconquer.game.creature.npc.Npc; import java.util.ArrayList; import java.util.List; /** * Created by saskyrar on 26/01/15. */ public class Ogre extends Npc { private boolean isChampion = false; private boolean isSubChieftain = false; private boolean isChieftain = false; private boolean isShaman = false; private boolean isWitchDoctor = false; private int clericalLevel = 0; private int mageLevel = 0; private Type type = Type.MALE; public static List<Npc> getGang() { List<Npc> gang = new ArrayList<>(); int gangSize = d6.role(); for (int index = 0; index < gangSize; index++) { Ogre ogre = new Ogre(); ogre.roleHitPoints(); gang.add(ogre); } Ogre champion = createChampion(); gang.add(champion); return gang; } public static List<Npc> getWarband() { List<Npc> warband = new ArrayList<>(); int gangSize = d3.role(); for (int index = 0; index < gangSize; index++) { List<Npc> gang = getGang(); gang.addAll(gang); } Ogre subChieftain = createSubChieftain(); warband.add(subChieftain); return warband; } public static List<Npc> getVillage() { List<Npc> village = new ArrayList<>(); int gangSize = d3.role(); for (int index = 0; index < gangSize; index++) { List<Npc> gang = getGang(); gang.addAll(gang); } Ogre chieftain = createChieftain(); village.add(chieftain); int maleNumber = village.size(); int everyTenthMale = maleNumber / 10; int femaleNumber = (d6.role() + d6.role()) * everyTenthMale; int youngNumber = (d4.role() + d4.role()) * everyTenthMale; for (int index = 0; index < femaleNumber; index++) { Ogre female = createFemale(); village.add(female); } for (int index = 0; index < youngNumber; index++) { Ogre young = createYoung(); village.add(young); } boolean hasShaman = d100.role() <= 50; if (hasShaman) { Ogre shaman = createSubChieftain(); shaman.setSubChieftain(false); shaman.setClericalLevel(d4.role()); shaman.setShaman(true); village.add(shaman); } boolean hasWitchDoctor = d100.role() <= 25; if (hasWitchDoctor) { Ogre witchDoctor = createChampion(); witchDoctor.setChampion(false); witchDoctor.setMageLevel(d2.role()); witchDoctor.setWitchDoctor(true); village.add(witchDoctor); } return village; } public static Ogre createChampion() { Ogre champion = new Ogre(); champion.setChampion(true); champion.setArmorClass(5); champion.setHitDice(5); champion.setHitPoints(33); return champion; } public static Ogre createSubChieftain() { Ogre subChieftain = new Ogre(); subChieftain.setSubChieftain(true); subChieftain.setArmorClass(5); subChieftain.setHitDice(5); subChieftain.setHitPoints(33); return subChieftain; } public static Ogre createChieftain() { Ogre chieftain = new Ogre(); chieftain.setChieftain(true); chieftain.setArmorClass(7); chieftain.setHitDice(8); chieftain.setAdditionalHitPoints(2); chieftain.setHitPoints(45); return chieftain; } public static Ogre createFemale() { Ogre female = new Ogre(); female.setType(Type.FEMALE); Bugbear bear = new Bugbear(); bear.roleHitPoints(); female.setArmorClass(bear.getArmorClass()); female.setHitDice(bear.getHitDice()); female.setHitPoints(bear.getHitPoints()); female.setAdditionalHitPoints(bear.getAdditionalHitPoints()); return female; } public static Ogre createYoung() { Ogre young = new Ogre(); young.setType(Type.YOUNG); Goblin goblin = new Goblin(); goblin.roleHitPoints(); young.setArmorClass(goblin.getArmorClass()); young.setHitDice(goblin.getHitDice()); young.setHitPoints(goblin.getHitPoints()); young.setAdditionalHitPoints(goblin.getAdditionalHitPoints()); return young; } @Override public String getExtraInformation() { String powerBonus = "+3 bonus to damage rolls due to their great strength"; if (isChampion) { return "Champion\n" + powerBonus; } else if (isSubChieftain) { return "Sub Chieftain\n" + powerBonus; } else if (isShaman) { return "Shaman\n" + powerBonus; } else if (isWitchDoctor) { return "Witch Doctor\n" + powerBonus; } else if (isChieftain) { return "Chieftain\n+4 bonus to damage rolls due to their great strength"; } else if (type == Type.FEMALE) { return "Female"; } else if (type == Type.YOUNG) { return "Female"; } return powerBonus; } @Override public int getAdditionalHitPoints() { return 1; } @Override public int getDefaultArmorClass() { return 4; } @Override public int getDefaultHitDice() { return 4; } public void setChieftain(boolean isChieftain) { this.isChieftain = isChieftain; } public void setSubChieftain(boolean isSubChieftain) { this.isSubChieftain = isSubChieftain; } public void setChampion(boolean isChampion) { this.isChampion = isChampion; } public void setType(Type type) { this.type = type; } public void setShaman(boolean isShaman) { this.isShaman = isShaman; } public void setWitchDoctor(boolean isWitchDoctor) { this.isWitchDoctor = isWitchDoctor; } public void setClericalLevel(int clericalLevel) { this.clericalLevel = clericalLevel; } public void setMageLevel(int mageLevel) { this.mageLevel = mageLevel; } public enum Type { MALE, FEMALE, YOUNG } }
25.553785
85
0.585282
cd82f9cfe7ca15b9ae58dc6f2ab90328f56e9810
1,290
package com.ebp.owat.lib.datastructure.value; import java.util.Objects; /** * A value that holds a byte. * * Created by Greg Stewart on 3/26/17. */ public class ByteValue extends Value<Byte> { /** The value of the value. Big 'B' Byte to prevent unnecessary auto unboxing. */ public final Byte value; /** * Constructor to set the value. * @param value The value to set. */ public ByteValue(Byte value) { this.value = value; } /** * Constructor to set the value and the is original flag. * @param value The value to set. * @param isOriginal If the value is original or not. */ public ByteValue(Byte value, boolean isOriginal) { this.value = value; if(isOriginal){ this.flags = ValueFlag.IS_ORIGINAL.setFlag(this.flags); } } @Override public Byte getValue() { return this.value; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; ByteValue byteValue = (ByteValue) o; return Objects.equals(value, byteValue.value); } @Override public int hashCode() { return Objects.hash(super.hashCode(), value); } @Override public String toString() { return " {Value type BYTE. Value: " + this.getValue() + "} "; } }
22.241379
82
0.671318
c7c0ac38f09bc3780910470694e8597d0582a686
9,632
package com.fynn.oyseckill.app.module.account.user; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import com.fynn.oyseckill.R; import com.fynn.oyseckill.app.core.BaseActivity; import com.fynn.oyseckill.model.entity.Address; import com.fynn.oyseckill.model.entity.City; import com.fynn.oyseckill.model.entity.County; import com.fynn.oyseckill.model.entity.Province; import com.fynn.oyseckill.util.UserHelper; import com.fynn.oyseckill.util.constants.Result; import org.appu.common.ParamMap; import org.appu.common.utils.LogU; import org.appu.common.utils.TextUtils; import org.appu.common.utils.ViewUtils; import java.util.ArrayList; import java.util.List; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.datatype.BmobPointer; import cn.bmob.v3.listener.FindListener; /** * Created by fynn on 16/7/30. */ public class ChooseAddressActivity extends BaseActivity { private TextView tvAddAdr; private LinearLayout llEmpty; private ListView lvAddress; private List<Address> addresses; private AddressAdapter aAdapter; private String addressId; @Override public void handleIntent() { ParamMap<String, Object> params = getParams(); if (params != null) { addressId = (String) params.get("addressId"); } } @Override public int getTitlebarResId() { return R.id.titlebar; } @Override public int getContentResId() { return R.layout.activity_address_choose; } @Override public void initViews(Bundle savedInstanceState) { tvAddAdr = $(R.id.tv_add_adr); llEmpty = $(R.id.ll_empty); lvAddress = $(R.id.lv_address); addresses = new ArrayList<Address>(); aAdapter = new AddressAdapter(); } @Override public void initActions(Bundle savedInstanceState) { setOnClick(tvAddAdr); titlebar.setRightActionClickListener(this); lvAddress.setEmptyView(llEmpty); lvAddress.setAdapter(aAdapter); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.tv_titlebar_right_action: case R.id.tv_add_adr: addAddress(); break; } } private void addAddress() { if (addresses.size() >= 20) { showShortToast("最多只能添加20个收货地址"); } else { ParamMap<String, Object> pm = new ParamMap<String, Object>(); pm.put("type", EditAddressActivity.TYPE_ADD); startActivity(EditAddressActivity.class, pm); } } private void queryAddress(boolean showProgress) { if (showProgress) { showProgress(); } BmobQuery<Address> query = new BmobQuery<Address>(); query.include("address,address.city,address.city.province"); query.setLimit(20); query.order("-isDefault,-updatedAt"); query.addWhereEqualTo("user", new BmobPointer(UserHelper.getUser())); query.addWhereNotEqualTo("isDeleted", true); query.findObjects(this, new FindListener<Address>() { @Override public void onSuccess(List<Address> list) { hideProgress(); addresses.clear(); if (list != null && !list.isEmpty()) { addresses.addAll(list); } aAdapter.notifyDataSetChanged(); } @Override public void onError(int i, String s) { hideProgress(); switch (i) { case 9010: case 9016: showShortToast("请检查您的网络"); break; } LogU.e("获取收货地址失败:", "code:" + i, "message:" + s); } }); } @Override protected void onResume() { super.onResume(); queryAddress(false); } private CharSequence genDetailAddress(County address, String detail) { if (address == null || TextUtils.isEmpty(detail)) { return ""; } City city = address.getCity(); Province province = city.getProvince(); if (city == null || province == null) { return ""; } String provinceName = province.getProvinceName(); String cityName = city.getCityName(); String countyName = address.getCountyName(); if (TextUtils.isEmpty(provinceName) || TextUtils.isEmpty(cityName) || TextUtils.isEmpty(countyName)) { return ""; } return String.format("%s %s %s %s", provinceName, cityName, countyName, detail); } private CharSequence genAreaAddress(County address) { City city = address.getCity(); Province province = city.getProvince(); if (city == null || province == null) { return ""; } String provinceName = province.getProvinceName(); String cityName = city.getCityName(); String countyName = address.getCountyName(); if (TextUtils.isEmpty(provinceName) || TextUtils.isEmpty(cityName) || TextUtils.isEmpty(countyName)) { return ""; } return String.format("%s %s %s", provinceName, cityName, countyName); } private String maskMobile(String mobile) { if (TextUtils.isEmpty(mobile)) { return ""; } if (mobile.length() < 7) { return mobile; } String left = mobile.substring(0, 3); String right = mobile.substring(mobile.length() - 4); return String.format("%s **** %s", left, right); } class AddressAdapter extends BaseAdapter { @Override public int getCount() { return addresses.size(); } @Override public Object getItem(int position) { return addresses.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(me).inflate( R.layout.layout_address_choose_item, null); holder = new ViewHolder(convertView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final Address address = addresses.get(position); holder.tvReceiver.setText(address.getReceiver()); holder.tvMobile.setText(maskMobile(address.getMobile())); holder.tvAddress.setText(genDetailAddress(address.getAddress(), address.getDetail())); if (address.getObjectId().equals(addressId)) { holder.ivSelected.setVisibility(View.VISIBLE); } else { holder.ivSelected.setVisibility(View.GONE); } holder.tvEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ParamMap<String, Object> pm = new ParamMap<String, Object>(); pm.put("type", EditAddressActivity.TYPE_EDIT); pm.put("objectId", address.getObjectId()); pm.put("receiver", address.getReceiver()); pm.put("mobile", address.getMobile()); pm.put("area", genAreaAddress(address.getAddress())); pm.put("detail", address.getDetail()); pm.put("countyObjId", address.getAddress().getObjectId()); startActivity(EditAddressActivity.class, pm); } }); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { addressId = address.getObjectId(); notifyDataSetChanged(); Intent data = new Intent(); data.putExtra("addressId", addressId); data.putExtra("receiver", address.getReceiver()); data.putExtra("mobile", address.getMobile()); data.putExtra("address", genDetailAddress(address.getAddress(), address.getDetail())); setResult(Result.RESULT_SELECTED_ADDRESS, data); finish(); } }); return convertView; } class ViewHolder { private TextView tvReceiver; private TextView tvMobile; private TextView tvAddress; private ImageView ivSelected; private TextView tvEdit; public ViewHolder(View convertView) { tvReceiver = ViewUtils.findViewById(convertView, R.id.tv_receiver); tvMobile = ViewUtils.findViewById(convertView, R.id.tv_mobile); tvAddress = ViewUtils.findViewById(convertView, R.id.tv_address); ivSelected = ViewUtils.findViewById(convertView, R.id.iv_selected); tvEdit = ViewUtils.findViewById(convertView, R.id.tv_edit); } } } }
31.374593
106
0.578385
8d4c47ef062e6343030ef0848a79045dfec54699
19,812
/* * Copyright (c) 2001 Sun Microsystems, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Sun Microsystems, Inc. for Project JXTA." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Sun", "Sun Microsystems, Inc.", "JXTA" and "Project JXTA" * must not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact Project JXTA at http://www.jxta.org. * * 5. Products derived from this software may not be called "JXTA", * nor may "JXTA" appear in their name, without prior written * permission of Sun. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of Project JXTA. For more * information on Project JXTA, please see * <http://www.jxta.org/>. * * This license is based on the BSD license adopted by the Apache Foundation. */ package net.jxta.impl.content; import net.jxta.peer.PeerID; import static org.junit.Assert.*; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.lang.reflect.Constructor; import java.net.URI; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; import net.jxta.content.Content; import net.jxta.content.ContentID; import net.jxta.content.ContentProvider; import net.jxta.content.ContentProviderSPI; import net.jxta.content.ContentService; import net.jxta.content.ContentShare; import net.jxta.content.ContentTransfer; import net.jxta.content.TransferException; import net.jxta.document.AdvertisementFactory; import net.jxta.document.BinaryDocument; import net.jxta.document.Document; import net.jxta.document.MimeMediaType; import net.jxta.document.StructuredDocumentFactory; import net.jxta.document.XMLElement; import net.jxta.id.IDFactory; import net.jxta.peergroup.PeerGroup; import net.jxta.platform.JxtaApplication; import net.jxta.platform.NetworkConfigurator; import net.jxta.platform.NetworkManager; import net.jxta.platform.NetworkManager.ConfigMode; import net.jxta.protocol.ContentShareAdvertisement; import net.jxta.test.util.DelegateClassLoader; import net.jxta.test.util.TempDir; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; /** * General tests to apply to ContentProviders to verify compliance and * functionality. * FIXME (2010/07/06 iainmcg): this test is incredibly slow, and potentially never terminates * when running via the ant test runner. I'm not even sure it works anymore. Needs review * and fix! */ @Ignore public abstract class AbstractContentProviderTest { private static Logger LOG = Logger.getLogger(AbstractContentProviderTest.class.getName()); static TempDir home; static NetworkManager netMan; static PeerGroup pg; static ContentService service; private final ContentProviderSPI provider; /** * Due to the DelegateClassLoader usage, this class is loaded in a * totally separate ClassLoader from where it is used. This helps work * around having to use tons of reflection calls but we need to make * sure that the info coming into and out of this class are in a * ClassLoader-nuetral form (i.e., system classes only). */ public static class ContentSharer implements ContentSharerSPI { NetworkManager nm; ContentService service; String targetProvClass; public ContentSharer(final File tempDir, final String className) throws Exception { LOG.info("Constructing ContentSharer for class: " + className); targetProvClass = className; //nm = new NetworkManager(ConfigMode.EDGE, "TestNet", tempDir.toURI()); nm = JxtaApplication.getNetworkManager(ConfigMode.EDGE, "TestNet", tempDir.toURI()); // nm.setUseDefaultSeeds(false); NetworkConfigurator nc = nm.getConfigurator(); nc.setTcpStartPort(60000); nc.setTcpEndPort(65535); nc.setHttpEnabled(false); nc.setUseMulticast(false); nc.setRendezvousSeeds(Collections.singleton("tcp://127.0.0.1:9701")); LOG.info("Created NM: " + nm + " (" + nm.getClass().getClassLoader() + ")"); } @Override public void init() { try { LOG.info("Initializing: " + this); PeerGroup netPeerGroup = nm.startNetwork(); nm.waitForRendezvousConnection(15000); LOG.info("Am RDV? " + netPeerGroup.isRendezvous()); LOG.info("Got RDV? " + netPeerGroup.getRendezVousService().isConnectedToRendezVous()); LOG.info("I'm in: " + netPeerGroup); LOG.info("I am : " + netPeerGroup.getPeerID()); List<PeerID> rdvPeers = netPeerGroup.getRendezVousService().getLocalRendezVousView(); // .getConnectedRendezVous(); Iterator<PeerID> iter = rdvPeers.iterator(); while (iter.hasNext()) { LOG.info("RDV : " + iter.next().toString()); } Thread.sleep(1000); service = netPeerGroup.getContentService(); List<? extends ContentProvider> provs = service.getContentProviders(); for (ContentProvider prov : provs) { if (prov.getClass().getName().equals(targetProvClass)) { LOG.info("Keeping provider: " + prov); } else { LOG.info("Removing untargeted provider: " + prov); service.removeContentProvider(prov); } } assertEquals(1, service.getContentProviders().size()); assertEquals(1, service.getActiveContentProviders().size()); } catch (Exception exc) { // Rethrow as unchecked throw(new RuntimeException( "Could not init: " + exc.getMessage(), exc)); } } @Override public byte[] share(URI id, byte[] data, String mimeType, boolean pub) { try { MimeMediaType mType = MimeMediaType.valueOf(mimeType); BinaryDocument bDoc = new BinaryDocument(data, mType); ContentID cID = (ContentID) IDFactory.fromURI(id); Content content = new Content(cID, null, bDoc); LOG.info("ContentSharer: Sharing content: " + content); List<ContentShare> shares = service.shareContent(content); assertNotNull(shares); assertEquals(1, shares.size()); ContentShare share = shares.get(0); ContentShareAdvertisement adv = share.getContentShareAdvertisement(); if (pub) { nm.getNetPeerGroup().getDiscoveryService().publish(adv); } LOG.info("ContentSharer created share adv:\n" + adv); Document advDoc = adv.getDocument(MimeMediaType.XMLUTF8); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); advDoc.sendToStream(byteOut); return byteOut.toByteArray(); } catch (Exception exc) { // Rethrow as unchecked throw(new RuntimeException( "Could not share: " + exc.getMessage(), exc)); } } @Override public void destroy() { LOG.info("Destroying: " + this); nm.stopNetwork(); nm = null; service = null; } } /** * Default constructor. * * @param spi implementation to test */ public AbstractContentProviderTest(ContentProviderSPI spi) { provider = spi; } /** * Starts a local JXTA instance in preparation for testing. * * @throws java.lang.Exception on error */ @BeforeClass public static void setupClass() throws Exception { LOG.info("============ Begin setupClass"); home = new TempDir(); //netMan = new NetworkManager(NetworkManager.ConfigMode.SUPER, "test"); netMan = JxtaApplication.getNetworkManager(NetworkManager.ConfigMode.SUPER, "test", home.toURI()); // netMan.setUseDefaultSeeds(false); NetworkConfigurator nc = netMan.getConfigurator(); nc.setHttpEnabled(false); nc.setUseMulticast(false); nc.setTcpPort(9701); pg = netMan.startNetwork(); LOG.info("Am RDV? " + pg.isRendezvous()); LOG.info("Got RDV? " + pg.getRendezVousService().isConnectedToRendezVous()); LOG.info("I'm in: " + pg); LOG.info("I am : " + pg.getPeerID()); List<PeerID> rdvPeers = pg.getRendezVousService().getLocalRendezVousView(); Iterator<PeerID> iter = rdvPeers.iterator(); while (iter.hasNext()) { LOG.info("RDV : " + iter.next().toString()); } service = pg.getContentService(); assertNotNull("ContentService not present in peer group", service); LOG.info("============ End setupClass"); } /** * Tears down the local JXTA instance. * * @throws java.lang.InterruptedException on error */ @AfterClass public static void tearDownClass() throws InterruptedException { LOG.info("============ Begin tearDownClass"); home.delete(); netMan.stopNetwork(); LOG.info("============ End tearDownClass"); System.err.flush(); System.out.flush(); Thread.sleep(500); } /** * Mark the beginning of a test. */ @Before public void setup() { LOG.info("============ Begin test"); } /** * Mark the end of a test. */ @After public void tearDown() { LOG.info("============ End test"); Thread.yield(); System.out.flush(); System.err.flush(); } /** * This test checks to see that the provider can successfully retrieve * content if provided an unpublished ContentShareAdvertisement. * * @throws Throwable on test error */ @Test public void retrieveByAdvertisement() throws Throwable { ContentSharerSPI spi = createContentSharer(); try { spi.init(); ContentID cID = IDFactory.newContentID(pg.getPeerGroupID(), true); byte[] sharedData = new String("This is the test content: " + toString()).getBytes(); ContentShareAdvertisement shareAdv = wrappedShare(spi, cID, sharedData, MimeMediaType.XMLUTF8, false); LOG.finest("Share produced advertisement:\n" + shareAdv); ContentTransfer xfer = service.retrieveContent(shareAdv); File dest = new File(home, "received"); LOG.fine("Starting transfer"); xfer.startTransfer(dest); try { xfer.waitFor(30000); if (!xfer.getTransferState().isFinished()) { fail("Transfer timed out"); } Content received = xfer.getContent(); LOG.fine("Received Content: " + received); assertEqual(contentOf(cID, sharedData, MimeMediaType.XMLUTF8), received); } catch (TransferException xferx) { LOG.log(Level.SEVERE, "Transfer failed"); fail("Caught transfer exception: " + xferx); } } catch (Throwable thr) { LOG.log(Level.WARNING, "Caught throwable\n", thr); throw(thr); } finally { spi.destroy(); } } /** * This test checks to see that the provider can successfully retrieve * content if provided the ContentID of a published ContentShare. * * @throws Throwable on test error */ @Test public void retrieveByID() throws Throwable { ContentSharerSPI spi = createContentSharer(); try { spi.init(); ContentID cID = IDFactory.newContentID(pg.getPeerGroupID(), true); byte[] sharedData = new String("This is the test content: " + toString()).getBytes(); ContentShareAdvertisement shareAdv = wrappedShare(spi, cID, sharedData, MimeMediaType.XMLUTF8, true); LOG.finest("Share produced advertisement:\n" + shareAdv); ContentTransfer xfer = service.retrieveContent(cID); File dest = new File(home, "received"); LOG.fine("Starting transfer"); xfer.startTransfer(dest); try { xfer.waitFor(30000); if (!xfer.getTransferState().isFinished()) { fail("Transfer timed out"); } Content received = xfer.getContent(); LOG.fine("Received Content: " + received); assertEqual(contentOf(cID, sharedData, MimeMediaType.XMLUTF8), received); } catch (TransferException xferx) { LOG.log(Level.SEVERE, "Transfer failed"); fail("Caught transfer exception: " + xferx); } } catch (Throwable thr) { LOG.log(Level.WARNING, "Caught throwable\n", thr); throw(thr); } finally { spi.destroy(); } } /////////////////////////////////////////////////////////////////////////// // Private methods: /** * Creates another JXTA instance within this JVM which will serve Content * when requested to do so. This additional instance is loaded within * a separate ClassLoader structure and must be interacted with via * standard java Classes and the specially handled ContentSharerSPI * interface. * * @return content sharer instance */ private ContentSharerSPI createContentSharer() { try { DelegateClassLoader dcl = new DelegateClassLoader( AbstractContentProviderTest.class.getClassLoader()); dcl.addClassRedefinePattern(Pattern.compile(".*")); dcl.addClassNeverRedefinePattern(Pattern.compile("org.junit.*")); dcl.addClassNeverRedefinePattern(Pattern.compile( ContentSharerSPI.class.getName())); Class<?> fc = dcl.loadClass(ContentSharer.class.getName()); Constructor<?> constructor = fc.getDeclaredConstructor( File.class, String.class); File sharerHome = new File(home, "sharerHome"); Object obj = constructor.newInstance( sharerHome, provider.getClass().getName()); assertTrue(obj instanceof ContentSharerSPI); return (ContentSharerSPI) obj; } catch (Exception exc) { // Rethrow as unchecked throw(new RuntimeException("Caught exception", exc)); } } /** * Requests a content sharer to share a content built from the specified * components, then has it communicate the ContentShareAdvertisement of * the newly shared Content in a form which can be understood from the * calling ClassLoader context. * * @param spi sharer to have share the Content * @param cID ContentID of the content to be shared * @param data data of the Content to be shared * @param mimeType MIME media type of the Content to be shared * @return ContentShareAdvertisement of the shared Content * @throws java.io.IOException on error */ private ContentShareAdvertisement wrappedShare( ContentSharerSPI spi, ContentID cID, byte[] data, MimeMediaType mimeType, boolean doPublish) throws IOException { byte[] advData = spi.share(cID.toURI(), data, mimeType.getMimeMediaType(), false); BinaryDocument advDoc = new BinaryDocument(advData, MimeMediaType.XMLUTF8); XMLElement<?> elem = (XMLElement<?>) StructuredDocumentFactory.newStructuredDocument( advDoc.getMimeType(), advDoc.getStream()); ContentShareAdvertisement shareAdv = (ContentShareAdvertisement) AdvertisementFactory.newAdvertisement(elem); return shareAdv; } private Content contentOf( ContentID cID, byte[] data, MimeMediaType mimeType) { BinaryDocument bDoc = new BinaryDocument(data, mimeType); return new Content(cID, null, bDoc); } /** * Compares two Content documents for equality. */ private void assertEqual(Content expected, Content actual) throws IOException { // Get the trivial cases out of the way if (expected == null && actual == null) { return; } else if (expected == null || actual == null) { // This will catch the failure assertEqual(expected, actual); } else if (expected == actual) { return; } assertEquals(expected.getContentID(), actual.getContentID()); assertEquals(expected.getMetaID(), actual.getMetaID()); // Compare the documents Document eDoc = expected.getDocument(); Document aDoc = actual.getDocument(); assertEquals(eDoc.getFileExtension(), aDoc.getFileExtension()); // The MIME type parameters are not transferred assertEquals(eDoc.getMimeType().getMimeMediaType(), aDoc.getMimeType().toString()); // Compare the data ByteArrayOutputStream eOut = new ByteArrayOutputStream(); eDoc.sendToStream(eOut); ByteArrayOutputStream aOut = new ByteArrayOutputStream(); aDoc.sendToStream(aOut); byte[] eBytes = eOut.toByteArray(); byte[] aBytes = aOut.toByteArray(); assertEquals(new String(eBytes), new String(aBytes)); } }
40.268293
115
0.616747
ea5981acf16debb52e5f1d79d4802bc12103ce3e
4,988
// Copyright (c) FIRST and other WPILib contributors. // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. package frc.robot; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.CommandScheduler; import org.littletonrobotics.junction.LoggedRobot; import org.littletonrobotics.junction.Logger; import org.littletonrobotics.junction.inputs.LoggedNetworkTables; import org.littletonrobotics.junction.io.*; import frc.robot.Constants.Mode; /** * The VM is configured to automatically run this class, and to call the functions corresponding to * each mode, as described in the TimedRobot documentation. If you change the name of this class or * the package after creating this project, you must also update the build.gradle file in the * project. */ public class Robot extends LoggedRobot { private Command autonomousCommand; private RobotContainer robotContainer; public Robot() { super(Constants.loopPeriodSecs); } /** * This function is run when the robot is first started up and should be used for any * initialization code. */ @Override public void robotInit() { // Set up logging system Logger logger = Logger.getInstance(); setUseTiming(Constants.getMode() != Mode.REPLAY); LoggedNetworkTables.getInstance().addTable("/LiveWindow"); logger.recordMetadata("ProjectName", BuildConstants.MAVEN_NAME); logger.recordMetadata("BuildDate", BuildConstants.BUILD_DATE); logger.recordMetadata("GitSHA", BuildConstants.GIT_SHA); logger.recordMetadata("GitDate", BuildConstants.GIT_DATE); logger.recordMetadata("GitBranch", BuildConstants.GIT_BRANCH); switch (BuildConstants.DIRTY) { case -1: logger.recordMetadata("GitDirty", "Unknown"); break; case 0: logger.recordMetadata("GitDirty", "All changes committed"); break; case 1: logger.recordMetadata("GitDirty", "Uncomitted changes"); break; } switch (Constants.getMode()) { case REAL: logger.addDataReceiver(new ByteLogReceiver("/home/lvuser/")); logger.addDataReceiver(new LogSocketServer(5800)); break; case SIM: logger.addDataReceiver(new LogSocketServer(5800)); break; case REPLAY: String path = ByteLogReplay.promptForPath(); logger.setReplaySource(new ByteLogReplay(path)); logger.addDataReceiver(new ByteLogReceiver( ByteLogReceiver.addPathSuffix(path, "_simulated"))); break; } logger.start(); // Instantiate our RobotContainer. This will perform all our button bindings, // and put our autonomous chooser on the dashboard. robotContainer = new RobotContainer(); } /** * This function is called every robot packet, no matter the mode. Use this for items like * diagnostics that you want ran during disabled, autonomous, teleoperated and test. * * <p> * This runs after the mode specific periodic functions, but before LiveWindow and SmartDashboard * integrated updating. */ @Override public void robotPeriodic() { robotContainer.updateOI(); CommandScheduler.getInstance().run(); Logger.getInstance().recordOutput("SineWave", Math.sin(Logger.getInstance().getTimestamp() / 2) * 10); Logger.getInstance().recordOutput("CosineWave", Math.cos(Logger.getInstance().getTimestamp() / 2) * 10); Logger.getInstance().recordOutput("FastWave", Math.sin(Logger.getInstance().getTimestamp() * 2) * 10); } /** This function is called once each time the robot enters Disabled mode. */ @Override public void disabledInit() {} @Override public void disabledPeriodic() {} /** * This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */ @Override public void autonomousInit() { autonomousCommand = robotContainer.getAutonomousCommand(); // schedule the autonomous command (example) if (autonomousCommand != null) { autonomousCommand.schedule(); } } /** This function is called periodically during autonomous. */ @Override public void autonomousPeriodic() {} @Override public void teleopInit() { // This makes sure that the autonomous stops running when // teleop starts running. If you want the autonomous to // continue until interrupted by another command, remove // this line or comment it out. if (autonomousCommand != null) { autonomousCommand.cancel(); } } /** This function is called periodically during operator control. */ @Override public void teleopPeriodic() {} @Override public void testInit() { // Cancels all running commands at the start of test mode. CommandScheduler.getInstance().cancelAll(); } /** This function is called periodically during test mode. */ @Override public void testPeriodic() {} }
33.033113
99
0.705493
0677504aa7541bde0e8753db227948ed4ba7f875
2,178
package br.zup.bootcamp.nossoCartao.Proposta.Request; import br.zup.bootcamp.nossoCartao.Proposta.Proposta; import org.hibernate.validator.internal.constraintvalidators.hv.br.CNPJValidator; import org.hibernate.validator.internal.constraintvalidators.hv.br.CPFValidator; import org.springframework.util.Assert; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Positive; import java.math.BigDecimal; public class NovaPropostaRequest { @NotBlank private String documento; @NotBlank @Email private String email; @NotBlank private String nome; @NotBlank private String endereco; @NotNull @Positive private BigDecimal salario; public String getDocumento() { return documento; } public String getEmail() { return email; } public String getNome() { return nome; } public String getEndereco() { return endereco; } public BigDecimal getSalario() { return salario; } @Deprecated public NovaPropostaRequest() { } public NovaPropostaRequest(@NotBlank String documento, @NotBlank @Email String email, @NotBlank String nome, @NotBlank String endereco, @NotNull @Positive BigDecimal salario) { this.documento = documento; this.email = email; this.nome = nome; this.endereco = endereco; this.salario = salario; } public Proposta toModel() { return new Proposta(documento, email, nome, endereco, salario); } public boolean documentoValido() { Assert.hasLength(documento, "Documento não informado."); CPFValidator cpfValidator = new CPFValidator(); cpfValidator.initialize(null); CNPJValidator cnpjValidator = new CNPJValidator(); cnpjValidator.initialize(null); return cpfValidator.isValid(documento, null) || cnpjValidator.isValid(documento, null); } }
25.325581
81
0.652893
8586d2a296302c1ed817ee6bdcd765f889f2459d
538
package org.incode.example.tags.demo; import java.util.Set; import javax.xml.bind.annotation.XmlRootElement; import com.google.common.collect.Sets; import org.apache.isis.applib.Module; import org.apache.isis.applib.ModuleAbstract; import org.incode.example.tags.demo.shared.TagsDemoSharedModule; @XmlRootElement(name = "module") public class TagsDemoModule extends ModuleAbstract { @Override public Set<Module> getDependencies() { return Sets.newHashSet( new TagsDemoSharedModule() ); } }
22.416667
64
0.741636
de52b114fc25aa3f04e829cdeead163d7cc39d32
17,054
package CrunchFactions; import java.sql.SQLException; import java.util.List; import java.util.Optional; import java.util.UUID; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockSnapshot; import org.spongepowered.api.block.BlockTypes; import org.spongepowered.api.block.tileentity.TileEntity; import org.spongepowered.api.boss.BossBarColors; import org.spongepowered.api.boss.BossBarOverlays; import org.spongepowered.api.boss.ServerBossBar; import org.spongepowered.api.command.CommandResult; import org.spongepowered.api.data.Transaction; import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.entity.EntityTypes; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.block.ChangeBlockEvent; import org.spongepowered.api.event.block.InteractBlockEvent; import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.cause.EventContextKeys; import org.spongepowered.api.event.entity.DamageEntityEvent; import org.spongepowered.api.event.entity.DestructEntityEvent; import org.spongepowered.api.event.entity.MoveEntityEvent; import org.spongepowered.api.event.filter.cause.First; import org.spongepowered.api.event.filter.cause.Root; import org.spongepowered.api.event.message.MessageChannelEvent; import org.spongepowered.api.event.world.ExplosionEvent; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.action.TextActions; import org.spongepowered.api.text.format.TextColors; import org.spongepowered.api.util.Direction; import org.spongepowered.api.world.LocatableBlock; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import com.flowpowered.math.vector.Vector3d; import com.flowpowered.math.vector.Vector3i; public class protectEvents { @Listener public void onBoom(ExplosionEvent.Detonate event) throws SQLException{ FactionPlayer facP = new FactionPlayer(); Optional<Player> cause = event.getCause().first(Player.class); if (cause.isPresent()) { Player player = cause.get(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); Faction faction = new Faction(); if (facP.getFacID() != 1) { faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = event.getExplosion().getLocation().getChunkPosition(); List<Location<World>> locs = event.getAffectedLocations(); int otherFacID = 0; for (Location loc : locs) { String worldName = event.getTargetWorld().getName(); Vector3i location2 = loc.getChunkPosition(); String combined = worldName + ":" + location2; if (FactionsMain.allFactionClaims.containsKey(combined) && !faction.isEnemy(facP.getFacID())) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land, you cannot damage them without being at war!")); return; } } } String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; if (FactionsMain.allFactionClaims.containsKey(combined) && !faction.isEnemy(facP.getFacID())) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land, you cannot damage them without being at war!")); } } } } else { List<Location<World>> locs = event.getAffectedLocations(); for (Location loc : locs) { String worldName = event.getTargetWorld().getName(); Vector3i location2 = loc.getChunkPosition(); String combined = worldName + ":" + location2; if (FactionsMain.allFactionClaims.containsKey(combined)) { event.setCancelled(true); return; } } Vector3i location = event.getExplosion().getLocation().getChunkPosition(); String worldName = event.getTargetWorld().getName(); String combined = worldName + ":" + location; if (FactionsMain.allFactionClaims.containsKey(combined)) { event.setCancelled(true); } } } @Listener public void onDamage(DamageEntityEvent event) throws SQLException{ FactionPlayer facP = new FactionPlayer(); Optional<Player> cause = event.getCause().first(Player.class); if (cause.isPresent()) { Player player = cause.get(); if (event.getTargetEntity() == cause.get()) { player.sendMessage(Text.of("dumbass")); return; } if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); Faction faction = new Faction(); if (facP.getFacID() != 1) { faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = event.getTargetEntity().getLocation().getChunkPosition(); String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined) && !faction.isEnemy(FactionsMain.allFactionClaims.get(combined))) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID) { if (event.getTargetEntity().getType() == EntityTypes.PLAYER) { FactionPlayer otherFacPlayer = new FactionPlayer(); Player otherPlayer = (Player) event.getTargetEntity(); otherFacPlayer = otherFacPlayer.getFacPlayerFromUUID(otherPlayer.getUniqueId()); if (Faction.FactionFromID(facP.getFacID()).isAlly(otherFacPlayer.getFacID()) || facP.getFacID() == otherFacPlayer.getFacID()) { event.setCancelled(true); return; } Double damage = event.getBaseDamage() - (event.getBaseDamage() * 0.2); player.sendMessage(Text.of(FactionsMain.defaultMessage, "Damage reduced by 20% as you are attacking in neutral territory.")); event.setBaseDamage(damage); return; } else { event.setCancelled(true); } player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land, you cannot damage them without being at war!")); } } } } else { Vector3i location = event.getTargetEntity().getLocation().getChunkPosition(); String worldName = event.getTargetEntity().getWorld().getName(); String combined = worldName + ":" + location; if (FactionsMain.allFactionClaims.containsKey(combined) && event.getTargetEntity().getType() != EntityTypes.PLAYER) { event.setCancelled(true); } } } @Listener public void onBlockBreak(ChangeBlockEvent.Break event, @Root Player player) throws SQLException{ FactionPlayer facP = new FactionPlayer(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); if (facP.getFacID() != 1) { Faction faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = null; for(Transaction<BlockSnapshot> blockSnapshotTransaction : event.getTransactions()) { location = blockSnapshotTransaction.getOriginal().getLocation().get().getChunkPosition(); } String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined)) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID && !player.hasPermission("factions.admin")) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land!")); } } } } @Listener public void onBlockPlace(ChangeBlockEvent.Place event) throws SQLException{ Optional<Player> cause = event.getCause().first(Player.class); Player player = null; if (cause.isPresent()) { player = cause.get(); FactionPlayer facP = new FactionPlayer(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); if (facP.getFacID() != 1) { Faction faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = null; for(Transaction<BlockSnapshot> blockSnapshotTransaction : event.getTransactions()) { location = blockSnapshotTransaction.getOriginal().getLocation().get().getChunkPosition(); } String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined)) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID && !player.hasPermission("factions.admin")) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land!")); } } } } // else { // List<Transaction<BlockSnapshot>> locs = event.getTransactions(); // for (Transaction<BlockSnapshot> loc : locs) { // String worldName = loc.getOriginal().getLocation().get().getExtent().getName(); // Vector3i location2 = loc.getOriginal().getLocation().get().getChunkPosition(); // String combined = worldName + ":" + location2; // if (FactionsMain.allFactionClaims.containsKey(combined)) { // event.setCancelled(true); // return; // } // } // } } @Listener public void onBlockBreak(ChangeBlockEvent.Modify event, @Root Player player) throws SQLException{ FactionPlayer facP = new FactionPlayer(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); if (facP.getFacID() != 1) { Faction faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = null; for(Transaction<BlockSnapshot> blockSnapshotTransaction : event.getTransactions()) { location = blockSnapshotTransaction.getOriginal().getLocation().get().getChunkPosition(); } String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined)) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID && !player.hasPermission("factions.admin")) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land!")); } } } } @Listener public void onBlockBreak(InteractBlockEvent event, @Root Player player) throws SQLException{ FactionPlayer facP = new FactionPlayer(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); if (facP.getFacID() != 1) { Faction faction = Faction.FactionFromID(facP.getFacID()); } if (event.getInteractionPoint().isPresent()) { Location loc = new Location(player.getWorld(), event.getInteractionPoint().get().getX(), 0, event.getInteractionPoint().get().getZ()); Vector3i location = loc.getChunkPosition(); String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined)) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID && !player.hasPermission("factions.admin")) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land!")); } } } else { return; } } } // public static class fireSpread{ // @Listener // public void onBlockBreak(ChangeBlockEvent event) throws SQLException{ // for(Transaction<BlockSnapshot> blockSnapshotTransaction : event.getTransactions()) { // if (blockSnapshotTransaction.getFinal().getState().getType() == BlockTypes.FIRE) { // //do fire check for faction flags // String worldName = blockSnapshotTransaction.getFinal().getLocation().get().getExtent().getName(); // Vector3i location = blockSnapshotTransaction.getOriginal().getLocation().get().getChunkPosition(); // String combined = worldName + ":" + location; // if (FactionsMain.allFactionClaims.containsKey(combined)) { // event.setCancelled(true); // } // } // } // } // // } @Listener public void onBlockBreak(ChangeBlockEvent.Post event, @Root Player player) throws SQLException{ FactionPlayer facP = new FactionPlayer(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); if (facP.getFacID() != 1) { Faction faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = null; for(Transaction<BlockSnapshot> blockSnapshotTransaction : event.getTransactions()) { location = blockSnapshotTransaction.getOriginal().getLocation().get().getChunkPosition(); } String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined)) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID && !player.hasPermission("factions.admin")) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land!")); } } } } @Listener public void onBlockBreak(ChangeBlockEvent.Pre event) throws SQLException{ boolean pistonExtend = event.getContext().containsKey(EventContextKeys.PISTON_EXTEND); boolean pistonRetract = event.getContext().containsKey(EventContextKeys.PISTON_RETRACT); Optional<Player> cause = event.getCause().first(Player.class); Player player = null; if (cause.isPresent()) { player = cause.get(); if (pistonExtend || pistonRetract) { LocatableBlock locatableBlock = event.getCause().first(LocatableBlock.class).orElse(null); TileEntity tileEntity = event.getCause().first(TileEntity.class).orElse(null); Location<World> sourceLocation = locatableBlock != null ? locatableBlock.getLocation() : tileEntity != null ? tileEntity.getLocation() : null; String tempName = sourceLocation.getExtent().getName(); Vector3i tempLoc = sourceLocation.getChunkPosition(); String tempCombined = tempName + ":" + tempLoc; if (FactionsMain.allFactionClaims.containsKey(tempCombined)) { return; } List<Location<World>> locs = event.getLocations(); for (Location loc : locs) { String worldName = event.getLocations().get(0).getExtent().getName(); Vector3i location2 = loc.getChunkPosition(); String combined = worldName + ":" + location2; if (FactionsMain.allFactionClaims.containsKey(combined)) { event.setCancelled(true); return; } } } FactionPlayer facP = new FactionPlayer(); if (facP.getFacPlayerFromUUID(player.getUniqueId()) != null) { facP = facP.getFacPlayerFromUUID(player.getUniqueId()); if (facP.getFacID() != 1) { Faction faction = Faction.FactionFromID(facP.getFacID()); } Vector3i location = player.getLocation().getChunkPosition(); String worldName = player.getWorld().getName(); String combined = worldName + ":" + location; int otherFacID = 0; if (FactionsMain.allFactionClaims.containsKey(combined)) { otherFacID = Faction.FactionFromID(FactionsMain.allFactionClaims.get(combined)).getFacID(); if (facP.getFacID() != otherFacID && !player.hasPermission("factions.admin")) { event.setCancelled(true); player.sendMessage(Text.of(FactionsMain.defaultMessage, "This is not your land!")); } } } return; } if (pistonExtend || pistonRetract) { LocatableBlock locatableBlock = event.getCause().first(LocatableBlock.class).orElse(null); TileEntity tileEntity = event.getCause().first(TileEntity.class).orElse(null); Location<World> sourceLocation = locatableBlock != null ? locatableBlock.getLocation() : tileEntity != null ? tileEntity.getLocation() : null; String tempName = sourceLocation.getExtent().getName(); Vector3i tempLoc = sourceLocation.getChunkPosition(); String tempCombined = tempName + ":" + tempLoc; if (FactionsMain.allFactionClaims.containsKey(tempCombined)) { return; } List<Location<World>> locs = event.getLocations(); for (Location loc : locs) { String worldName = event.getLocations().get(0).getExtent().getName(); Vector3i location2 = loc.getChunkPosition(); String combined = worldName + ":" + location2; if (FactionsMain.allFactionClaims.containsKey(combined)) { event.setCancelled(true); return; } } } } }
40.701671
146
0.712971
526e252c325a43ce7b8a4bd0d37a48d23f50541c
411
package bExpressionsStatementsCodeBlocksMethods.dMethods.aChallenges; public class EqualSumChecker { public static void main(String[] args) { System.out.println(hasEqualSum(10, 10,9)); } public static boolean hasEqualSum (int par1, int par2, int par3) { boolean result = false; if(par1 + par2 == par3) { result=true; } return result; } }
21.631579
70
0.627737
38e82a064c91dd238f96febf1cb864772a556b1b
3,002
package esg.dag.sim; public class TangleSim { public static void main(String[] args) { TangleSim b = new TangleSim(); String outputFile = "nodeset.ser"; b.run(outputFile); } private void run(String outputFile){ RandomNetwork n; Simulation s; NodeSet ns; TransactionSet ts; Sampler sampler; //Creating sampler sampler = new StandardSampler(); sampler.setTxArrivalIntervalRate(Parameters.Lambda); sampler.setTxSizeMean(5000);//each tryte is 1300 bytes sampler.setTxSizeSD(500); sampler.setTxValueMean(50); sampler.setTxValueSD(12); sampler.setNodeHashPowerMean(Parameters.HashPowerMean); sampler.setNodeHashPowerSD(Parameters.HashPowerSD); sampler.setNodeElectricPowerMean(1375); sampler.setNodeElectricPowerSD(20); sampler.setNodeElectricCostMean((float) 0.1); sampler.setNodeElectricCostSD((float) 0.05); sampler.setNetThroughputMean(Parameters.NetThroughputMean); sampler.setNetThroughputSD(Parameters.NetThroughputSD); sampler.setCurrentDifficulty(Parameters.MWM); //If sampler Random object is instanced without sampler seed, the seed will be the same as the system time in milliseconds // sampler.setSeed(2018); s = new Simulation(sampler); ns = new NodeSet(s); n = new RandomNetwork(ns,sampler); s.setNetwork(n); ns.addNodes(Parameters.NumofNodes); //a network where all nodes are honest // ns.addNodes(Parameters.NumofNodes, 1); //a network where 1 node is malicious s.setNodeSet(ns); ts = new TransactionSet(s, ns); ts.appendTransactions(Parameters.NumofHonestTxs); s.setTransactions(ts); // System.out.println("Victim Tx ID: " + s.getTransactions().getVictimTx().getID()); s.setReport(new Report(s)); try { Globals.createFileforWriter(); }catch (Exception e){} long beginningTime = System.currentTimeMillis(); s.run(); long endTime = System.currentTimeMillis(); long realTime = (endTime - beginningTime); // in Milli-Sec System.out.println("Real time(ms) is: " + realTime); System.out.println("And Simulation time(ms) is: " + Globals.currTime); // System.out.println("Malicious Node ID is: " + s.getNodeSet().getMaliciousNode().getID()); // System.out.println("VictimTx ID: " + s.getTransactions().getVictimTx().getID()); // System.out.println("MalTx ID: " + s.getTransactions().getMaliciousTx().getID()); System.out.println("MalNodePropCounter: " + Node.malNodePropCounter); System.out.println("Hidden Chain Creation Time(ms): " + s.getNodeSet().getMaliciousNode().createhiddenChainTime); System.out.println("Hidden Chain Revealing Time(ms): " + s.getNodeSet().getMaliciousNode().revealhiddenChainTime); Globals.writer.close(); } }
43.507246
130
0.65523
0189b7d467c9b1990408ec8ce732fafbc01c175b
1,248
package com.intellij.plugins.thrift.completion; import com.intellij.plugins.thrift.ThriftCodeInsightFixtureTestCase; import com.intellij.plugins.thrift.ThriftFileType; /** * Created by fkorotkov. */ public class ThriftEditorCompletionTest extends ThriftCodeInsightFixtureTestCase { @Override protected String getBasePath() { return "completion/editor"; } public void testTypeParam(){ myFixture.configureByText(ThriftFileType.INSTANCE, "struct Foo {1: list<caret>}"); myFixture.type('<'); myFixture.checkResult("struct Foo {1: list<<caret>>}"); } public void testExistingClosingBrace1(){ myFixture.configureByText(ThriftFileType.INSTANCE, "struct Foo {1: list<Foo<caret>>}"); myFixture.type('>'); myFixture.checkResult("struct Foo {1: list<Foo><caret>}"); } public void testExistingClosingBrace2(){ myFixture.configureByText(ThriftFileType.INSTANCE, "struct Foo {1: list<Foo<caret>> list}"); myFixture.type('>'); myFixture.checkResult("struct Foo {1: list<Foo><caret> list}"); } public void testExistingCurlyBrace(){ myFixture.configureByText(ThriftFileType.INSTANCE, "service Foo {<caret>}"); myFixture.type('}'); myFixture.checkResult("service Foo {}<caret>"); } }
32
96
0.722756
46fa5b33865244f4f7df445b20d0dea0331b496f
4,429
package com.github.zhenwei.core.crypto.util; import com.github.zhenwei.core.crypto.Digest; import com.github.zhenwei.core.crypto.digests.MD5Digest; import com.github.zhenwei.core.crypto.digests.SHA1Digest; import com.github.zhenwei.core.crypto.digests.SHA224Digest; import com.github.zhenwei.core.crypto.digests.SHA256Digest; import com.github.zhenwei.core.crypto.digests.SHA384Digest; import com.github.zhenwei.core.crypto.digests.SHA3Digest; import com.github.zhenwei.core.crypto.digests.SHA512Digest; import com.github.zhenwei.core.crypto.digests.SHA512tDigest; import com.github.zhenwei.core.crypto.digests.SHAKEDigest; import java.util.HashMap; import java.util.Map; /** * Basic factory class for message digests. */ public final class DigestFactory { private static final Map cloneMap = new HashMap(); private static interface Cloner { Digest createClone(Digest original); } static { cloneMap.put(createMD5().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new MD5Digest((MD5Digest) original); } }); cloneMap.put(createSHA1().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new MD5Digest((MD5Digest) original); } }); cloneMap.put(createSHA224().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA224Digest((SHA224Digest) original); } }); cloneMap.put(createSHA256().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA256Digest((SHA256Digest) original); } }); cloneMap.put(createSHA384().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA384Digest((SHA384Digest) original); } }); cloneMap.put(createSHA512().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA512Digest((SHA512Digest) original); } }); cloneMap.put(createSHA3_224().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA3Digest((SHA3Digest) original); } }); cloneMap.put(createSHA3_256().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA3Digest((SHA3Digest) original); } }); cloneMap.put(createSHA3_384().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA3Digest((SHA3Digest) original); } }); cloneMap.put(createSHA3_512().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHA3Digest((SHA3Digest) original); } }); cloneMap.put(createSHAKE128().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHAKEDigest((SHAKEDigest) original); } }); cloneMap.put(createSHAKE256().getAlgorithmName(), new Cloner() { public Digest createClone(Digest original) { return new SHAKEDigest((SHAKEDigest) original); } }); } public static Digest createMD5() { return new MD5Digest(); } public static Digest createSHA1() { return new SHA1Digest(); } public static Digest createSHA224() { return new SHA224Digest(); } public static Digest createSHA256() { return new SHA256Digest(); } public static Digest createSHA384() { return new SHA384Digest(); } public static Digest createSHA512() { return new SHA512Digest(); } public static Digest createSHA512_224() { return new SHA512tDigest(224); } public static Digest createSHA512_256() { return new SHA512tDigest(256); } public static Digest createSHA3_224() { return new SHA3Digest(224); } public static Digest createSHA3_256() { return new SHA3Digest(256); } public static Digest createSHA3_384() { return new SHA3Digest(384); } public static Digest createSHA3_512() { return new SHA3Digest(512); } public static Digest createSHAKE128() { return new SHAKEDigest(128); } public static Digest createSHAKE256() { return new SHAKEDigest(256); } public static Digest cloneDigest(Digest hashAlg) { return ((Cloner) cloneMap.get(hashAlg.getAlgorithmName())).createClone(hashAlg); } }
29.138158
84
0.69203
6c81df743b4e32a4e278e5d90bfd8beafe619fd2
4,338
/* * Copyright (C) 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.ros.internal.message; import static org.junit.Assert.assertEquals; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.ros.internal.message.topic.TopicDefinitionResourceProvider; import org.ros.message.MessageFactory; /** * @author damonkohler@google.com (Damon Kohler) */ public class MessageTest { private TopicDefinitionResourceProvider topicDefinitionResourceProvider; private MessageFactory messageFactory; @Before public void before() { topicDefinitionResourceProvider = new TopicDefinitionResourceProvider(); messageFactory = new DefaultMessageFactory(topicDefinitionResourceProvider); } @Test public void testCreateEmptyMessage() { topicDefinitionResourceProvider.add("foo/foo", ""); messageFactory.newFromType("foo/foo"); } @Test public void testCreateEmptyMessageWithBlankLines() { topicDefinitionResourceProvider.add("foo/foo", "\n\n\n\n\n"); messageFactory.newFromType("foo/foo"); } @Test public void testString() { String data = "Hello, ROS!"; RawMessage rawMessage = messageFactory.newFromType("std_msgs/String"); rawMessage.setString("data", data); assertEquals(data, rawMessage.getString("data")); } @Test public void testStringWithComments() { topicDefinitionResourceProvider.add("foo/foo", "# foo\nstring data\n # string other data"); String data = "Hello, ROS!"; RawMessage rawMessage = messageFactory.newFromType("foo/foo"); rawMessage.setString("data", data); assertEquals(data, rawMessage.getString("data")); } @Test public void testInt8() { byte data = 42; RawMessage rawMessage = messageFactory.newFromType("std_msgs/Int8"); rawMessage.setInt8("data", data); assertEquals(data, rawMessage.getInt8("data")); } @Test public void testNestedMessage() { topicDefinitionResourceProvider.add("foo/foo", "bar data"); topicDefinitionResourceProvider.add("foo/bar", "int8 data"); RawMessage fooMessage = messageFactory.newFromType("foo/foo"); RawMessage barMessage = messageFactory.newFromType("foo/bar"); fooMessage.setMessage("data", barMessage); byte data = 42; barMessage.setInt8("data", data); assertEquals(data, fooMessage.getMessage("data").toRawMessage().getInt8("data")); } @Test public void testNestedMessageList() { topicDefinitionResourceProvider.add("foo/foo", "bar[] data"); topicDefinitionResourceProvider.add("foo/bar", "int8 data"); RawMessage fooMessage = messageFactory.newFromType("foo/foo"); RawMessage barMessage = messageFactory.newFromType("foo/bar"); fooMessage.setMessageList("data", Lists.<Message>newArrayList(barMessage)); byte data = 42; barMessage.toRawMessage().setInt8("data", data); assertEquals(data, fooMessage.getMessageList("data").get(0).toRawMessage().getInt8("data")); } @Test public void testConstantInt8() { topicDefinitionResourceProvider.add("foo/foo", "int8 data=42"); RawMessage rawMessage = messageFactory.newFromType("foo/foo"); assertEquals(42, rawMessage.getInt8("data")); } @Test public void testConstantString() { topicDefinitionResourceProvider.add("foo/foo", "string data=Hello, ROS! # comment "); RawMessage rawMessage = messageFactory.newFromType("foo/foo"); assertEquals("Hello, ROS! # comment", rawMessage.getString("data")); } public void testInt8List() { topicDefinitionResourceProvider.add("foo/foo", "int8[] data"); RawMessage rawMessage = messageFactory.newFromType("foo/foo"); byte[] data = new byte[] { (byte) 1, (byte) 2, (byte) 3 }; rawMessage.setInt8Array("data", data); assertEquals(data, rawMessage.getInt8Array("data")); } }
34.983871
98
0.724297
0a0fd6078d3145145ea8b757396436a52955d80d
5,235
package cn.itcast.home.action; import java.sql.Timestamp; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONObject; import org.apache.commons.lang3.StringUtils; import org.apache.struts2.ServletActionContext; import cn.itcast.core.constant.Constant; import cn.itcast.core.util.QueryHelper; import cn.itcast.nsfw.complain.entity.Complain; import cn.itcast.nsfw.complain.service.ComplainService; import cn.itcast.nsfw.info.entity.Info; import cn.itcast.nsfw.info.service.InfoService; import cn.itcast.nsfw.user.entity.User; import cn.itcast.nsfw.user.service.UserService; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; public class HomeAction extends ActionSupport { @Resource private UserService userService; @Resource private InfoService infoService; @Resource private ComplainService complainService; private Map<String, Object> return_map; private Complain comp; private Info info; //跳转到首页 public String execute(){ //加载信息列表 //加载分类集合 ActionContext.getContext().getContextMap().put("infoTypeMap", Info.INFO_TYPE_MAP); QueryHelper queryHelper1 = new QueryHelper(Info.class, "i"); queryHelper1.addOrderByProperty("i.createTime", QueryHelper.ORDER_BY_DESC); List<Info> infoList = infoService.getPageResult(queryHelper1, 1, 5).getItems(); ActionContext.getContext().getContextMap().put("infoList", infoList); User user = (User) ServletActionContext.getRequest().getSession().getAttribute(Constant.USER); //加载我的投诉信息列表 //加载状态集合 ActionContext.getContext().getContextMap().put("complainStateMap", Complain.COMPLAIN_STATE_MAP); QueryHelper queryHelper2 = new QueryHelper(Complain.class, "c"); queryHelper2.addCondition("c.compName = ?", user.getName()); //根据投诉时间升序排序 queryHelper2.addOrderByProperty("c.compTime", QueryHelper.ORDER_BY_ASC); //根据投诉状态降序排序 queryHelper2.addOrderByProperty("c.state", QueryHelper.ORDER_BY_DESC); List<Complain> complainList = complainService.getPageResult(queryHelper2, 1, 6).getItems(); ActionContext.getContext().getContextMap().put("complainList", complainList); return "home"; } //跳转到我要投诉 public String complainAddUI(){ return "complainAddUI"; } public void getUserJson(){ try { //1、获取部门 String dept = ServletActionContext.getRequest().getParameter("dept"); if(StringUtils.isNotBlank(dept)){ QueryHelper queryHelper = new QueryHelper(User.class, "u"); queryHelper.addCondition("u.dept like ?", "%" + dept); //2、根据部门查询用户列表 List<User> userList = userService.findObjects(queryHelper); //创建Json对象 JSONObject jso = new JSONObject(); jso.put("msg", "success"); jso.accumulate("userList", userList); //3、输出用户列表以json格式字符串形式输出 HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/html"); ServletOutputStream outputStream = response.getOutputStream(); outputStream.write(jso.toString().getBytes("utf-8")); outputStream.close(); } } catch (Exception e) { e.printStackTrace(); } } public String getUserJson2(){ try { //1、获取部门 String dept = ServletActionContext.getRequest().getParameter("dept"); if(StringUtils.isNotBlank(dept)){ QueryHelper queryHelper = new QueryHelper(User.class, "u"); queryHelper.addCondition("u.dept like ?", "%" +dept); //2、根据部门查询用户列表 return_map = new HashMap<String, Object>(); return_map.put("msg", "success"); return_map.put("userList", userService.findObjects(queryHelper)); } } catch (Exception e) { e.printStackTrace(); } return SUCCESS; } //保存投诉 public void complainAdd(){ try { if(comp != null){ //设置默写投诉状态为 待受理 comp.setState(Complain.COMPLAIN_STATE_UNDONE); comp.setCompTime(new Timestamp(new Date().getTime())); complainService.save(comp); //输出投诉结果 HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType("text/html"); ServletOutputStream outputStream = response.getOutputStream(); outputStream.write("success".getBytes("utf-8")); outputStream.close(); } } catch (Exception e) { e.printStackTrace(); } } //查看信息 public String infoViewUI(){ //加载分类集合 ActionContext.getContext().getContextMap().put("infoTypeMap", Info.INFO_TYPE_MAP); if(info != null){ info = infoService.findObjectById(info.getInfoId()); } return "infoViewUI"; } //查看投诉信息 public String complainViewUI(){ //加载状态集合 ActionContext.getContext().getContextMap().put("complainStateMap", Complain.COMPLAIN_STATE_MAP); if(comp != null){ comp = complainService.findObjectById(comp.getCompId()); } return "complainViewUI"; } public Map<String, Object> getReturn_map() { return return_map; } public void setReturn_map(Map<String, Object> return_map) { this.return_map = return_map; } public Complain getComp() { return comp; } public void setComp(Complain comp) { this.comp = comp; } public Info getInfo() { return info; } public void setInfo(Info info) { this.info = info; } }
28.451087
98
0.731614
2ead2c1564354f555fab1c3924120c820daf50f6
5,895
package org.broadinstitute.hellbender.tools.walkers.genotyper.afcalc; import org.broadinstitute.hellbender.utils.MathUtils; import org.broadinstitute.hellbender.utils.Utils; import org.broadinstitute.hellbender.GATKBaseTest; import org.testng.Assert; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; public final class AFPriorProviderUnitTest extends GATKBaseTest { private static final double TOLERANCE = 0.0001; @Test(dataProvider="HeterozygosityProviderData") public void testHeterozygosityProvider(final double h, final int useCount, final int minPloidy, final int maxPloidy) { final double het = h / maxPloidy; final Random rdn = Utils.getRandomGenerator(); final int[] plodies = new int[useCount]; for (int i = 0; i < useCount; i++) plodies[i] = rdn.nextInt(maxPloidy - minPloidy + 1) + minPloidy; final AFPriorProvider provider = new HeterozygosityAFPriorProvider(het); for (int i = 0; i < useCount; i++) { final int ploidy = plodies[i]; double[] priors = provider.forTotalPloidy(ploidy); Assert.assertNotNull(priors); Assert.assertEquals(priors.length, ploidy + 1); Assert.assertEquals(MathUtils.approximateLog10SumLog10(priors), 0, TOLERANCE); for (int j = 0; j < priors.length; j++) { Assert.assertTrue(!Double.isNaN(priors[j])); Assert.assertTrue(priors[j] < 0); if (j > 0) Assert.assertEquals(priors[j], Math.log10(het) - Math.log10(j), TOLERANCE); } } } @Test(expectedExceptions = IllegalArgumentException.class) public void testErrorNegativeHet() throws Exception { new HeterozygosityAFPriorProvider(-0.1); } @Test(expectedExceptions = IllegalArgumentException.class) public void testErrorTooHighHet() throws Exception { new HeterozygosityAFPriorProvider(1.1); } @Test(expectedExceptions = IllegalArgumentException.class) public void testErrorNaNHet() throws Exception { new HeterozygosityAFPriorProvider(Double.NaN); } @Test(expectedExceptions = IllegalArgumentException.class) public void testErrorHeterozygosityTooHighForPloidy() throws Exception { new HeterozygosityAFPriorProvider(0.999).buildPriors(2); } @Test(dataProvider="CustomProviderData") public void testCustomProvider(final int ploidy) { final double[] priors = new double[ploidy]; final Random rdn = Utils.getRandomGenerator(); double remaining = 1; final List<Double> priorsList = new ArrayList<>(); for (int i = 0; i < priors.length; i++) { priors[i] = remaining * rdn.nextDouble() * (.1 / ploidy ); remaining -= priors[i]; priorsList.add(priors[i]); } final AFPriorProvider provider = new CustomAFPriorProvider(priorsList); final double[] providedPriors = provider.forTotalPloidy(ploidy); Assert.assertNotNull(providedPriors); Assert.assertEquals(providedPriors.length, priors.length + 1); for (int i = 0; i < priors.length; i++) Assert.assertEquals(providedPriors[i + 1], Math.log10(priors[i]), TOLERANCE); Assert.assertEquals(MathUtils.approximateLog10SumLog10(providedPriors), 0, TOLERANCE); } private double[] hets = { 0.00001, 0.001, 0.1, 0.5, 0.99, 0.999 }; private int[] useCounts = { 10, 100, 1000 }; private int[] ploidy = { 1 , 2, 3, 10, 100, 200, 500}; @DataProvider(name="CustomProviderData") public Object[][] customProviderData() { final Object[][] result = new Object[ploidy.length][]; for (int i = 0; i < result.length; i++) result[i] = new Object[] { ploidy[i] }; return result; } @DataProvider(name="HeterozygosityProviderData") public Object[][] heterozygosityProviderData() { final Object[][] result = new Object[hets.length * useCounts.length * ((ploidy.length + 1) * (ploidy.length) / 2)][]; int idx = 0; for (double h : hets) for (int sc : useCounts) for (int i = 0; i < ploidy.length; i++) for (int j = i; j < ploidy.length; j++) result[idx++] = new Object[] { h, sc, ploidy[i], ploidy[j]}; return result; } @Test(expectedExceptions = IllegalArgumentException.class) public void testCustomErrorPloidy() throws Exception { new CustomAFPriorProvider(Arrays.asList(0.5)).forTotalPloidy(-1); } @Test(expectedExceptions = IllegalArgumentException.class) public void testCustomErrorNull() throws Exception { new CustomAFPriorProvider(null); } @Test(expectedExceptions = IllegalArgumentException.class) public void testCustomHetError() throws Exception { new CustomAFPriorProvider(Arrays.asList(-1.0)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testCustomNaNError() throws Exception { new CustomAFPriorProvider(Arrays.asList(Double.NaN)); } @Test(expectedExceptions = IllegalArgumentException.class) public void testCustomHetTooHighError() throws Exception { new CustomAFPriorProvider(Arrays.asList(0.5, 0.6)); } @Test public void testCustomPriors() throws Exception { final List<Double> PRIORS = Arrays.asList(0.5, 0.4); double[] priors = new CustomAFPriorProvider(PRIORS).buildPriors(17); for ( int i = 0; i < priors.length; i++ ) { final double value = i == 0 ? 1 - PRIORS.stream().mapToDouble(Double::doubleValue).sum() : PRIORS.get(i-1); Assert.assertEquals(priors[i], Math.log10(value), TOLERANCE); } } }
40.655172
125
0.657337
549b8838347d9db900ef77ea470fad92ab2eed18
3,994
/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/JSP_Servlet/Servlet.java to edit this template */ package servelets; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.Produto; import model.ProdutoDAO; /** * * @author Raphael */ @WebServlet(name = "ServletProduto", urlPatterns = {"/ServletProduto"}) public class ServletProduto extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String acao = request.getParameter("acao"); if (acao == null) { acao = "listar"; } //String paginaDestino = (acao.equals("incluir")) //? "ProdutoDados.html" : "ProdutoLista.jsp"; String paginaDestino; if (acao.equals("incluir")) { paginaDestino = "ProdutoDados.html"; } else if (acao.equals("alterar")) { paginaDestino = "AlteraProduto.jsp"; } else { paginaDestino = "ProdutoLista.jsp"; } ProdutoDAO dao = new ProdutoDAO(); int codigo; String nome; int quantidade; switch (acao) { case "incluirX": codigo = new Integer(request.getParameter("codigo")); nome = request.getParameter("nome"); quantidade = new Integer( request.getParameter("quantidade")); dao.incluir(new Produto(codigo, nome, quantidade)); break; case "excluirX": dao.excluir(new Integer(request.getParameter("codigo"))); break; case "alterarX": codigo = new Integer(request.getParameter("codigo")); nome = request.getParameter("nome"); quantidade = new Integer( request.getParameter("quantidade")); dao.alterar(new Produto(codigo, nome, quantidade)); break; } if (!acao.equals("incluir") || !acao.equals("alterar")) { request.setAttribute("listaProduto", dao.obterTodos()); } request.getRequestDispatcher(paginaDestino). forward(request, response); } // O restante do código foi omitido // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
35.981982
124
0.606159
f279ceabaa457a51fe9123d02191a38ce1259339
135
package be.kwakeroni.parameters.client.api.query; /** * (C) 2016 Maarten Van Puymbroeck */ public interface ClientWireFormatter { }
16.875
49
0.748148
54359330ced740ad56c745119d09d34e39d697a0
890
package lesson_1.classes; public class Team { private String name; public Participant[] getParticipants() { return participants; } private Participant[] participants; public Team(String name, Participant... participants) { this.name = name; this.participants = participants; } public void showAllParticipants() { System.out.println("Комманда: " + this.name); for (Participant participant : this.participants) { System.out.println("##########\n" + "Имя: " + participant.name + "\n" + "Информация: " + participant.info ); } } public void showPassedParticipants() { System.out.println("Комманда: " + this.name); for (Participant participant : this.participants) { if (participant.isPassed) { System.out.println("##########\n" + "Имя: " + participant.name + "\n" + "Информация: " + participant.info ); } } } }
22.820513
56
0.637079
9220713904e30b4aec6ccec9d1619b7654c22f2c
1,751
package io.jaylim.compiler.ast.pojos.expressions.assignments.operations; import com.fasterxml.jackson.annotation.JsonProperty; import io.jaylim.compiler.ast.pojos.AstNode; import io.jaylim.compiler.ast.pojos.Position; import io.jaylim.compiler.ast.pojos.Range; /** * @author Jisung Lim <iejisung@gmail.com> */ public class ModulaMultiplicativeExpression extends MultiplicativeExpression { private final MultiplicativeExpression multiplicativeExpression; private final UnaryExpression unaryExpression; public ModulaMultiplicativeExpression(Range range, AstNode parent, MultiplicativeExpression multiplicativeExpression, UnaryExpression unaryExpression) { super(range, parent); this.multiplicativeExpression = multiplicativeExpression; this.unaryExpression = unaryExpression; } public ModulaMultiplicativeExpression(Position start, Position end, AstNode parent, MultiplicativeExpression multiplicativeExpression, UnaryExpression unaryExpression) { super(start, end, parent); this.multiplicativeExpression = multiplicativeExpression; this.unaryExpression = unaryExpression; } public ModulaMultiplicativeExpression(int startLine, int startCol, int endLine, int endCol, AstNode parent, MultiplicativeExpression multiplicativeExpression, UnaryExpression unaryExpression) { super(startLine, startCol, endLine, endCol, parent); this.multiplicativeExpression = multiplicativeExpression; this.unaryExpression = unaryExpression; } @JsonProperty("MultiplicativeExpression") public MultiplicativeExpression getMultiplicativeExpression() { return multiplicativeExpression; } @JsonProperty("UnaryExpression") public UnaryExpression getUnaryExpression() { return unaryExpression; } }
38.911111
195
0.814392
710cd526ffecc3e68c5ebc60a41c4ecb95b6f9e6
4,530
/** * Copyright (C) 2015 The Gravitee team (http://gravitee.io) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.gravitee.rest.api.service.impl; import com.fasterxml.jackson.databind.ObjectMapper; import io.gravitee.rest.api.model.PageEntity; import io.gravitee.rest.api.model.PlanEntity; import io.gravitee.rest.api.model.api.ApiEntity; import io.gravitee.rest.api.model.documentation.PageQuery; import io.gravitee.rest.api.service.ApiExportService; import io.gravitee.rest.api.service.ApiService; import io.gravitee.rest.api.service.PageService; import io.gravitee.rest.api.service.PlanService; import io.gravitee.rest.api.service.common.UuidString; import io.gravitee.rest.api.service.converter.ApiConverter; import io.gravitee.rest.api.service.converter.PageConverter; import io.gravitee.rest.api.service.converter.PlanConverter; import io.gravitee.rest.api.service.jackson.ser.api.ApiSerializer; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** * @author GraviteeSource Team */ @Component public class ApiExportServiceImpl extends AbstractService implements ApiExportService { private static final Logger LOGGER = LoggerFactory.getLogger(ApiExportServiceImpl.class); private final ObjectMapper objectMapper; private final PageService pageService; private final PlanService planService; private final ApiService apiService; private final ApiConverter apiConverter; private final PlanConverter planConverter; private final PageConverter pageConverter; public ApiExportServiceImpl( ObjectMapper objectMapper, PageService pageService, PlanService planService, ApiService apiService, ApiConverter apiConverter, PlanConverter planConverter, PageConverter pageConverter ) { this.objectMapper = objectMapper; this.pageService = pageService; this.planService = planService; this.apiService = apiService; this.apiConverter = apiConverter; this.planConverter = planConverter; this.pageConverter = pageConverter; } @Override public String exportAsJson(final String apiId, String exportVersion, String... filteredFields) { ApiEntity apiEntity = apiService.findById(apiId); generateAndSaveCrossId(apiEntity); // set metadata for serialize process Map<String, Object> metadata = new HashMap<>(); metadata.put(ApiSerializer.METADATA_EXPORT_VERSION, exportVersion); metadata.put(ApiSerializer.METADATA_FILTERED_FIELDS_LIST, Arrays.asList(filteredFields)); apiEntity.setMetadata(metadata); try { return objectMapper.writeValueAsString(apiEntity); } catch (final Exception e) { LOGGER.error("An error occurs while trying to JSON serialize the API {}", apiEntity, e); } return ""; } private void generateAndSaveCrossId(ApiEntity api) { if (StringUtils.isEmpty(api.getCrossId())) { api.setCrossId(UuidString.generateRandom()); apiService.update(api.getId(), apiConverter.toUpdateApiEntity(api)); } planService.findByApi(api.getId()).forEach(this::generateAndSaveCrossId); pageService.findByApi(api.getId()).forEach(this::generateAndSaveCrossId); } private void generateAndSaveCrossId(PlanEntity plan) { if (StringUtils.isEmpty(plan.getCrossId())) { plan.setCrossId(UuidString.generateRandom()); planService.update(planConverter.toUpdatePlanEntity(plan)); } } private void generateAndSaveCrossId(PageEntity page) { if (StringUtils.isEmpty(page.getCrossId())) { page.setCrossId(UuidString.generateRandom()); pageService.update(page.getId(), pageConverter.toUpdatePageEntity(page)); } } }
39.391304
100
0.730243
2a18b7b25e71bf177afb7d5d7f7752adebbb67c0
1,788
/** * File:AdviceForAnnotation.java * Package:org.jinlibrary.aop.aspectj * Author:jin * Date:2017年3月29日 下午1:37:22 * Copyright (C) 2017-2017 房天下-版权所有 */ package org.jinlibrary.aop.aspectj; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; /** * <p> * Description: AdviceForAnnotation * </p> * * @author jinshilei * 2017年3月29日 * @version 1.0 * */ @Aspect public class AdviceForAnnotation { @Pointcut("execution(* org.jinlibrary.aop.aspectj.*.delete*(..))") public void pointCutForDelete() { } @Pointcut("execution(* org.jinlibrary.aop.aspectj.*.divide(..))") public void pointCutForDivide() { } // @Pointcut("execution(* org.jinlibrary.aop.aspectj.*.multiply(..))") // public void pointCutForMultiply() { // } @Pointcut("execution(* org.jinlibrary.aop.aspectj.*.update*(..))") public void pointCutForUpdate() { } @Before(value = "AdviceForAnnotation.pointCutForDelete()") public void before(JoinPoint joinPoint) { System.out.println("前置增强"); } @AfterReturning(value = "AdviceForAnnotation.pointCutForDivide()", returning = "returnValue") public void afterReturning(Object returnValue) { if (!StringUtils.isEmpty(returnValue)) { System.out.println("后置增强......方法返回值:" + returnValue); } } @AfterThrowing(value = "AdviceForAnnotation.pointCutForUpdate()", throwing = "exception") public void afterThrowing(Throwable exception) { System.out.println("发生异常:" + exception.getMessage()); } }
27.507692
95
0.717562
d61387e348b007dfd4e20e7dc2c0a5b745eaf35e
2,790
package cn.felord.wepay.ali.sdk.api.response; import cn.felord.wepay.ali.sdk.api.internal.mapping.ApiField; import cn.felord.wepay.ali.sdk.api.AlipayResponse; /** * ALIPAY API: zhima.merchant.order.rent.create response. * * @author auto create * @version $Id: $Id */ public class ZhimaMerchantOrderRentCreateResponse extends AlipayResponse { private static final long serialVersionUID = 6767715372181211422L; /** * 是否准入: Y-准入 N-不准入 */ @ApiField("admit_state") private String admitState; /** * 商户发起借用服务时,需要在借用结束后返回给商户的参数 */ @ApiField("invoke_state") private String invokeState; /** * 芝麻信用借还订单号 */ @ApiField("order_no") private String orderNo; /** * 外部订单号,需要唯一,由商户传入,芝麻内部会做幂等控制,格式为:yyyyMMddHHmmss+4位随机数 */ @ApiField("out_order_no") private String outOrderNo; /** * 借用者的userId */ @ApiField("user_id") private String userId; /** * <p>Setter for the field <code>admitState</code>.</p> * * @param admitState a {@link java.lang.String} object. */ public void setAdmitState(String admitState) { this.admitState = admitState; } /** * <p>Getter for the field <code>admitState</code>.</p> * * @return a {@link java.lang.String} object. */ public String getAdmitState( ) { return this.admitState; } /** * <p>Setter for the field <code>invokeState</code>.</p> * * @param invokeState a {@link java.lang.String} object. */ public void setInvokeState(String invokeState) { this.invokeState = invokeState; } /** * <p>Getter for the field <code>invokeState</code>.</p> * * @return a {@link java.lang.String} object. */ public String getInvokeState( ) { return this.invokeState; } /** * <p>Setter for the field <code>orderNo</code>.</p> * * @param orderNo a {@link java.lang.String} object. */ public void setOrderNo(String orderNo) { this.orderNo = orderNo; } /** * <p>Getter for the field <code>orderNo</code>.</p> * * @return a {@link java.lang.String} object. */ public String getOrderNo( ) { return this.orderNo; } /** * <p>Setter for the field <code>outOrderNo</code>.</p> * * @param outOrderNo a {@link java.lang.String} object. */ public void setOutOrderNo(String outOrderNo) { this.outOrderNo = outOrderNo; } /** * <p>Getter for the field <code>outOrderNo</code>.</p> * * @return a {@link java.lang.String} object. */ public String getOutOrderNo( ) { return this.outOrderNo; } /** * <p>Setter for the field <code>userId</code>.</p> * * @param userId a {@link java.lang.String} object. */ public void setUserId(String userId) { this.userId = userId; } /** * <p>Getter for the field <code>userId</code>.</p> * * @return a {@link java.lang.String} object. */ public String getUserId( ) { return this.userId; } }
20.666667
74
0.65914
e1d08897b77a6806e00ade3b86d5a638d7a8f836
1,759
package cn.com.lgf.common.debug; import cn.com.lgf.common.Config; public class DebugStatus { public enum EnvironmentStatus { RELEASE(1), PREVIEW(2), TEST(3), DEV(4); int environmentValue = 0; EnvironmentStatus(int value) { environmentValue = value; } public int getEnvironmentValue() { return environmentValue; } public static EnvironmentStatus getStatusByIntType(int type) { switch (type) { case 1: return RELEASE; case 2: return PREVIEW; case 3: return TEST; case 4: return DEV; } return RELEASE; } } // 默认是Release private static EnvironmentStatus sCurrentDebugStatus = Config.DEBUG_STATUS > 0 ? EnvironmentStatus.getStatusByIntType(Config.DEBUG_STATUS) : EnvironmentStatus.RELEASE; public static void changeEnvironmentStatus(EnvironmentStatus environmentStatus) { if (sCurrentDebugStatus != environmentStatus) { sCurrentDebugStatus = environmentStatus; } } public static boolean isRelease() { return sCurrentDebugStatus == EnvironmentStatus.RELEASE; } public static boolean isPreView() { return sCurrentDebugStatus == EnvironmentStatus.PREVIEW; } public static boolean isTest() { return sCurrentDebugStatus == EnvironmentStatus.TEST; } public static boolean isDev() { return sCurrentDebugStatus == EnvironmentStatus.DEV; } public static EnvironmentStatus getCurrentEnvironmentStatus() { return sCurrentDebugStatus; } }
26.651515
171
0.603184
33f5724ceb2e53462d74a05deaeedb43c19bedf8
172,333
/* *AVISO LEGAL © Copyright *Este programa esta protegido por la ley de derechos de autor. *La reproduccion o distribucion ilicita de este programa o de cualquiera de *sus partes esta penado por la ley con severas sanciones civiles y penales, *y seran objeto de todas las sanciones legales que correspondan. *Su contenido no puede copiarse para fines comerciales o de otras, *ni puede mostrarse, incluso en una version modificada, en otros sitios Web. Solo esta permitido colocar hipervinculos al sitio web. */ package com.bydan.erp.tesoreria.presentation.swing.jinternalframes; import com.bydan.erp.seguridad.presentation.swing.jinternalframes.*; import com.bydan.erp.tesoreria.presentation.web.jsf.sessionbean.*;//; import com.bydan.erp.tesoreria.presentation.swing.jinternalframes.*; import com.bydan.erp.tesoreria.presentation.swing.jinternalframes.auxiliar.*; import com.bydan.erp.seguridad.presentation.web.jsf.sessionbean.*; import com.bydan.erp.seguridad.business.entity.*; //import com.bydan.erp.tesoreria.presentation.report.source.*; import com.bydan.framework.erp.business.entity.Reporte; import com.bydan.erp.seguridad.business.entity.Modulo; import com.bydan.erp.seguridad.business.entity.Opcion; import com.bydan.erp.seguridad.business.entity.Usuario; import com.bydan.erp.seguridad.business.entity.ResumenUsuario; import com.bydan.erp.seguridad.business.entity.ParametroGeneralSg; import com.bydan.erp.seguridad.business.entity.ParametroGeneralUsuario; import com.bydan.erp.seguridad.util.SistemaParameterReturnGeneral; import com.bydan.erp.tesoreria.business.entity.*; import com.bydan.erp.tesoreria.util.ParametroTesoreriaDefectoConstantesFunciones; import com.bydan.erp.tesoreria.business.logic.*; import com.bydan.framework.erp.business.entity.DatoGeneral; import com.bydan.framework.erp.business.entity.OrderBy; import com.bydan.framework.erp.business.entity.Mensajes; import com.bydan.framework.erp.business.entity.Classe; import com.bydan.framework.erp.business.logic.*; import com.bydan.framework.erp.presentation.desktop.swing.DateConverter; import com.bydan.framework.erp.presentation.desktop.swing.DateConverterFromDate; import com.bydan.framework.erp.presentation.desktop.swing.FuncionesSwing; import com.bydan.framework.erp.presentation.desktop.swing.JInternalFrameBase; import com.bydan.framework.erp.presentation.desktop.swing.*; import com.bydan.framework.erp.util.*; import java.util.Date; import java.util.List; import java.util.ArrayList; import java.io.File; import java.util.HashMap; import java.util.Map; import java.io.PrintWriter; import java.sql.SQLException; import java.sql.*; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRRuntimeException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.engine.JasperReport; import net.sf.jasperreports.engine.util.JRLoader; import net.sf.jasperreports.engine.export.JRHtmlExporter; import net.sf.jasperreports.j2ee.servlets.BaseHttpServlet; import net.sf.jasperreports.engine.JRExporterParameter; import net.sf.jasperreports.engine.data.JRBeanArrayDataSource; import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import javax.swing.*; import java.awt.*; import javax.swing.border.EtchedBorder; import javax.swing.border.Border; import javax.swing.border.TitledBorder; import java.awt.event.*; import javax.swing.event.*; import javax.swing.GroupLayout.Alignment; import javax.swing.table.TableColumn; import com.toedter.calendar.JDateChooser; @SuppressWarnings("unused") public class ParametroTesoreriaDefectoJInternalFrame extends ParametroTesoreriaDefectoBeanSwingJInternalFrameAdditional { private static final long serialVersionUID = 1L; //protected Usuario usuarioActual=null; public JToolBar jTtoolBarParametroTesoreriaDefecto; protected JMenuBar jmenuBarParametroTesoreriaDefecto; protected JMenu jmenuParametroTesoreriaDefecto; protected JMenu jmenuDatosParametroTesoreriaDefecto; protected JMenu jmenuArchivoParametroTesoreriaDefecto; protected JMenu jmenuAccionesParametroTesoreriaDefecto; protected JPanel jContentPane = null; protected JPanel jPanelBusquedasParametrosParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); protected GridBagLayout gridaBagLayoutParametroTesoreriaDefecto; protected GridBagConstraints gridBagConstraintsParametroTesoreriaDefecto; //protected JInternalFrameBase jInternalFrameParent; public ParametroTesoreriaDefectoDetalleFormJInternalFrame jInternalFrameDetalleFormParametroTesoreriaDefecto; protected ReporteDinamicoJInternalFrame jInternalFrameReporteDinamicoParametroTesoreriaDefecto; protected ImportacionJInternalFrame jInternalFrameImportacionParametroTesoreriaDefecto; //VENTANAS PARA ACTUALIZAR Y BUSCAR FK protected EmpresaBeanSwingJInternalFrame empresaBeanSwingJInternalFrame; public String sFinalQueryGeneral_empresa=""; protected SucursalBeanSwingJInternalFrame sucursalBeanSwingJInternalFrame; public String sFinalQueryGeneral_sucursal=""; protected TipoCuentaBancoGlobalBeanSwingJInternalFrame tipocuentabancoglobalBeanSwingJInternalFrame; public String sFinalQueryGeneral_tipocuentabancoglobal=""; public ParametroTesoreriaDefectoSessionBean parametrotesoreriadefectoSessionBean; public EmpresaSessionBean empresaSessionBean; public SucursalSessionBean sucursalSessionBean; public TipoCuentaBancoGlobalSessionBean tipocuentabancoglobalSessionBean; //protected JDesktopPane jDesktopPane; public List<ParametroTesoreriaDefecto> parametrotesoreriadefectos; public List<ParametroTesoreriaDefecto> parametrotesoreriadefectosEliminados; public List<ParametroTesoreriaDefecto> parametrotesoreriadefectosAux; protected OrderByJInternalFrame jInternalFrameOrderByParametroTesoreriaDefecto; protected JButton jButtonAbrirOrderByParametroTesoreriaDefecto; //protected JPanel jPanelOrderByParametroTesoreriaDefecto; //public JScrollPane jScrollPanelOrderByParametroTesoreriaDefecto; //protected JButton jButtonCerrarOrderByParametroTesoreriaDefecto; public ArrayList<OrderBy> arrOrderBy= new ArrayList<OrderBy>(); public ParametroTesoreriaDefectoLogic parametrotesoreriadefectoLogic; public JScrollPane jScrollPanelDatosParametroTesoreriaDefecto; public JScrollPane jScrollPanelDatosEdicionParametroTesoreriaDefecto; public JScrollPane jScrollPanelDatosGeneralParametroTesoreriaDefecto; //public JScrollPane jScrollPanelDatosParametroTesoreriaDefectoOrderBy; //public JScrollPane jScrollPanelReporteDinamicoParametroTesoreriaDefecto; //public JScrollPane jScrollPanelImportacionParametroTesoreriaDefecto; protected JPanel jPanelAccionesParametroTesoreriaDefecto; protected JPanel jPanelPaginacionParametroTesoreriaDefecto; protected JPanel jPanelParametrosReportesParametroTesoreriaDefecto; protected JPanel jPanelParametrosReportesAccionesParametroTesoreriaDefecto; ; protected JPanel jPanelParametrosAuxiliar1ParametroTesoreriaDefecto; protected JPanel jPanelParametrosAuxiliar2ParametroTesoreriaDefecto; protected JPanel jPanelParametrosAuxiliar3ParametroTesoreriaDefecto; protected JPanel jPanelParametrosAuxiliar4ParametroTesoreriaDefecto; //protected JPanel jPanelParametrosAuxiliar5ParametroTesoreriaDefecto; //protected JPanel jPanelReporteDinamicoParametroTesoreriaDefecto; //protected JPanel jPanelImportacionParametroTesoreriaDefecto; public JTable jTableDatosParametroTesoreriaDefecto; //public JTable jTableDatosParametroTesoreriaDefectoOrderBy; //ELEMENTOS TABLAS PARAMETOS //ELEMENTOS TABLAS PARAMETOS_FIN protected JButton jButtonNuevoParametroTesoreriaDefecto; protected JButton jButtonDuplicarParametroTesoreriaDefecto; protected JButton jButtonCopiarParametroTesoreriaDefecto; protected JButton jButtonVerFormParametroTesoreriaDefecto; protected JButton jButtonNuevoRelacionesParametroTesoreriaDefecto; protected JButton jButtonModificarParametroTesoreriaDefecto; protected JButton jButtonGuardarCambiosTablaParametroTesoreriaDefecto; protected JButton jButtonCerrarParametroTesoreriaDefecto; protected JButton jButtonRecargarInformacionParametroTesoreriaDefecto; protected JButton jButtonProcesarInformacionParametroTesoreriaDefecto; protected JButton jButtonAnterioresParametroTesoreriaDefecto; protected JButton jButtonSiguientesParametroTesoreriaDefecto; protected JButton jButtonNuevoGuardarCambiosParametroTesoreriaDefecto; //protected JButton jButtonGenerarReporteDinamicoParametroTesoreriaDefecto; //protected JButton jButtonCerrarReporteDinamicoParametroTesoreriaDefecto; //protected JButton jButtonGenerarExcelReporteDinamicoParametroTesoreriaDefecto; //protected JButton jButtonAbrirImportacionParametroTesoreriaDefecto; //protected JButton jButtonGenerarImportacionParametroTesoreriaDefecto; //protected JButton jButtonCerrarImportacionParametroTesoreriaDefecto; //protected JFileChooser jFileChooserImportacionParametroTesoreriaDefecto; //protected File fileImportacionParametroTesoreriaDefecto; //TOOLBAR protected JButton jButtonNuevoToolBarParametroTesoreriaDefecto; protected JButton jButtonDuplicarToolBarParametroTesoreriaDefecto; protected JButton jButtonNuevoRelacionesToolBarParametroTesoreriaDefecto; public JButton jButtonGuardarCambiosToolBarParametroTesoreriaDefecto; protected JButton jButtonCopiarToolBarParametroTesoreriaDefecto; protected JButton jButtonVerFormToolBarParametroTesoreriaDefecto; public JButton jButtonGuardarCambiosTablaToolBarParametroTesoreriaDefecto; protected JButton jButtonMostrarOcultarTablaToolBarParametroTesoreriaDefecto; protected JButton jButtonCerrarToolBarParametroTesoreriaDefecto; protected JButton jButtonRecargarInformacionToolBarParametroTesoreriaDefecto; protected JButton jButtonProcesarInformacionToolBarParametroTesoreriaDefecto; protected JButton jButtonAnterioresToolBarParametroTesoreriaDefecto; protected JButton jButtonSiguientesToolBarParametroTesoreriaDefecto; protected JButton jButtonNuevoGuardarCambiosToolBarParametroTesoreriaDefecto; protected JButton jButtonAbrirOrderByToolBarParametroTesoreriaDefecto; //TOOLBAR //MENU protected JMenuItem jMenuItemNuevoParametroTesoreriaDefecto; protected JMenuItem jMenuItemDuplicarParametroTesoreriaDefecto; protected JMenuItem jMenuItemNuevoRelacionesParametroTesoreriaDefecto; protected JMenuItem jMenuItemGuardarCambiosParametroTesoreriaDefecto; protected JMenuItem jMenuItemCopiarParametroTesoreriaDefecto; protected JMenuItem jMenuItemVerFormParametroTesoreriaDefecto; protected JMenuItem jMenuItemGuardarCambiosTablaParametroTesoreriaDefecto; protected JMenuItem jMenuItemCerrarParametroTesoreriaDefecto; protected JMenuItem jMenuItemDetalleCerrarParametroTesoreriaDefecto; protected JMenuItem jMenuItemDetalleAbrirOrderByParametroTesoreriaDefecto; protected JMenuItem jMenuItemDetalleMostarOcultarParametroTesoreriaDefecto; protected JMenuItem jMenuItemRecargarInformacionParametroTesoreriaDefecto; protected JMenuItem jMenuItemProcesarInformacionParametroTesoreriaDefecto; protected JMenuItem jMenuItemAnterioresParametroTesoreriaDefecto; protected JMenuItem jMenuItemSiguientesParametroTesoreriaDefecto; protected JMenuItem jMenuItemNuevoGuardarCambiosParametroTesoreriaDefecto; protected JMenuItem jMenuItemAbrirOrderByParametroTesoreriaDefecto; protected JMenuItem jMenuItemMostrarOcultarParametroTesoreriaDefecto; //MENU protected JLabel jLabelAccionesParametroTesoreriaDefecto; protected JCheckBox jCheckBoxSeleccionarTodosParametroTesoreriaDefecto; protected JCheckBox jCheckBoxSeleccionadosParametroTesoreriaDefecto; protected JCheckBox jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto; protected JCheckBox jCheckBoxConGraficoReporteParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposArchivosReportesParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposReportesParametroTesoreriaDefecto; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposGraficosReportesParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposPaginacionParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposRelacionesParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposAccionesParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") protected JComboBox jComboBoxTiposSeleccionarParametroTesoreriaDefecto; protected JTextField jTextFieldValorCampoGeneralParametroTesoreriaDefecto; //REPORTE DINAMICO //@SuppressWarnings("rawtypes") //public JLabel jLabelColumnasSelectReporteParametroTesoreriaDefecto; //public JList<Reporte> jListColumnasSelectReporteParametroTesoreriaDefecto; //public JScrollPane jScrollColumnasSelectReporteParametroTesoreriaDefecto; //public JLabel jLabelRelacionesSelectReporteParametroTesoreriaDefecto; //public JList<Reporte> jListRelacionesSelectReporteParametroTesoreriaDefecto; //public JScrollPane jScrollRelacionesSelectReporteParametroTesoreriaDefecto; //public JLabel jLabelConGraficoDinamicoParametroTesoreriaDefecto; //protected JCheckBox jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto; //public JLabel jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto; //public JLabel jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto; //public JLabel jLabelArchivoImportacionParametroTesoreriaDefecto; //public JLabel jLabelPathArchivoImportacionParametroTesoreriaDefecto; //protected JTextField jTextFieldPathArchivoImportacionParametroTesoreriaDefecto; //public JLabel jLabelColumnaCategoriaGraficoParametroTesoreriaDefecto; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxColumnaCategoriaGraficoParametroTesoreriaDefecto; //public JLabel jLabelColumnaCategoriaValorParametroTesoreriaDefecto; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxColumnaCategoriaValorParametroTesoreriaDefecto; //public JLabel jLabelColumnasValoresGraficoParametroTesoreriaDefecto; //public JList<Reporte> jListColumnasValoresGraficoParametroTesoreriaDefecto; //public JScrollPane jScrollColumnasValoresGraficoParametroTesoreriaDefecto; //public JLabel jLabelTiposGraficosReportesDinamicoParametroTesoreriaDefecto; //@SuppressWarnings("rawtypes") //protected JComboBox jComboBoxTiposGraficosReportesDinamicoParametroTesoreriaDefecto; protected Boolean conMaximoRelaciones=true; protected Boolean conFuncionalidadRelaciones=true; public Boolean conCargarMinimo=false; public Boolean cargarRelaciones=false; public Boolean conMostrarAccionesCampo=false; public Boolean permiteRecargarForm=false;//PARA NUEVO PREPARAR Y MANEJO DE EVENTOS, EVITAR QUE SE EJECUTE AL CARGAR VENTANA O LOAD public Boolean conCargarFormDetalle=false; //BYDAN_BUSQUEDAS public JTabbedPane jTabbedPaneBusquedasParametroTesoreriaDefecto; public JPanel jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto; public JButton jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto; public JPanel jPanelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto; public JLabel jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto; @SuppressWarnings("rawtypes") public JComboBox jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto; public JButton jButtonid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto= new JButtonMe(); public JButton jButtonid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefectoUpdate= new JButtonMe(); public JButton jButtonid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefectoBusqueda= new JButtonMe(); //ELEMENTOS TABLAS PARAMETOS //ELEMENTOS TABLAS PARAMETOS_FIN public static int openFrameCount = 0; public static final int xOffset = 10, yOffset = 35; //LOS DATOS DE NUEVO Y EDICION ACTUAL APARECEN EN OTRA VENTANA(true) O NO(false) public static Boolean CON_DATOS_FRAME=true; public static Boolean ISBINDING_MANUAL=true; public static Boolean ISLOAD_FKLOTE=true; public static Boolean ISBINDING_MANUAL_TABLA=true; public static Boolean CON_CARGAR_MEMORIA_INICIAL=true; //Al final no se utilizan, se inicializan desde JInternalFrameBase, desde ParametroGeneralUsuario public static String STIPO_TAMANIO_GENERAL="NORMAL"; public static String STIPO_TAMANIO_GENERAL_TABLA="NORMAL"; public static Boolean CONTIPO_TAMANIO_MANUAL=false; public static Boolean CON_LLAMADA_SIMPLE=true; public static Boolean CON_LLAMADA_SIMPLE_TOTAL=true; public static Boolean ESTA_CARGADO_PORPARTE=false; public int iWidthScroll=0;//(screenSize.width-screenSize.width/2)+(250*0); public int iHeightScroll=0;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //public int iWidthFormulario=450;//(screenSize.width-screenSize.width/2)+(250*0); //public int iHeightFormulario=198;//(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //Esto va en DetalleForm //public int iHeightFormularioMaximo=0; //public int iWidthFormularioMaximo=0; public int iWidthTableDefinicion=0; public double dStart = 0; public double dEnd = 0; public double dDif = 0; /* double start=(double)System.currentTimeMillis(); double end=0; double dif=0; end=(double)System.currentTimeMillis(); dif=end - start; start=(double)System.currentTimeMillis(); System.out.println("Tiempo(ms) Carga TEST 1_2 DetalleMovimientoInventario: " + dif); */ public SistemaParameterReturnGeneral sistemaReturnGeneral; public List<Opcion> opcionsRelacionadas=new ArrayList<Opcion>(); //ES AUXILIAR PARA WINDOWS FORMS public ParametroTesoreriaDefectoJInternalFrame() throws Exception { super(PaginaTipo.PRINCIPAL); //super("ParametroTesoreriaDefecto No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { //Boolean cargarRelaciones=false; initialize(null,false,false,false/*cargarRelaciones*/,null,null,null,null,null,null,PaginaTipo.PRINCIPAL); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public ParametroTesoreriaDefectoJInternalFrame(Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception { super(paginaTipo); //super("ParametroTesoreriaDefecto No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { initialize(null,false,false,cargarRelaciones,null,null,null,null,null,null,paginaTipo); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public ParametroTesoreriaDefectoJInternalFrame(Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,PaginaTipo paginaTipo) throws Exception { super(paginaTipo); //super("ParametroTesoreriaDefecto No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { initialize(null,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,null,null,null,null,null,null,paginaTipo); } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public ParametroTesoreriaDefectoJInternalFrame(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { super(paginaTipo);//,jdesktopPane this.jDesktopPane=jdesktopPane; this.dStart=(double)System.currentTimeMillis(); //super("ParametroTesoreriaDefecto No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable try { long start_time=0; long end_time=0; if(Constantes2.ISDEVELOPING2) { start_time = System.currentTimeMillis(); } initialize(jdesktopPane,conGuardarRelaciones,esGuardarRelacionado,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo); if(Constantes2.ISDEVELOPING2) { end_time = System.currentTimeMillis(); String sTipo="Clase Padre Ventana"; Funciones2.getMensajeTiempoEjecucion(start_time, end_time, sTipo,false); } } catch(Exception e) { FuncionesSwing.manageException(this, e, null); } } public JInternalFrameBase getJInternalFrameParent() { return jInternalFrameParent; } public void setJInternalFrameParent(JInternalFrameBase internalFrameParent) { jInternalFrameParent = internalFrameParent; } public void setjButtonRecargarInformacion(JButton jButtonRecargarInformacionParametroTesoreriaDefecto) { this.jButtonRecargarInformacionParametroTesoreriaDefecto = jButtonRecargarInformacionParametroTesoreriaDefecto; } public JButton getjButtonProcesarInformacionParametroTesoreriaDefecto() { return this.jButtonProcesarInformacionParametroTesoreriaDefecto; } public void setjButtonProcesarInformacion(JButton jButtonProcesarInformacionParametroTesoreriaDefecto) { this.jButtonProcesarInformacionParametroTesoreriaDefecto = jButtonProcesarInformacionParametroTesoreriaDefecto; } public JButton getjButtonRecargarInformacionParametroTesoreriaDefecto() { return this.jButtonRecargarInformacionParametroTesoreriaDefecto; } public List<ParametroTesoreriaDefecto> getparametrotesoreriadefectos() { return this.parametrotesoreriadefectos; } public void setparametrotesoreriadefectos(List<ParametroTesoreriaDefecto> parametrotesoreriadefectos) { this.parametrotesoreriadefectos = parametrotesoreriadefectos; } public List<ParametroTesoreriaDefecto> getparametrotesoreriadefectosAux() { return this.parametrotesoreriadefectosAux; } public void setparametrotesoreriadefectosAux(List<ParametroTesoreriaDefecto> parametrotesoreriadefectosAux) { this.parametrotesoreriadefectosAux = parametrotesoreriadefectosAux; } public List<ParametroTesoreriaDefecto> getparametrotesoreriadefectosEliminados() { return this.parametrotesoreriadefectosEliminados; } public void setParametroTesoreriaDefectosEliminados(List<ParametroTesoreriaDefecto> parametrotesoreriadefectosEliminados) { this.parametrotesoreriadefectosEliminados = parametrotesoreriadefectosEliminados; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposSeleccionarParametroTesoreriaDefecto() { return jComboBoxTiposSeleccionarParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposSeleccionarParametroTesoreriaDefecto( JComboBox jComboBoxTiposSeleccionarParametroTesoreriaDefecto) { this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto = jComboBoxTiposSeleccionarParametroTesoreriaDefecto; } public void setBorderResaltarTiposSeleccionarParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto .setBorder(borderResaltar); } public JTextField getjTextFieldValorCampoGeneralParametroTesoreriaDefecto() { return jTextFieldValorCampoGeneralParametroTesoreriaDefecto; } public void setjTextFieldValorCampoGeneralParametroTesoreriaDefecto( JTextField jTextFieldValorCampoGeneralParametroTesoreriaDefecto) { this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto = jTextFieldValorCampoGeneralParametroTesoreriaDefecto; } public void setBorderResaltarValorCampoGeneralParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto .setBorder(borderResaltar); } public JCheckBox getjCheckBoxSeleccionarTodosParametroTesoreriaDefecto() { return this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto; } public void setjCheckBoxSeleccionarTodosParametroTesoreriaDefecto( JCheckBox jCheckBoxSeleccionarTodosParametroTesoreriaDefecto) { this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto = jCheckBoxSeleccionarTodosParametroTesoreriaDefecto; } public void setBorderResaltarSeleccionarTodosParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto .setBorder(borderResaltar); } public JCheckBox getjCheckBoxSeleccionadosParametroTesoreriaDefecto() { return this.jCheckBoxSeleccionadosParametroTesoreriaDefecto; } public void setjCheckBoxSeleccionadosParametroTesoreriaDefecto( JCheckBox jCheckBoxSeleccionadosParametroTesoreriaDefecto) { this.jCheckBoxSeleccionadosParametroTesoreriaDefecto = jCheckBoxSeleccionadosParametroTesoreriaDefecto; } public void setBorderResaltarSeleccionadosParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jCheckBoxSeleccionadosParametroTesoreriaDefecto .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposArchivosReportesParametroTesoreriaDefecto() { return this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposArchivosReportesParametroTesoreriaDefecto( JComboBox jComboBoxTiposArchivosReportesParametroTesoreriaDefecto) { this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto = jComboBoxTiposArchivosReportesParametroTesoreriaDefecto; } public void setBorderResaltarTiposArchivosReportesParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposReportesParametroTesoreriaDefecto() { return this.jComboBoxTiposReportesParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposReportesParametroTesoreriaDefecto( JComboBox jComboBoxTiposReportesParametroTesoreriaDefecto) { this.jComboBoxTiposReportesParametroTesoreriaDefecto = jComboBoxTiposReportesParametroTesoreriaDefecto; } //@SuppressWarnings("rawtypes") //public JComboBox getjComboBoxTiposReportesDinamicoParametroTesoreriaDefecto() { // return jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto; //} //@SuppressWarnings("rawtypes") //public void setjComboBoxTiposReportesDinamicoParametroTesoreriaDefecto( // JComboBox jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto) { // this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto = jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto; //} //@SuppressWarnings("rawtypes") //public JComboBox getjComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto() { // return jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto; //} //@SuppressWarnings("rawtypes") //public void setjComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto( // JComboBox jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto) { // this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto = jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto; //} public void setBorderResaltarTiposReportesParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposReportesParametroTesoreriaDefecto .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposGraficosReportesParametroTesoreriaDefecto() { return this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposGraficosReportesParametroTesoreriaDefecto( JComboBox jComboBoxTiposGraficosReportesParametroTesoreriaDefecto) { this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto = jComboBoxTiposGraficosReportesParametroTesoreriaDefecto; } public void setBorderResaltarTiposGraficosReportesParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposPaginacionParametroTesoreriaDefecto() { return this.jComboBoxTiposPaginacionParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposPaginacionParametroTesoreriaDefecto( JComboBox jComboBoxTiposPaginacionParametroTesoreriaDefecto) { this.jComboBoxTiposPaginacionParametroTesoreriaDefecto = jComboBoxTiposPaginacionParametroTesoreriaDefecto; } public void setBorderResaltarTiposPaginacionParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposPaginacionParametroTesoreriaDefecto .setBorder(borderResaltar); } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposRelacionesParametroTesoreriaDefecto() { return this.jComboBoxTiposRelacionesParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public JComboBox getjComboBoxTiposAccionesParametroTesoreriaDefecto() { return this.jComboBoxTiposAccionesParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposRelacionesParametroTesoreriaDefecto( JComboBox jComboBoxTiposRelacionesParametroTesoreriaDefecto) { this.jComboBoxTiposRelacionesParametroTesoreriaDefecto = jComboBoxTiposRelacionesParametroTesoreriaDefecto; } @SuppressWarnings("rawtypes") public void setjComboBoxTiposAccionesParametroTesoreriaDefecto( JComboBox jComboBoxTiposAccionesParametroTesoreriaDefecto) { this.jComboBoxTiposAccionesParametroTesoreriaDefecto = jComboBoxTiposAccionesParametroTesoreriaDefecto; } public void setBorderResaltarTiposRelacionesParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposRelacionesParametroTesoreriaDefecto .setBorder(borderResaltar); } public void setBorderResaltarTiposAccionesParametroTesoreriaDefecto() { Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); this.jComboBoxTiposAccionesParametroTesoreriaDefecto .setBorder(borderResaltar); } //public JCheckBox getjCheckBoxConGraficoDinamicoParametroTesoreriaDefecto() { // return jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto; //} //public void setjCheckBoxConGraficoDinamicoParametroTesoreriaDefecto( // JCheckBox jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto) { // this.jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto = jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto; //} //public void setBorderResaltarConGraficoDinamicoParametroTesoreriaDefecto() { // Border borderResaltar=Funciones2.getBorderResaltar(this.getParametroGeneralUsuario(),"PARAMETRO"); // this.jTtoolBarParametroTesoreriaDefecto.setBorder(borderResaltar); // this.jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto .setBorder(borderResaltar); //} /* public JDesktopPane getJDesktopPane() { return jDesktopPane; } public void setJDesktopPane(JDesktopPane desktopPane) { jDesktopPane = desktopPane; } */ private void initialize(JDesktopPane jdesktopPane,Boolean conGuardarRelaciones,Boolean esGuardarRelacionado,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { this.parametrotesoreriadefectoSessionBean=new ParametroTesoreriaDefectoSessionBean(); this.parametrotesoreriadefectoSessionBean.setConGuardarRelaciones(conGuardarRelaciones); this.parametrotesoreriadefectoSessionBean.setEsGuardarRelacionado(esGuardarRelacionado); this.conCargarMinimo=this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado(); this.cargarRelaciones=cargarRelaciones; if(!this.conCargarMinimo) { } //this.sTipoTamanioGeneral=ParametroTesoreriaDefectoJInternalFrame.STIPO_TAMANIO_GENERAL; //this.sTipoTamanioGeneralTabla=ParametroTesoreriaDefectoJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA; this.sTipoTamanioGeneral=FuncionesSwing.getTipoTamanioGeneral(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.sTipoTamanioGeneralTabla=FuncionesSwing.getTipoTamanioGeneralTabla(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.conTipoTamanioManual=FuncionesSwing.getConTipoTamanioManual(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); this.conTipoTamanioTodo=FuncionesSwing.getConTipoTamanioTodo(this,parametroGeneralUsuario,conGuardarRelaciones,esGuardarRelacionado); ParametroTesoreriaDefectoJInternalFrame.STIPO_TAMANIO_GENERAL=this.sTipoTamanioGeneral; ParametroTesoreriaDefectoJInternalFrame.STIPO_TAMANIO_GENERAL_TABLA=this.sTipoTamanioGeneralTabla; ParametroTesoreriaDefectoJInternalFrame.CONTIPO_TAMANIO_MANUAL=this.conTipoTamanioManual; Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int iWidth=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO); int iHeight=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO); //this.setTitle(Funciones.GetTituloSistema(this.parametroGeneralSg,this.moduloActual,this.opcionActual,this.usuarioActual,"Parametro Tesoreria Defecto MANTENIMIENTO")); if(iWidth > 650) { iWidth=650; } if(iHeight > 660) { iHeight=660; } this.setSize(iWidth,iHeight); this.setFrameIcon(new ImageIcon(FuncionesSwing.getImagenBackground(Constantes2.S_ICON_IMAGE))); this.setContentPane(this.getJContentPane(iWidth,iHeight,jdesktopPane,cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo)); if(!this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()) { this.setResizable(true); this.setClosable(true); this.setMaximizable(true); this.iconable=true; setLocation(xOffset*openFrameCount, yOffset*openFrameCount); if(Constantes.CON_VARIAS_VENTANAS) { openFrameCount++; if(openFrameCount==Constantes.INUM_MAX_VENTANAS) { openFrameCount=0; } } } ParametroTesoreriaDefectoJInternalFrame.ESTA_CARGADO_PORPARTE=true; //super("ParametroTesoreriaDefecto No " + (++openFrameCount),true, /*resizable*/true, /*closable*/true, /*maximizable*/true);//iconifiable //SwingUtilities.updateComponentTreeUI(this); } public void inicializarToolBar() { this.jTtoolBarParametroTesoreriaDefecto= new JToolBar("MENU PRINCIPAL"); //TOOLBAR //PRINCIPAL this.jButtonNuevoToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "nuevo","nuevo","Nuevo"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO"),"Nuevo",false); this.jButtonNuevoGuardarCambiosToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoGuardarCambiosToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "nuevoguardarcambios","nuevoguardarcambios","Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA"),"Nuevo",false); this.jButtonGuardarCambiosTablaToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonGuardarCambiosTablaToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "guardarcambiostabla","guardarcambiostabla","Guardar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS"),"Guardar",false); this.jButtonDuplicarToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonDuplicarToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "duplicar","duplicar","Duplicar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR"),"Duplicar",false); this.jButtonCopiarToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCopiarToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "copiar","copiar","Copiar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("COPIAR"),"Copiar",false); this.jButtonVerFormToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonVerFormToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "ver_form","ver_form","Ver"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("VER_FORM"),"Ver",false); this.jButtonRecargarInformacionToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "recargar","recargar","Recargar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR"),"Recargar",false); this.jButtonAnterioresToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "anteriores","anteriores","Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES"),"<<",false); this.jButtonSiguientesToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonRecargarInformacionToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "siguientes","siguientes","Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES"),">>",false); this.jButtonAbrirOrderByToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonAbrirOrderByToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "orden","orden","Orden" + FuncionesSwing.getKeyMensaje("ORDEN"),"Orden",false); this.jButtonNuevoRelacionesToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonNuevoRelacionesToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "nuevo_relaciones","nuevo_relaciones","NUEVO RELACIONES" + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES"),"NUEVO RELACIONES",false); this.jButtonMostrarOcultarTablaToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonMostrarOcultarTablaToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "mostrar_ocultar","mostrar_ocultar","Mostrar Ocultar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR"),"Mostrar Ocultar",false); this.jButtonCerrarToolBarParametroTesoreriaDefecto=FuncionesSwing.getButtonToolBarGeneral(this.jButtonCerrarToolBarParametroTesoreriaDefecto,this.jTtoolBarParametroTesoreriaDefecto, "cerrar","cerrar","Salir"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR"),"Salir",false); //this.jButtonNuevoRelacionesToolBarParametroTesoreriaDefecto=new JButtonMe(); //protected JButton jButtonNuevoRelacionesToolBarParametroTesoreriaDefecto; this.jButtonProcesarInformacionToolBarParametroTesoreriaDefecto=new JButtonMe(); //protected JButton jButtonProcesarInformacionToolBarParametroTesoreriaDefecto; //protected JButton jButtonModificarToolBarParametroTesoreriaDefecto; //PRINCIPAL //DETALLE //DETALLE_FIN } public void cargarMenus() { this.jmenuBarParametroTesoreriaDefecto=new JMenuBarMe(); //PRINCIPAL this.jmenuParametroTesoreriaDefecto=new JMenuMe("General"); this.jmenuArchivoParametroTesoreriaDefecto=new JMenuMe("Archivo"); this.jmenuAccionesParametroTesoreriaDefecto=new JMenuMe("Acciones"); this.jmenuDatosParametroTesoreriaDefecto=new JMenuMe("Datos"); //PRINCIPAL_FIN //DETALLE //DETALLE_FIN this.jMenuItemNuevoParametroTesoreriaDefecto= new JMenuItem("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO")); this.jMenuItemNuevoParametroTesoreriaDefecto.setActionCommand("Nuevo"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoParametroTesoreriaDefecto,"nuevo_button","Nuevo"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDuplicarParametroTesoreriaDefecto= new JMenuItem("Duplicar" + FuncionesSwing.getKeyMensaje("DUPLICAR")); this.jMenuItemDuplicarParametroTesoreriaDefecto.setActionCommand("Duplicar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDuplicarParametroTesoreriaDefecto,"duplicar_button","Duplicar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDuplicarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemNuevoRelacionesParametroTesoreriaDefecto= new JMenuItem("Nuevo Rel" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); this.jMenuItemNuevoRelacionesParametroTesoreriaDefecto.setActionCommand("Nuevo Rel"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoRelacionesParametroTesoreriaDefecto,"nuevorelaciones_button","Nuevo Rel"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoRelacionesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemGuardarCambiosParametroTesoreriaDefecto= new JMenuItem("Guardar" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jMenuItemGuardarCambiosParametroTesoreriaDefecto.setActionCommand("Guardar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosParametroTesoreriaDefecto,"guardarcambios_button","Guardar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemCopiarParametroTesoreriaDefecto= new JMenuItem("Copiar" + FuncionesSwing.getKeyMensaje("COPIAR")); this.jMenuItemCopiarParametroTesoreriaDefecto.setActionCommand("Copiar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCopiarParametroTesoreriaDefecto,"copiar_button","Copiar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemCopiarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemVerFormParametroTesoreriaDefecto= new JMenuItem("Ver" + FuncionesSwing.getKeyMensaje("VER_FORM")); this.jMenuItemVerFormParametroTesoreriaDefecto.setActionCommand("Ver"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemVerFormParametroTesoreriaDefecto,"ver_form_button","Ver"); FuncionesSwing.setBoldMenuItem(this.jMenuItemVerFormParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemGuardarCambiosTablaParametroTesoreriaDefecto= new JMenuItem("Guardar Tabla" + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jMenuItemGuardarCambiosTablaParametroTesoreriaDefecto.setActionCommand("Guardar Tabla"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemGuardarCambiosTablaParametroTesoreriaDefecto,"guardarcambiostabla_button","Guardar Tabla"); FuncionesSwing.setBoldMenuItem(this.jMenuItemGuardarCambiosTablaParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemCerrarParametroTesoreriaDefecto= new JMenuItem("Salir" + FuncionesSwing.getKeyMensaje("CERRAR")); this.jMenuItemCerrarParametroTesoreriaDefecto.setActionCommand("Cerrar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemCerrarParametroTesoreriaDefecto,"cerrar_button","Salir"); FuncionesSwing.setBoldMenuItem(this.jMenuItemCerrarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemRecargarInformacionParametroTesoreriaDefecto= new JMenuItem("Recargar" + FuncionesSwing.getKeyMensaje("RECARGAR")); this.jMenuItemRecargarInformacionParametroTesoreriaDefecto.setActionCommand("Recargar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemRecargarInformacionParametroTesoreriaDefecto,"recargar_button","Recargar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemRecargarInformacionParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemProcesarInformacionParametroTesoreriaDefecto= new JMenuItem("Procesar Informacion"); this.jMenuItemProcesarInformacionParametroTesoreriaDefecto.setActionCommand("Procesar Informacion"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemProcesarInformacionParametroTesoreriaDefecto,"procesar_button","Procesar Informacion"); this.jMenuItemAnterioresParametroTesoreriaDefecto= new JMenuItem("Anteriores" + FuncionesSwing.getKeyMensaje("ANTERIORES")); this.jMenuItemAnterioresParametroTesoreriaDefecto.setActionCommand("Anteriores"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAnterioresParametroTesoreriaDefecto,"anteriores_button","Anteriores"); FuncionesSwing.setBoldMenuItem(this.jMenuItemAnterioresParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemSiguientesParametroTesoreriaDefecto= new JMenuItem("Siguientes" + FuncionesSwing.getKeyMensaje("SIGUIENTES")); this.jMenuItemSiguientesParametroTesoreriaDefecto.setActionCommand("Siguientes"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemSiguientesParametroTesoreriaDefecto,"siguientes_button","Siguientes"); FuncionesSwing.setBoldMenuItem(this.jMenuItemSiguientesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemAbrirOrderByParametroTesoreriaDefecto= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN")); this.jMenuItemAbrirOrderByParametroTesoreriaDefecto.setActionCommand("Orden"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemAbrirOrderByParametroTesoreriaDefecto,"orden_button","Orden"); FuncionesSwing.setBoldMenuItem(this.jMenuItemAbrirOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemMostrarOcultarParametroTesoreriaDefecto= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR")); this.jMenuItemMostrarOcultarParametroTesoreriaDefecto.setActionCommand("Mostrar Ocultar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemMostrarOcultarParametroTesoreriaDefecto,"mostrar_ocultar_button","Mostrar Ocultar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemMostrarOcultarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDetalleAbrirOrderByParametroTesoreriaDefecto= new JMenuItem("Orden" + FuncionesSwing.getKeyMensaje("ORDEN")); this.jMenuItemDetalleAbrirOrderByParametroTesoreriaDefecto.setActionCommand("Orden"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleAbrirOrderByParametroTesoreriaDefecto,"orden_button","Orden"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleAbrirOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemDetalleMostarOcultarParametroTesoreriaDefecto= new JMenuItem("Mostrar Ocultar" + FuncionesSwing.getKeyMensaje("MOSTRAR_OCULTAR")); this.jMenuItemDetalleMostarOcultarParametroTesoreriaDefecto.setActionCommand("Mostrar Ocultar"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemDetalleMostarOcultarParametroTesoreriaDefecto,"mostrar_ocultar_button","Mostrar Ocultar"); FuncionesSwing.setBoldMenuItem(this.jMenuItemDetalleMostarOcultarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jMenuItemNuevoGuardarCambiosParametroTesoreriaDefecto= new JMenuItem("Nuevo Tabla" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); this.jMenuItemNuevoGuardarCambiosParametroTesoreriaDefecto.setActionCommand("Nuevo Tabla"); FuncionesSwing.addImagenMenuItemGeneral(this.jMenuItemNuevoGuardarCambiosParametroTesoreriaDefecto,"nuevoguardarcambios_button","Nuevo"); FuncionesSwing.setBoldMenuItem(this.jMenuItemNuevoGuardarCambiosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); //PRINCIPAL if(!this.conCargarMinimo) { this.jmenuArchivoParametroTesoreriaDefecto.add(this.jMenuItemCerrarParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemNuevoParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemNuevoGuardarCambiosParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemNuevoRelacionesParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemGuardarCambiosTablaParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemDuplicarParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemCopiarParametroTesoreriaDefecto); this.jmenuAccionesParametroTesoreriaDefecto.add(this.jMenuItemVerFormParametroTesoreriaDefecto); this.jmenuDatosParametroTesoreriaDefecto.add(this.jMenuItemRecargarInformacionParametroTesoreriaDefecto); this.jmenuDatosParametroTesoreriaDefecto.add(this.jMenuItemAnterioresParametroTesoreriaDefecto); this.jmenuDatosParametroTesoreriaDefecto.add(this.jMenuItemSiguientesParametroTesoreriaDefecto); this.jmenuDatosParametroTesoreriaDefecto.add(this.jMenuItemAbrirOrderByParametroTesoreriaDefecto); this.jmenuDatosParametroTesoreriaDefecto.add(this.jMenuItemMostrarOcultarParametroTesoreriaDefecto); } //PRINCIPAL_FIN //DETALLE //this.jmenuDetalleAccionesParametroTesoreriaDefecto.add(this.jMenuItemGuardarCambiosParametroTesoreriaDefecto); //DETALLE_FIN //RELACIONES //RELACIONES //PRINCIPAL if(!this.conCargarMinimo) { FuncionesSwing.setBoldMenu(this.jmenuArchivoParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldMenu(this.jmenuAccionesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldMenu(this.jmenuDatosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jmenuBarParametroTesoreriaDefecto.add(this.jmenuArchivoParametroTesoreriaDefecto); this.jmenuBarParametroTesoreriaDefecto.add(this.jmenuAccionesParametroTesoreriaDefecto); this.jmenuBarParametroTesoreriaDefecto.add(this.jmenuDatosParametroTesoreriaDefecto); } //PRINCIPAL_FIN //DETALLE //DETALLE_FIN //AGREGA MENU A PANTALLA if(!this.conCargarMinimo) { this.setJMenuBar(this.jmenuBarParametroTesoreriaDefecto); } //AGREGA MENU DETALLE A PANTALLA } public void inicializarElementosBusquedasParametroTesoreriaDefecto() { //BYDAN_BUSQUEDAS //INDICES BUSQUEDA this.jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto=new JPanelMe("fondo_formulario",true);//new JPanel(); this.jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setToolTipText("Buscar Por Tipo Cuenta "); this.jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto= new JButtonMe(); this.jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setText("Buscar"); this.jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setToolTipText("Buscar Por Tipo Cuenta "); FuncionesSwing.addImagenButtonGeneral(this.jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto,"buscar_button","Buscar Por Tipo Cuenta "); FuncionesSwing.setBoldButton(this.jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto = new JLabelMe(); jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setText("Tipo Cuenta :"); jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setToolTipText("Tipo Cuenta"); jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,-43),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,-43),Constantes2.ISWING_ALTO_CONTROL_LABEL)); jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL_LABEL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL_LABEL,-43),Constantes2.ISWING_ALTO_CONTROL_LABEL)); FuncionesSwing.setBoldLabel(jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto,STIPO_TAMANIO_GENERAL,false,true,this); jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto= new JComboBoxMe(); jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ANCHO_CONTROL,0),Constantes.ISWING_ALTO_CONTROL + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_CONTROL,0))); FuncionesSwing.setBoldComboBox(jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto,STIPO_TAMANIO_GENERAL,false,true,this); this.jTabbedPaneBusquedasParametroTesoreriaDefecto=new JTabbedPane(); this.jTabbedPaneBusquedasParametroTesoreriaDefecto.setMinimumSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,25))); this.jTabbedPaneBusquedasParametroTesoreriaDefecto.setMaximumSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,25))); this.jTabbedPaneBusquedasParametroTesoreriaDefecto.setPreferredSize(new Dimension(this.getWidth(),Constantes.ISWING_ALTO_TABPANE_BUSQUEDA + FuncionesSwing.getValorProporcion(Constantes.ISWING_ALTO_TABPANE_BUSQUEDA,25))); //this.jTabbedPaneBusquedasParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Busqueda")); this.jTabbedPaneBusquedasParametroTesoreriaDefecto.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); FuncionesSwing.setBoldTabbedPane(this.jTabbedPaneBusquedasParametroTesoreriaDefecto,STIPO_TAMANIO_GENERAL,false,true,this); //INDICES BUSQUEDA_FIN } //JPanel //@SuppressWarnings({"unchecked" })//"rawtypes" public JScrollPane getJContentPane(int iWidth,int iHeight,JDesktopPane jDesktopPane,Boolean cargarRelaciones,Usuario usuarioActual,ResumenUsuario resumenUsuarioActual,Modulo moduloActual,Opcion opcionActual,ParametroGeneralSg parametroGeneralSg,ParametroGeneralUsuario parametroGeneralUsuario,PaginaTipo paginaTipo) throws Exception { //PARA TABLA PARAMETROS String sKeyStrokeName=""; KeyStroke keyStrokeControl=null; this.jContentPane = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.usuarioActual=usuarioActual; this.resumenUsuarioActual=resumenUsuarioActual; this.opcionActual=opcionActual; this.moduloActual=moduloActual; this.parametroGeneralSg=parametroGeneralSg; this.parametroGeneralUsuario=parametroGeneralUsuario; this.jDesktopPane=jDesktopPane; this.conFuncionalidadRelaciones=parametroGeneralUsuario.getcon_guardar_relaciones(); int iGridyPrincipal=0; this.inicializarToolBar(); //CARGAR MENUS if(this.conCargarFormDetalle) { //true) { //this.jInternalFrameDetalleParametroTesoreriaDefecto = new ParametroTesoreriaDefectoDetalleJInternalFrame(paginaTipo);//JInternalFrameBase("Parametro Tesoreria Defecto DATOS"); this.jInternalFrameDetalleFormParametroTesoreriaDefecto = new ParametroTesoreriaDefectoDetalleFormJInternalFrame(jDesktopPane,this.parametrotesoreriadefectoSessionBean.getConGuardarRelaciones(),this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado(),cargarRelaciones,usuarioActual,resumenUsuarioActual,moduloActual,opcionActual,parametroGeneralSg,parametroGeneralUsuario,paginaTipo); } else { this.jInternalFrameDetalleFormParametroTesoreriaDefecto = null;//new ParametroTesoreriaDefectoDetalleFormJInternalFrame("MINIMO"); } this.cargarMenus(); this.gridaBagLayoutParametroTesoreriaDefecto= new GridBagLayout(); this.jTableDatosParametroTesoreriaDefecto = new JTableMe(); String sToolTipParametroTesoreriaDefecto=""; sToolTipParametroTesoreriaDefecto=ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO; if(Constantes.ISDEVELOPING) { sToolTipParametroTesoreriaDefecto+="(Tesoreria.ParametroTesoreriaDefecto)"; } if(!this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()) { sToolTipParametroTesoreriaDefecto+="_"+this.opcionActual.getId(); } this.jTableDatosParametroTesoreriaDefecto.setToolTipText(sToolTipParametroTesoreriaDefecto); //SE DEFINE EN DETALLE //FuncionesSwing.setBoldLabelTable(this.jTableDatosParametroTesoreriaDefecto); this.jTableDatosParametroTesoreriaDefecto.setAutoCreateRowSorter(true); this.jTableDatosParametroTesoreriaDefecto.setRowHeight(Constantes.ISWING_ALTO_FILA_TABLA + Constantes.ISWING_ALTO_FILA_TABLA_EXTRA_FECHA); //MULTIPLE SELECTION this.jTableDatosParametroTesoreriaDefecto.setRowSelectionAllowed(true); this.jTableDatosParametroTesoreriaDefecto.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); FuncionesSwing.setBoldTable(jTableDatosParametroTesoreriaDefecto,STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoParametroTesoreriaDefecto = new JButtonMe(); this.jButtonDuplicarParametroTesoreriaDefecto = new JButtonMe(); this.jButtonCopiarParametroTesoreriaDefecto = new JButtonMe(); this.jButtonVerFormParametroTesoreriaDefecto = new JButtonMe(); this.jButtonNuevoRelacionesParametroTesoreriaDefecto = new JButtonMe(); this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto = new JButtonMe(); this.jButtonCerrarParametroTesoreriaDefecto = new JButtonMe(); this.jScrollPanelDatosParametroTesoreriaDefecto = new JScrollPane(); this.jScrollPanelDatosGeneralParametroTesoreriaDefecto = new JScrollPane(); this.jPanelAccionesParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); //if(!this.conCargarMinimo) { ; //} this.sPath=" <---> Acceso: Parametro Tesoreria Defecto"; if(!this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()) { this.jScrollPanelDatosParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Parametro Tesoreria Defectos" + this.sPath)); } else { this.jScrollPanelDatosParametroTesoreriaDefecto.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } this.jScrollPanelDatosGeneralParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Edicion Datos")); this.jPanelAccionesParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Acciones")); this.jPanelAccionesParametroTesoreriaDefecto.setToolTipText("Acciones"); this.jPanelAccionesParametroTesoreriaDefecto.setName("Acciones"); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosGeneralParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,false,this); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelDatosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,false,this); //if(!this.conCargarMinimo) { ; //} //ELEMENTOS TABLAS PARAMETOS if(!this.conCargarMinimo) { } //ELEMENTOS TABLAS PARAMETOS_FIN if(!this.conCargarMinimo) { //REPORTE DINAMICO //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto=new ReporteDinamicoJInternalFrame(ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO,this); //this.cargarReporteDinamicoParametroTesoreriaDefecto(); //IMPORTACION //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameImportacionParametroTesoreriaDefecto=new ImportacionJInternalFrame(ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO,this); //this.cargarImportacionParametroTesoreriaDefecto(); } String sMapKey = ""; InputMap inputMap =null; this.jButtonAbrirOrderByParametroTesoreriaDefecto = new JButtonMe(); this.jButtonAbrirOrderByParametroTesoreriaDefecto.setText("Orden"); this.jButtonAbrirOrderByParametroTesoreriaDefecto.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByParametroTesoreriaDefecto,"orden_button","Orden"); FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; sMapKey = "AbrirOrderBySistema"; inputMap = this.jButtonAbrirOrderByParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey); this.jButtonAbrirOrderByParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderBySistema")); if(!this.conCargarMinimo) { //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameOrderByParametroTesoreriaDefecto=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByParametroTesoreriaDefecto,false,this); //this.cargarOrderByParametroTesoreriaDefecto(false); } else { //NO CARGAR INICIALMENTE, EN BOTON AL ABRIR //this.jInternalFrameOrderByParametroTesoreriaDefecto=new OrderByJInternalFrame(STIPO_TAMANIO_GENERAL,this.jButtonAbrirOrderByParametroTesoreriaDefecto,true,this); //this.cargarOrderByParametroTesoreriaDefecto(true); } //VALORES PARA DISENO /* this.jTableDatosParametroTesoreriaDefecto.setMinimumSize(new Dimension(400,50));//330 this.jTableDatosParametroTesoreriaDefecto.setMaximumSize(new Dimension(400,50));//330 this.jTableDatosParametroTesoreriaDefecto.setPreferredSize(new Dimension(400,50));//330 this.jScrollPanelDatosParametroTesoreriaDefecto.setMinimumSize(new Dimension(400,50)); this.jScrollPanelDatosParametroTesoreriaDefecto.setMaximumSize(new Dimension(400,50)); this.jScrollPanelDatosParametroTesoreriaDefecto.setPreferredSize(new Dimension(400,50)); */ this.jButtonNuevoParametroTesoreriaDefecto.setText("Nuevo"); this.jButtonDuplicarParametroTesoreriaDefecto.setText("Duplicar"); this.jButtonCopiarParametroTesoreriaDefecto.setText("Copiar"); this.jButtonVerFormParametroTesoreriaDefecto.setText("Ver"); this.jButtonNuevoRelacionesParametroTesoreriaDefecto.setText("Nuevo Rel"); this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto.setText("Guardar"); this.jButtonCerrarParametroTesoreriaDefecto.setText("Salir"); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoParametroTesoreriaDefecto,"nuevo_button","Nuevo",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonDuplicarParametroTesoreriaDefecto,"duplicar_button","Duplicar",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonCopiarParametroTesoreriaDefecto,"copiar_button","Copiar",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonVerFormParametroTesoreriaDefecto,"ver_form","Ver",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoRelacionesParametroTesoreriaDefecto,"nuevorelaciones_button","Nuevo Rel",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto,"guardarcambiostabla_button","Guardar",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarParametroTesoreriaDefecto,"cerrar_button","Salir",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.setBoldButton(this.jButtonNuevoParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonDuplicarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonCopiarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonVerFormParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonNuevoRelacionesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); FuncionesSwing.setBoldButton(this.jButtonCerrarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoParametroTesoreriaDefecto.setToolTipText("Nuevo"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO")); this.jButtonDuplicarParametroTesoreriaDefecto.setToolTipText("Duplicar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("DUPLICAR")); this.jButtonCopiarParametroTesoreriaDefecto.setToolTipText("Copiar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("COPIAR")); this.jButtonVerFormParametroTesoreriaDefecto.setToolTipText("Ver"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO+ FuncionesSwing.getKeyMensaje("VER_FORM")); this.jButtonNuevoRelacionesParametroTesoreriaDefecto.setToolTipText("Nuevo Rel"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("NUEVO_RELACIONES")); this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto.setToolTipText("Guardar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("GUARDAR_CAMBIOS")); this.jButtonCerrarParametroTesoreriaDefecto.setToolTipText("Salir"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("CERRAR")); //HOT KEYS /* N->Nuevo N->Alt + Nuevo Relaciones (ANTES R) A->Actualizar E->Eliminar S->Cerrar C->->Mayus + Cancelar (ANTES Q->Quit) G->Guardar Cambios D->Duplicar C->Alt + Cop?ar O->Orden N->Nuevo Tabla R->Recargar Informacion Inicial (ANTES I) Alt + Pag.Down->Siguientes Alt + Pag.Up->Anteriores NO UTILIZADOS M->Modificar */ //String sMapKey = ""; //InputMap inputMap =null; //NUEVO sMapKey = "NuevoParametroTesoreriaDefecto"; inputMap = this.jButtonNuevoParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO") , FuncionesSwing.getMaskKey("NUEVO")), sMapKey); this.jButtonNuevoParametroTesoreriaDefecto.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"NuevoParametroTesoreriaDefecto")); //DUPLICAR sMapKey = "DuplicarParametroTesoreriaDefecto"; inputMap = this.jButtonDuplicarParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("DUPLICAR") , FuncionesSwing.getMaskKey("DUPLICAR")), sMapKey); this.jButtonDuplicarParametroTesoreriaDefecto.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"DuplicarParametroTesoreriaDefecto")); //COPIAR sMapKey = "CopiarParametroTesoreriaDefecto"; inputMap = this.jButtonCopiarParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("COPIAR") , FuncionesSwing.getMaskKey("COPIAR")), sMapKey); this.jButtonCopiarParametroTesoreriaDefecto.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"CopiarParametroTesoreriaDefecto")); //VEr FORM sMapKey = "VerFormParametroTesoreriaDefecto"; inputMap = this.jButtonVerFormParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("VER_FORM") , FuncionesSwing.getMaskKey("VER_FORM")), sMapKey); this.jButtonVerFormParametroTesoreriaDefecto.getActionMap().put(sMapKey, new ButtonAbstractAction(this,"VerFormParametroTesoreriaDefecto")); //NUEVO RELACIONES sMapKey = "NuevoRelacionesParametroTesoreriaDefecto"; inputMap = this.jButtonNuevoRelacionesParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_RELACIONES") , FuncionesSwing.getMaskKey("NUEVO_RELACIONES")), sMapKey); this.jButtonNuevoRelacionesParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoRelacionesParametroTesoreriaDefecto")); //MODIFICAR /* sMapKey = "ModificarParametroTesoreriaDefecto"; inputMap = this.jButtonModificarParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("MODIFICAR") , FuncionesSwing.getMaskKey("MODIFICAR")), sMapKey); this.jButtonModificarParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"ModificarParametroTesoreriaDefecto")); */ //CERRAR sMapKey = "CerrarParametroTesoreriaDefecto"; inputMap = this.jButtonCerrarParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("CERRAR") , FuncionesSwing.getMaskKey("CERRAR")), sMapKey); this.jButtonCerrarParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"CerrarParametroTesoreriaDefecto")); //GUARDAR CAMBIOS sMapKey = "GuardarCambiosTablaParametroTesoreriaDefecto"; inputMap = this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("GUARDAR_CAMBIOS") , FuncionesSwing.getMaskKey("GUARDAR_CAMBIOS")), sMapKey); this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"GuardarCambiosTablaParametroTesoreriaDefecto")); //ABRIR ORDER BY if(!this.conCargarMinimo) { } //HOT KEYS this.jPanelParametrosReportesParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelPaginacionParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar1ParametroTesoreriaDefecto= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar2ParametroTesoreriaDefecto= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar3ParametroTesoreriaDefecto= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosAuxiliar4ParametroTesoreriaDefecto= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); //this.jPanelParametrosAuxiliar5ParametroTesoreriaDefecto= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); this.jPanelParametrosReportesParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Reportes-Acciones")); this.jPanelParametrosReportesParametroTesoreriaDefecto.setName("jPanelParametrosReportesParametroTesoreriaDefecto"); this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Parametros Acciones")); //this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto.setName("jPanelParametrosReportesAccionesParametroTesoreriaDefecto"); FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,false,this); FuncionesSwing.setBoldPanel(this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,false,this); this.jButtonRecargarInformacionParametroTesoreriaDefecto = new JButtonMe(); this.jButtonRecargarInformacionParametroTesoreriaDefecto.setText("Recargar"); this.jButtonRecargarInformacionParametroTesoreriaDefecto.setToolTipText("Recargar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO + FuncionesSwing.getKeyMensaje("RECARGAR")); FuncionesSwing.addImagenButtonGeneral(this.jButtonRecargarInformacionParametroTesoreriaDefecto,"recargar_button","Recargar"); this.jButtonProcesarInformacionParametroTesoreriaDefecto = new JButtonMe(); this.jButtonProcesarInformacionParametroTesoreriaDefecto.setText("Procesar"); this.jButtonProcesarInformacionParametroTesoreriaDefecto.setToolTipText("Procesar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); this.jButtonProcesarInformacionParametroTesoreriaDefecto.setVisible(false); this.jButtonProcesarInformacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(185,25)); this.jButtonProcesarInformacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(185,25)); this.jButtonProcesarInformacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(185,25)); this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setText("TIPO"); this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setToolTipText("Tipos De Archivo"); this.jComboBoxTiposReportesParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setText("TIPO"); this.jComboBoxTiposReportesParametroTesoreriaDefecto.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setText("TIPO"); this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposPaginacionParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposPaginacionParametroTesoreriaDefecto.setText("Paginacion"); this.jComboBoxTiposPaginacionParametroTesoreriaDefecto.setToolTipText("Tipos De Paginacion"); this.jComboBoxTiposRelacionesParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposRelacionesParametroTesoreriaDefecto.setText("Accion"); this.jComboBoxTiposRelacionesParametroTesoreriaDefecto.setToolTipText("Tipos de Relaciones"); this.jComboBoxTiposAccionesParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposAccionesParametroTesoreriaDefecto.setText("Accion"); this.jComboBoxTiposAccionesParametroTesoreriaDefecto.setToolTipText("Tipos de Acciones"); this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto = new JComboBoxMe(); //this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto.setText("Accion"); this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto.setToolTipText("Tipos de Seleccion"); this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto=new JTextFieldMe(); this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto.setMinimumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto.setMaximumSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto.setPreferredSize(new Dimension(100,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesParametroTesoreriaDefecto = new JLabelMe(); this.jLabelAccionesParametroTesoreriaDefecto.setText("Acciones"); this.jLabelAccionesParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelAccionesParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto = new JCheckBoxMe(); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto.setText("Sel. Todos"); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto.setToolTipText("Sel. Todos"); this.jCheckBoxSeleccionadosParametroTesoreriaDefecto = new JCheckBoxMe(); //this.jCheckBoxSeleccionadosParametroTesoreriaDefecto.setText("Seleccionados"); this.jCheckBoxSeleccionadosParametroTesoreriaDefecto.setToolTipText("SELECCIONAR SELECCIONADOS"); this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto = new JCheckBoxMe(); //this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.setText("Con Maximo Alto Tabla"); this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.setToolTipText("Con Maximo Alto Tabla"); this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto = new JCheckBoxMe(); this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto.setText("Graf."); this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto.setToolTipText("Con Grafico"); this.jButtonAnterioresParametroTesoreriaDefecto = new JButtonMe(); //this.jButtonAnterioresParametroTesoreriaDefecto.setText("<<"); this.jButtonAnterioresParametroTesoreriaDefecto.setToolTipText("Anteriores Datos" + FuncionesSwing.getKeyMensaje("ANTERIORES")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAnterioresParametroTesoreriaDefecto,"anteriores_button","<<"); FuncionesSwing.setBoldButton(this.jButtonAnterioresParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonSiguientesParametroTesoreriaDefecto = new JButtonMe(); //this.jButtonSiguientesParametroTesoreriaDefecto.setText(">>"); this.jButtonSiguientesParametroTesoreriaDefecto.setToolTipText("Siguientes Datos" + FuncionesSwing.getKeyMensaje("SIGUIENTES")); FuncionesSwing.addImagenButtonGeneral(this.jButtonSiguientesParametroTesoreriaDefecto,"siguientes_button",">>"); FuncionesSwing.setBoldButton(this.jButtonSiguientesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto = new JButtonMe(); this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto.setText("Nue"); this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto.setToolTipText("Nuevo" + FuncionesSwing.getKeyMensaje("NUEVO_TABLA")); FuncionesSwing.addImagenButtonGeneral(this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto,"nuevoguardarcambios_button","Nue",this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()); FuncionesSwing.setBoldButton(this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); //HOT KEYS2 /* T->Nuevo Tabla */ //NUEVO GUARDAR CAMBIOS O NUEVO TABLA sMapKey = "NuevoGuardarCambiosParametroTesoreriaDefecto"; inputMap = this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("NUEVO_TABLA") , FuncionesSwing.getMaskKey("NUEVO_TABLA")), sMapKey); this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"NuevoGuardarCambiosParametroTesoreriaDefecto")); //RECARGAR sMapKey = "RecargarInformacionParametroTesoreriaDefecto"; inputMap = this.jButtonRecargarInformacionParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("RECARGAR") , FuncionesSwing.getMaskKey("RECARGAR")), sMapKey); this.jButtonRecargarInformacionParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"RecargarInformacionParametroTesoreriaDefecto")); //SIGUIENTES sMapKey = "SiguientesParametroTesoreriaDefecto"; inputMap = this.jButtonSiguientesParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("SIGUIENTES") , FuncionesSwing.getMaskKey("SIGUIENTES")), sMapKey); this.jButtonSiguientesParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"SiguientesParametroTesoreriaDefecto")); //ANTERIORES sMapKey = "AnterioresParametroTesoreriaDefecto"; inputMap = this.jButtonAnterioresParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ANTERIORES") , FuncionesSwing.getMaskKey("ANTERIORES")), sMapKey); this.jButtonAnterioresParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AnterioresParametroTesoreriaDefecto")); //HOT KEYS2 //DETALLE //TOOLBAR //INDICES BUSQUEDA //INDICES BUSQUEDA_FIN //INDICES BUSQUEDA if(!this.conCargarMinimo) { this.inicializarElementosBusquedasParametroTesoreriaDefecto(); } //INDICES BUSQUEDA_FIN //ELEMENTOS TABLAS PARAMETOS if(!this.conCargarMinimo) { } //ELEMENTOS TABLAS PARAMETOS_FIN //ELEMENTOS TABLAS PARAMETOS_FIN //ESTA EN BEAN /* this.jTabbedPaneRelacionesParametroTesoreriaDefecto.setMinimumSize(new Dimension(this.getWidth(),ParametroTesoreriaDefectoBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(ParametroTesoreriaDefectoBean.ALTO_TABPANE_RELACIONES,0))); this.jTabbedPaneRelacionesParametroTesoreriaDefecto.setMaximumSize(new Dimension(this.getWidth(),ParametroTesoreriaDefectoBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(ParametroTesoreriaDefectoBean.ALTO_TABPANE_RELACIONES,0))); this.jTabbedPaneRelacionesParametroTesoreriaDefecto.setPreferredSize(new Dimension(this.getWidth(),ParametroTesoreriaDefectoBean.ALTO_TABPANE_RELACIONES + FuncionesSwing.getValorProporcion(ParametroTesoreriaDefectoBean.ALTO_TABPANE_RELACIONES,0))); */ int iPosXAccionPaginacion=0; GridBagLayout gridaBagLayoutPaginacionParametroTesoreriaDefecto = new GridBagLayout(); this.jPanelPaginacionParametroTesoreriaDefecto.setLayout(gridaBagLayoutPaginacionParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.EAST; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonAnterioresParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonNuevoGuardarCambiosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonSiguientesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); iPosXAccionPaginacion=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonNuevoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); if(!this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado() && !this.conCargarMinimo) { this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonGuardarCambiosTablaParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonDuplicarParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonCopiarParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonVerFormParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXAccionPaginacion++; this.jPanelPaginacionParametroTesoreriaDefecto.add(this.jButtonCerrarParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.jButtonRecargarInformacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(95,25)); this.jButtonRecargarInformacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(95,25)); this.jButtonRecargarInformacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(95,25)); FuncionesSwing.setBoldButton(this.jButtonRecargarInformacionParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setMinimumSize(new Dimension(105,20)); this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setMaximumSize(new Dimension(105,20)); this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto.setPreferredSize(new Dimension(105,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposReportesParametroTesoreriaDefecto.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposReportesParametroTesoreriaDefecto.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposReportesParametroTesoreriaDefecto.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto.setMinimumSize(new Dimension(80,20)); this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto.setMaximumSize(new Dimension(80,20)); this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto.setPreferredSize(new Dimension(80,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposGraficosReportesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposPaginacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(80,20)); this.jComboBoxTiposPaginacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(80,20)); this.jComboBoxTiposPaginacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(80,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposPaginacionParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposRelacionesParametroTesoreriaDefecto.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposRelacionesParametroTesoreriaDefecto.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposRelacionesParametroTesoreriaDefecto.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposRelacionesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposAccionesParametroTesoreriaDefecto.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposAccionesParametroTesoreriaDefecto.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposAccionesParametroTesoreriaDefecto.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposAccionesParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto.setMinimumSize(new Dimension(145,20)); this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto.setMaximumSize(new Dimension(145,20)); this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto.setPreferredSize(new Dimension(145,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.setMinimumSize(new Dimension(20,20)); this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.setMaximumSize(new Dimension(20,20)); this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.setPreferredSize(new Dimension(20,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(60,20)); this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(60,20)); this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(60,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxConGraficoReporteParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto.setMinimumSize(new Dimension(100,20)); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto.setMaximumSize(new Dimension(100,20)); this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jCheckBoxSeleccionadosParametroTesoreriaDefecto.setMinimumSize(new Dimension(20,20)); this.jCheckBoxSeleccionadosParametroTesoreriaDefecto.setMaximumSize(new Dimension(20,20)); this.jCheckBoxSeleccionadosParametroTesoreriaDefecto.setPreferredSize(new Dimension(20,20)); FuncionesSwing.setBoldCheckBox(this.jCheckBoxSeleccionadosParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; GridBagLayout gridaBagParametrosReportesParametroTesoreriaDefecto = new GridBagLayout(); GridBagLayout gridaBagParametrosReportesAccionesParametroTesoreriaDefecto = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar1ParametroTesoreriaDefecto = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar2ParametroTesoreriaDefecto = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar3ParametroTesoreriaDefecto = new GridBagLayout(); GridBagLayout gridaBagParametrosAuxiliar4ParametroTesoreriaDefecto = new GridBagLayout(); int iGridxParametrosReportes=0; int iGridyParametrosReportes=0; int iGridxParametrosAuxiliar=0; int iGridyParametrosAuxiliar=0; this.jPanelParametrosReportesParametroTesoreriaDefecto.setLayout(gridaBagParametrosReportesParametroTesoreriaDefecto); this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto.setLayout(gridaBagParametrosReportesAccionesParametroTesoreriaDefecto); this.jPanelParametrosAuxiliar1ParametroTesoreriaDefecto.setLayout(gridaBagParametrosAuxiliar1ParametroTesoreriaDefecto); this.jPanelParametrosAuxiliar2ParametroTesoreriaDefecto.setLayout(gridaBagParametrosAuxiliar2ParametroTesoreriaDefecto); this.jPanelParametrosAuxiliar3ParametroTesoreriaDefecto.setLayout(gridaBagParametrosAuxiliar3ParametroTesoreriaDefecto); this.jPanelParametrosAuxiliar4ParametroTesoreriaDefecto.setLayout(gridaBagParametrosAuxiliar4ParametroTesoreriaDefecto); //this.jPanelParametrosAuxiliar5ParametroTesoreriaDefecto.setLayout(gridaBagParametrosAuxiliar2ParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jButtonRecargarInformacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //PAGINACION this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1ParametroTesoreriaDefecto.add(this.jComboBoxTiposPaginacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //CON ALTO MAXIMO TABLA this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1ParametroTesoreriaDefecto.add(this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //TIPOS ARCHIVOS REPORTES this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar1ParametroTesoreriaDefecto.add(this.jComboBoxTiposArchivosReportesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //USANDO AUXILIAR this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jPanelParametrosAuxiliar1ParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //USANDO AUXILIAR FIN //AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar4ParametroTesoreriaDefecto.add(this.jComboBoxTiposReportesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //AUXILIAR4 TIPOS REPORTES Y TIPOS GRAFICOS REPORTES //USANDO AUXILIAR 4 this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jPanelParametrosAuxiliar4ParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //USANDO AUXILIAR 4 FIN //TIPOS REPORTES /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jComboBoxTiposReportesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ //GENERAR REPORTE (jCheckBoxExportar) /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jCheckBoxGenerarReporteParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; //USANDO AUXILIAR this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jPanelParametrosAuxiliar2ParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //USANDO AUXILIAR FIN //PARAMETROS ACCIONES //iGridxParametrosReportes=1; iGridxParametrosReportes=0; iGridyParametrosReportes=1; /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jLabelAccionesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ //PARAMETROS_ACCIONES-PARAMETROS_REPORTES //ORDER BY if(!this.conCargarMinimo) { this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jButtonAbrirOrderByParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } //PARAMETROS_ACCIONES-PARAMETROS_REPORTES this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jComboBoxTiposSeleccionarParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ iGridxParametrosAuxiliar=0; iGridyParametrosAuxiliar=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3ParametroTesoreriaDefecto.add(this.jCheckBoxSeleccionarTodosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iGridxParametrosAuxiliar;//iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iGridyParametrosAuxiliar++;//iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosAuxiliar3ParametroTesoreriaDefecto.add(this.jCheckBoxSeleccionadosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //USANDO AUXILIAR3 this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; //this.jPanelParametrosReportes this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jPanelParametrosAuxiliar3ParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //USANDO AUXILIAR3 FIN this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jComboBoxTiposAccionesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyParametrosReportes; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iGridxParametrosReportes++; this.jPanelParametrosReportesParametroTesoreriaDefecto.add(this.jTextFieldValorCampoGeneralParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); ; //ELEMENTOS TABLAS PARAMETOS //SUBPANELES POR CAMPO if(!this.conCargarMinimo) { //SUBPANELES EN PANEL CAMPOS } //ELEMENTOS TABLAS PARAMETOS_FIN /* GridBagLayout gridaBagLayoutDatosParametroTesoreriaDefecto = new GridBagLayout(); this.jScrollPanelDatosParametroTesoreriaDefecto.setLayout(gridaBagLayoutDatosParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jScrollPanelDatosParametroTesoreriaDefecto.add(this.jTableDatosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ this.redimensionarTablaDatos(-1); this.jScrollPanelDatosParametroTesoreriaDefecto.setViewportView(this.jTableDatosParametroTesoreriaDefecto); this.jTableDatosParametroTesoreriaDefecto.setFillsViewportHeight(true); this.jTableDatosParametroTesoreriaDefecto.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); Integer iGridXParametrosAccionesFormulario=0; Integer iGridYParametrosAccionesFormulario=0; GridBagLayout gridaBagLayoutAccionesParametroTesoreriaDefecto= new GridBagLayout(); this.jPanelAccionesParametroTesoreriaDefecto.setLayout(gridaBagLayoutAccionesParametroTesoreriaDefecto); /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jPanelAccionesParametroTesoreriaDefecto.add(this.jButtonNuevoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ int iPosXAccion=0; if(!this.conCargarMinimo) { //BYDAN_BUSQUEDAS GridBagLayout gridaBagLayoutFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto= new GridBagLayout(); gridaBagLayoutFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.rowHeights = new int[] {1}; gridaBagLayoutFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.columnWidths = new int[] {1}; gridaBagLayoutFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.rowWeights = new double[]{0.0, 0.0, 0.0}; gridaBagLayoutFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.columnWeights = new double[]{0.0, 1.0}; jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.setLayout(gridaBagLayoutFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto); gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.add(jLabelid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto, gridBagConstraintsParametroTesoreriaDefecto); gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; gridBagConstraintsParametroTesoreriaDefecto.gridy = 0; gridBagConstraintsParametroTesoreriaDefecto.gridx = 1; jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.add(jComboBoxid_tipo_cuenta_banco_globalFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto, gridBagConstraintsParametroTesoreriaDefecto); gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.WEST; gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; gridBagConstraintsParametroTesoreriaDefecto.gridy = 1; gridBagConstraintsParametroTesoreriaDefecto.gridx =1; jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto.add(jButtonFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto, gridBagConstraintsParametroTesoreriaDefecto); jTabbedPaneBusquedasParametroTesoreriaDefecto.addTab("1.-Por Tipo Cuenta ", jPanelFK_IdTipoCuentaBancoGlobalParametroTesoreriaDefecto); jTabbedPaneBusquedasParametroTesoreriaDefecto.setMnemonicAt(0, KeyEvent.VK_1); } //this.setJProgressBarToJPanel(); GridBagLayout gridaBagLayoutParametroTesoreriaDefecto = new GridBagLayout(); this.jContentPane.setLayout(gridaBagLayoutParametroTesoreriaDefecto); if(this.parametroGeneralUsuario.getcon_botones_tool_bar() && !this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()) { this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; //this.gridBagConstraintsParametroTesoreriaDefecto.fill =GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.CENTER;//.CENTER;NORTH this.gridBagConstraintsParametroTesoreriaDefecto.ipadx = 100; this.jContentPane.add(this.jTtoolBarParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } //PROCESANDO EN OTRA PANTALLA /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; //this.gridBagConstraintsParametroTesoreriaDefecto.fill =GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.CENTER; this.gridBagConstraintsParametroTesoreriaDefecto.ipadx = 100; this.jContentPane.add(this.jPanelProgressProcess, this.gridBagConstraintsParametroTesoreriaDefecto); */ int iGridxBusquedasParametros=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); if(!this.conCargarMinimo) { this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.gridBagConstraintsParametroTesoreriaDefecto.fill =GridBagConstraints.VERTICAL;//GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.anchor = GridBagConstraints.NORTHWEST; this.gridBagConstraintsParametroTesoreriaDefecto.ipadx = 150; if(!this.conCargarMinimo) { this.jContentPane.add(this.jTabbedPaneBusquedasParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } } //PARAMETROS TABLAS PARAMETROS if(!this.conCargarMinimo) { } //PARAMETROS TABLAS PARAMETROS_FIN //PARAMETROS REPORTES this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jContentPane.add(this.jPanelParametrosReportesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jContentPane.add(this.jPanelParametrosReportesAccionesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =0; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.BOTH; //this.gridBagConstraintsParametroTesoreriaDefecto.ipady =150; this.jContentPane.add(this.jScrollPanelDatosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jContentPane.add(this.jPanelPaginacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); iWidthScroll=(screenSize.width-screenSize.width/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ANCHO_RELSCROLL)+(250*0); iHeightScroll=(screenSize.height-screenSize.height/Constantes.ISWING_RESTOPARTE_DIFERENCIA_ALTO_RELSCROLL); if(ParametroTesoreriaDefectoJInternalFrame.CON_DATOS_FRAME) { this.jPanelBusquedasParametrosParametroTesoreriaDefecto= new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true);//new JPanel(); int iGridyRelaciones=0; GridBagLayout gridaBagLayoutBusquedasParametrosParametroTesoreriaDefecto = new GridBagLayout(); this.jPanelBusquedasParametrosParametroTesoreriaDefecto.setLayout(gridaBagLayoutBusquedasParametrosParametroTesoreriaDefecto); if(this.parametroGeneralUsuario.getcon_botones_tool_bar()) { } this.jScrollPanelDatosGeneralParametroTesoreriaDefecto= new JScrollPane(jContentPane,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.jScrollPanelDatosGeneralParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthScroll,iHeightScroll)); this.jScrollPanelDatosGeneralParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthScroll,iHeightScroll)); this.jScrollPanelDatosGeneralParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthScroll,iHeightScroll)); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); //if(!this.conCargarMinimo) { //} this.conMaximoRelaciones=true; if(this.parametroGeneralUsuario.getcon_cargar_por_parte()) { } Boolean tieneColumnasOcultas=false; tieneColumnasOcultas=true; if(!Constantes.ISDEVELOPING) { } else { if(tieneColumnasOcultas) { } } } else { //DISENO_DETALLE COMENTAR Y //DISENO_DETALLE(Solo Descomentar Seccion Inferior) //NOTA-DISENO_DETALLE(Si cambia lo de abajo, cambiar lo comentado, Al final no es lo mismo) } //DISENO_DETALLE-(Descomentar) /* this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jContentPane.add(this.jPanelCamposParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = 0; this.jContentPane.add(this.jPanelCamposOcultosParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iGridyPrincipal++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =0; this.jContentPane.add(this.jPanelAccionesParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); */ //pack(); return this.jScrollPanelDatosGeneralParametroTesoreriaDefecto;//jContentPane; } /* public void cargarReporteDinamicoParametroTesoreriaDefecto() throws Exception { int iWidthReporteDinamico=350; int iHeightReporteDinamico=450;//250;400; int iPosXReporteDinamico=0; int iPosYReporteDinamico=0; GridBagLayout gridaBagLayoutReporteDinamicoParametroTesoreriaDefecto = new GridBagLayout(); //PANEL this.jPanelReporteDinamicoParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelReporteDinamicoParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelReporteDinamicoParametroTesoreriaDefecto.setName("jPanelReporteDinamicoParametroTesoreriaDefecto"); this.jPanelReporteDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); this.jPanelReporteDinamicoParametroTesoreriaDefecto.setLayout(gridaBagLayoutReporteDinamicoParametroTesoreriaDefecto); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto= new ReporteDinamicoJInternalFrame(); this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReporteParametroTesoreriaDefecto= new JScrollPane(); //JINTERNAL FRAME this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setjInternalFrameParent(this); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setTitle("REPORTE DINAMICO"); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setSize(iWidthReporteDinamico+70,iHeightReporteDinamico+100); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setResizable(true); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setClosable(true); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setMaximizable(true); //SCROLL PANEL //this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthReporteDinamico,iHeightReporteDinamico)); //this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Parametro Tesoreria Defectos")); //CONTROLES-ELEMENTOS //LABEL SELECT COLUMNAS this.jLabelColumnasSelectReporteParametroTesoreriaDefecto = new JLabelMe(); this.jLabelColumnasSelectReporteParametroTesoreriaDefecto.setText("Columnas Seleccion"); this.jLabelColumnasSelectReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasSelectReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelColumnasSelectReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jLabelColumnasSelectReporteParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //LISTA SELECT COLUMNAS this.jListColumnasSelectReporteParametroTesoreriaDefecto = new JList<Reporte>(); this.jListColumnasSelectReporteParametroTesoreriaDefecto.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListColumnasSelectReporteParametroTesoreriaDefecto.setToolTipText("Tipos de Seleccion"); this.jListColumnasSelectReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(145,300)); this.jListColumnasSelectReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(145,300)); this.jListColumnasSelectReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(145,300)); //SCROLL_PANEL_CONTROL this.jScrollColumnasSelectReporteParametroTesoreriaDefecto=new JScrollPane(this.jListColumnasSelectReporteParametroTesoreriaDefecto); this.jScrollColumnasSelectReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(180,150)); this.jScrollColumnasSelectReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(180,150)); this.jScrollColumnasSelectReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(180,150)); this.jScrollColumnasSelectReporteParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("COLUMNAS")); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jListColumnasSelectReporteParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jScrollColumnasSelectReporteParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //LABEL SELECT RELACIONES this.jLabelRelacionesSelectReporteParametroTesoreriaDefecto = new JLabelMe(); this.jLabelRelacionesSelectReporteParametroTesoreriaDefecto.setText("Relaciones Seleccion"); this.jLabelRelacionesSelectReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelRelacionesSelectReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelRelacionesSelectReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); //LABEL SELECT RELACIONES_FIN //LISTA SELECT RELACIONES this.jListRelacionesSelectReporteParametroTesoreriaDefecto = new JList<Reporte>(); this.jListRelacionesSelectReporteParametroTesoreriaDefecto.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); this.jListRelacionesSelectReporteParametroTesoreriaDefecto.setToolTipText("Tipos de Seleccion"); this.jListRelacionesSelectReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(145,300)); this.jListRelacionesSelectReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(145,300)); this.jListRelacionesSelectReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(145,300)); //SCROLL_PANEL_CONTROL this.jScrollRelacionesSelectReporteParametroTesoreriaDefecto=new JScrollPane(this.jListRelacionesSelectReporteParametroTesoreriaDefecto); this.jScrollRelacionesSelectReporteParametroTesoreriaDefecto.setMinimumSize(new Dimension(180,120)); this.jScrollRelacionesSelectReporteParametroTesoreriaDefecto.setMaximumSize(new Dimension(180,120)); this.jScrollRelacionesSelectReporteParametroTesoreriaDefecto.setPreferredSize(new Dimension(180,120)); this.jScrollRelacionesSelectReporteParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("RELACIONES")); this.jCheckBoxConGraficoDinamicoParametroTesoreriaDefecto = new JCheckBoxMe(); this.jComboBoxColumnaCategoriaGraficoParametroTesoreriaDefecto = new JComboBoxMe(); this.jListColumnasValoresGraficoParametroTesoreriaDefecto = new JList<Reporte>(); //COMBO TIPOS REPORTES this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto = new JComboBoxMe(); this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto.setToolTipText("Tipos De Reporte"); this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; //COMBO TIPOS REPORTES //COMBO TIPOS ARCHIVOS this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto = new JComboBoxMe(); this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto.setToolTipText("Tipos Archivos"); this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(100,20)); this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(100,20)); this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(100,20)); FuncionesSwing.setBoldComboBox(this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; //COMBO TIPOS ARCHIVOS //LABEL GENERAR EXCEL this.jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto = new JLabelMe(); this.jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto.setText("Tipos de Reporte"); this.jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jLabelGenerarExcelReporteDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //BOTON GENERAR EXCEL this.jButtonGenerarExcelReporteDinamicoParametroTesoreriaDefecto = new JButtonMe(); this.jButtonGenerarExcelReporteDinamicoParametroTesoreriaDefecto.setText("Generar Excel"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarExcelReporteDinamicoParametroTesoreriaDefecto,"generar_excel_reporte_dinamico_button","Generar EXCEL"); this.jButtonGenerarExcelReporteDinamicoParametroTesoreriaDefecto.setToolTipText("Generar EXCEL"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); //this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); //this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; //this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; //this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; //this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jButtonGenerarExcelReporteDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //COMBO TIPOS REPORTES this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jComboBoxTiposReportesDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //LABEL TIPOS DE ARCHIVO this.jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto = new JLabelMe(); this.jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto.setText("Tipos de Archivo"); this.jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jLabelTiposArchivoReporteDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //COMBO TIPOS ARCHIVOS this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jComboBoxTiposArchivosReportesDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //BOTON GENERAR this.jButtonGenerarReporteDinamicoParametroTesoreriaDefecto = new JButtonMe(); this.jButtonGenerarReporteDinamicoParametroTesoreriaDefecto.setText("Generar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarReporteDinamicoParametroTesoreriaDefecto,"generar_reporte_dinamico_button","Generar"); this.jButtonGenerarReporteDinamicoParametroTesoreriaDefecto.setToolTipText("Generar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); iPosXReporteDinamico=0; iPosYReporteDinamico++; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jButtonGenerarReporteDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //BOTON CERRAR this.jButtonCerrarReporteDinamicoParametroTesoreriaDefecto = new JButtonMe(); this.jButtonCerrarReporteDinamicoParametroTesoreriaDefecto.setText("Cancelar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarReporteDinamicoParametroTesoreriaDefecto,"cerrar_reporte_dinamico_button","Cancelar"); this.jButtonCerrarReporteDinamicoParametroTesoreriaDefecto.setToolTipText("Cancelar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXReporteDinamico++; this.jPanelReporteDinamicoParametroTesoreriaDefecto.add(this.jButtonCerrarReporteDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutReporteDinamicoPrincipalParametroTesoreriaDefecto = new GridBagLayout(); this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto= new JScrollPane(jPanelReporteDinamicoParametroTesoreriaDefecto,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthReporteDinamico+90,iHeightReporteDinamico+90)); this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Parametro Tesoreria Defectos")); iPosXReporteDinamico=0; iPosYReporteDinamico=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iPosYReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iPosXReporteDinamico; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.BOTH; this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.getContentPane().setLayout(gridaBagLayoutReporteDinamicoPrincipalParametroTesoreriaDefecto); this.jInternalFrameReporteDinamicoParametroTesoreriaDefecto.getContentPane().add(this.jScrollPanelReporteDinamicoParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } */ /* public void cargarImportacionParametroTesoreriaDefecto() throws Exception { int iWidthImportacion=350; int iHeightImportacion=250;//400; int iPosXImportacion=0; int iPosYImportacion=0; GridBagLayout gridaBagLayoutImportacionParametroTesoreriaDefecto = new GridBagLayout(); //PANEL this.jPanelImportacionParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelImportacionParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelImportacionParametroTesoreriaDefecto.setName("jPanelImportacionParametroTesoreriaDefecto"); this.jPanelImportacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jPanelImportacionParametroTesoreriaDefecto.setLayout(gridaBagLayoutImportacionParametroTesoreriaDefecto); this.jInternalFrameImportacionParametroTesoreriaDefecto= new ImportacionJInternalFrame(); //this.jInternalFrameImportacionParametroTesoreriaDefecto= new ImportacionJInternalFrame(); this.jScrollPanelImportacionParametroTesoreriaDefecto = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReporteParametroTesoreriaDefecto= new JScrollPane(); //JINTERNAL FRAME this.jInternalFrameImportacionParametroTesoreriaDefecto.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameImportacionParametroTesoreriaDefecto.setjInternalFrameParent(this); this.jInternalFrameImportacionParametroTesoreriaDefecto.setTitle("REPORTE DINAMICO"); this.jInternalFrameImportacionParametroTesoreriaDefecto.setSize(iWidthImportacion+70,iHeightImportacion+100); this.jInternalFrameImportacionParametroTesoreriaDefecto.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameImportacionParametroTesoreriaDefecto.setResizable(true); this.jInternalFrameImportacionParametroTesoreriaDefecto.setClosable(true); this.jInternalFrameImportacionParametroTesoreriaDefecto.setMaximizable(true); //JINTERNAL FRAME IMPORTACION this.jInternalFrameImportacionParametroTesoreriaDefecto.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameImportacionParametroTesoreriaDefecto.setjInternalFrameParent(this); this.jInternalFrameImportacionParametroTesoreriaDefecto.setTitle("IMPORTACION"); this.jInternalFrameImportacionParametroTesoreriaDefecto.setSize(iWidthImportacion+70,iHeightImportacion+100); this.jInternalFrameImportacionParametroTesoreriaDefecto.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameImportacionParametroTesoreriaDefecto.setResizable(true); this.jInternalFrameImportacionParametroTesoreriaDefecto.setClosable(true); this.jInternalFrameImportacionParametroTesoreriaDefecto.setMaximizable(true); //SCROLL PANEL this.jScrollPanelImportacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthImportacion,iHeightImportacion)); this.jScrollPanelImportacionParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Parametro Tesoreria Defectos")); //LABEL ARCHIVO IMPORTACION this.jLabelArchivoImportacionParametroTesoreriaDefecto = new JLabelMe(); this.jLabelArchivoImportacionParametroTesoreriaDefecto.setText("ARCHIVO IMPORTACION"); this.jLabelArchivoImportacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelArchivoImportacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelArchivoImportacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXImportacion++; this.jPanelImportacionParametroTesoreriaDefecto.add(this.jLabelArchivoImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //BOTON ABRIR IMPORTACION this.jFileChooserImportacionParametroTesoreriaDefecto = new JFileChooser(); this.jFileChooserImportacionParametroTesoreriaDefecto.setToolTipText("ESCOGER ARCHIVO"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); this.jButtonAbrirImportacionParametroTesoreriaDefecto = new JButtonMe(); this.jButtonAbrirImportacionParametroTesoreriaDefecto.setText("ESCOGER"); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirImportacionParametroTesoreriaDefecto,"generar_importacion_button","ESCOGER"); this.jButtonAbrirImportacionParametroTesoreriaDefecto.setToolTipText("Generar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXImportacion++; this.jPanelImportacionParametroTesoreriaDefecto.add(this.jButtonAbrirImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //LABEL PATH IMPORTACION this.jLabelPathArchivoImportacionParametroTesoreriaDefecto = new JLabelMe(); this.jLabelPathArchivoImportacionParametroTesoreriaDefecto.setText("PATH ARCHIVO"); this.jLabelPathArchivoImportacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelPathArchivoImportacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); this.jLabelPathArchivoImportacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(Constantes.ISWING_ANCHO_CONTROL,Constantes.ISWING_ALTO_CONTROL)); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.HORIZONTAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXImportacion++; this.jPanelImportacionParametroTesoreriaDefecto.add(this.jLabelPathArchivoImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //PATH IMPORTACION this.jTextFieldPathArchivoImportacionParametroTesoreriaDefecto=new JTextFieldMe(); this.jTextFieldPathArchivoImportacionParametroTesoreriaDefecto.setMinimumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldPathArchivoImportacionParametroTesoreriaDefecto.setMaximumSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.jTextFieldPathArchivoImportacionParametroTesoreriaDefecto.setPreferredSize(new Dimension(150,Constantes.ISWING_ALTO_CONTROL)); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXImportacion++; this.jPanelImportacionParametroTesoreriaDefecto.add(this.jTextFieldPathArchivoImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //BOTON IMPORTACION this.jButtonGenerarImportacionParametroTesoreriaDefecto = new JButtonMe(); this.jButtonGenerarImportacionParametroTesoreriaDefecto.setText("IMPORTAR"); FuncionesSwing.addImagenButtonGeneral(this.jButtonGenerarImportacionParametroTesoreriaDefecto,"generar_importacion_button","IMPORTAR"); this.jButtonGenerarImportacionParametroTesoreriaDefecto.setToolTipText("Generar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); iPosXImportacion=0; iPosYImportacion++; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXImportacion++; this.jPanelImportacionParametroTesoreriaDefecto.add(this.jButtonGenerarImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //BOTON CERRAR this.jButtonCerrarImportacionParametroTesoreriaDefecto = new JButtonMe(); this.jButtonCerrarImportacionParametroTesoreriaDefecto.setText("Cancelar"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarImportacionParametroTesoreriaDefecto,"cerrar_reporte_dinamico_button","Cancelar"); this.jButtonCerrarImportacionParametroTesoreriaDefecto.setToolTipText("Cancelar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXImportacion++; this.jPanelImportacionParametroTesoreriaDefecto.add(this.jButtonCerrarImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutImportacionPrincipalParametroTesoreriaDefecto = new GridBagLayout(); this.jScrollPanelImportacionParametroTesoreriaDefecto= new JScrollPane(jPanelImportacionParametroTesoreriaDefecto,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); iPosXImportacion=0; iPosYImportacion=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iPosYImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iPosXImportacion; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.BOTH; this.jInternalFrameImportacionParametroTesoreriaDefecto.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameImportacionParametroTesoreriaDefecto.getContentPane().setLayout(gridaBagLayoutImportacionPrincipalParametroTesoreriaDefecto); this.jInternalFrameImportacionParametroTesoreriaDefecto.getContentPane().add(this.jScrollPanelImportacionParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } */ /* public void cargarOrderByParametroTesoreriaDefecto(Boolean cargaMinima) throws Exception { String sMapKey = ""; InputMap inputMap =null; int iWidthOrderBy=350; int iHeightOrderBy=300;//400; int iPosXOrderBy=0; int iPosYOrderBy=0; if(!cargaMinima) { this.jButtonAbrirOrderByParametroTesoreriaDefecto = new JButtonMe(); this.jButtonAbrirOrderByParametroTesoreriaDefecto.setText("Orden"); this.jButtonAbrirOrderByParametroTesoreriaDefecto.setToolTipText("Orden"+FuncionesSwing.getKeyMensaje("ORDEN")); FuncionesSwing.addImagenButtonGeneral(this.jButtonAbrirOrderByParametroTesoreriaDefecto,"orden_button","Orden"); FuncionesSwing.setBoldButton(this.jButtonAbrirOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; sMapKey = "AbrirOrderByParametroTesoreriaDefecto"; inputMap = this.jButtonAbrirOrderByParametroTesoreriaDefecto.getInputMap(FuncionesSwing.getTipoFocusedKeyEvent("NORMAL")); inputMap.put(KeyStroke.getKeyStroke(FuncionesSwing.getKeyEvent("ORDEN") , FuncionesSwing.getMaskKey("ORDEN")), sMapKey); this.jButtonAbrirOrderByParametroTesoreriaDefecto.getActionMap().put(sMapKey,new ButtonAbstractAction(this,"AbrirOrderByParametroTesoreriaDefecto")); GridBagLayout gridaBagLayoutOrderByParametroTesoreriaDefecto = new GridBagLayout(); //PANEL this.jPanelOrderByParametroTesoreriaDefecto = new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true); this.jPanelOrderByParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Campos")); this.jPanelOrderByParametroTesoreriaDefecto.setName("jPanelOrderByParametroTesoreriaDefecto"); this.jPanelOrderByParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jPanelOrderByParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jPanelOrderByParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); FuncionesSwing.setBoldPanel(this.jPanelOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jPanelOrderByParametroTesoreriaDefecto.setLayout(gridaBagLayoutOrderByParametroTesoreriaDefecto); this.jTableDatosParametroTesoreriaDefectoOrderBy = new JTableMe(); this.jTableDatosParametroTesoreriaDefectoOrderBy.setAutoCreateRowSorter(true); FuncionesSwing.setBoldTable(jTableDatosParametroTesoreriaDefectoOrderBy,STIPO_TAMANIO_GENERAL,false,true,this); this.jScrollPanelDatosParametroTesoreriaDefectoOrderBy = new JScrollPane(); this.jScrollPanelDatosParametroTesoreriaDefectoOrderBy.setBorder(javax.swing.BorderFactory.createTitledBorder("Orden")); this.jScrollPanelDatosParametroTesoreriaDefectoOrderBy.setViewportView(this.jTableDatosParametroTesoreriaDefectoOrderBy); this.jTableDatosParametroTesoreriaDefectoOrderBy.setFillsViewportHeight(true); this.jTableDatosParametroTesoreriaDefectoOrderBy.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); this.jInternalFrameOrderByParametroTesoreriaDefecto= new OrderByJInternalFrame(); this.jInternalFrameOrderByParametroTesoreriaDefecto= new OrderByJInternalFrame(); this.jScrollPanelOrderByParametroTesoreriaDefecto = new JScrollPane(); //PANEL_CONTROLES //this.jScrollColumnasSelectReporteParametroTesoreriaDefecto= new JScrollPane(); //JINTERNAL FRAME OrderBy this.jInternalFrameOrderByParametroTesoreriaDefecto.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); this.jInternalFrameOrderByParametroTesoreriaDefecto.setjInternalFrameParent(this); this.jInternalFrameOrderByParametroTesoreriaDefecto.setTitle("Orden"); this.jInternalFrameOrderByParametroTesoreriaDefecto.setSize(iWidthOrderBy+70,iHeightOrderBy+100); this.jInternalFrameOrderByParametroTesoreriaDefecto.setLocation(xOffset*(openFrameCount + Constantes.INUM_MAX_VENTANAS_DET_X), yOffset*(openFrameCount+Constantes.INUM_MAX_VENTANAS_DET_Y)); this.jInternalFrameOrderByParametroTesoreriaDefecto.setResizable(true); this.jInternalFrameOrderByParametroTesoreriaDefecto.setClosable(true); this.jInternalFrameOrderByParametroTesoreriaDefecto.setMaximizable(true); //FuncionesSwing.setBoldPanel(this.jInternalFrameOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; //SCROLL PANEL this.jScrollPanelOrderByParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jScrollPanelOrderByParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); this.jScrollPanelOrderByParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthOrderBy,iHeightOrderBy)); FuncionesSwing.setBoldScrollPanel(this.jScrollPanelOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.jScrollPanelOrderByParametroTesoreriaDefecto.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos Parametro Tesoreria Defectos")); //DATOS TOTALES this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iPosYOrderBy++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iPosXOrderBy; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.BOTH; //this.gridBagConstraintsParametroTesoreriaDefecto.ipady =150; this.jPanelOrderByParametroTesoreriaDefecto.add(jScrollPanelDatosParametroTesoreriaDefectoOrderBy, this.gridBagConstraintsParametroTesoreriaDefecto);//this.jTableDatosParametroTesoreriaDefectoTotales //BOTON CERRAR this.jButtonCerrarOrderByParametroTesoreriaDefecto = new JButtonMe(); this.jButtonCerrarOrderByParametroTesoreriaDefecto.setText("Salir"); FuncionesSwing.addImagenButtonGeneral(this.jButtonCerrarOrderByParametroTesoreriaDefecto,"cerrar","Salir");//cerrar_reporte_dinamico_button this.jButtonCerrarOrderByParametroTesoreriaDefecto.setToolTipText("Cancelar"+" "+ParametroTesoreriaDefectoConstantesFunciones.SCLASSWEBTITULO); FuncionesSwing.setBoldButton(this.jButtonCerrarOrderByParametroTesoreriaDefecto, STIPO_TAMANIO_GENERAL,false,true,this);; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.VERTICAL; this.gridBagConstraintsParametroTesoreriaDefecto.gridy = iPosYOrderBy++; this.gridBagConstraintsParametroTesoreriaDefecto.gridx = iPosXOrderBy; this.jPanelOrderByParametroTesoreriaDefecto.add(this.jButtonCerrarOrderByParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); //GLOBAL AGREGAR PANELES GridBagLayout gridaBagLayoutOrderByPrincipalParametroTesoreriaDefecto = new GridBagLayout(); this.jScrollPanelOrderByParametroTesoreriaDefecto= new JScrollPane(jPanelOrderByParametroTesoreriaDefecto,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); iPosXOrderBy=0; iPosYOrderBy=0; this.gridBagConstraintsParametroTesoreriaDefecto = new GridBagConstraints(); this.gridBagConstraintsParametroTesoreriaDefecto.gridy =iPosYOrderBy; this.gridBagConstraintsParametroTesoreriaDefecto.gridx =iPosXOrderBy; this.gridBagConstraintsParametroTesoreriaDefecto.fill = GridBagConstraints.BOTH; this.jInternalFrameOrderByParametroTesoreriaDefecto.setContentPane(new JPanelMe(FuncionesSwing.getFondoImagen(parametroGeneralUsuario.getid_tipo_fondo()),true)); this.jInternalFrameOrderByParametroTesoreriaDefecto.getContentPane().setLayout(gridaBagLayoutOrderByPrincipalParametroTesoreriaDefecto); this.jInternalFrameOrderByParametroTesoreriaDefecto.getContentPane().add(this.jScrollPanelOrderByParametroTesoreriaDefecto, this.gridBagConstraintsParametroTesoreriaDefecto); } else { this.jButtonAbrirOrderByParametroTesoreriaDefecto = new JButtonMe(); } } */ public void redimensionarTablaDatos(int iNumFilas) { this.redimensionarTablaDatos(iNumFilas,0); } public void redimensionarTablaDatos(int iNumFilas,int iTamanioFilaTabla) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int iWidthTable=screenSize.width*2;//screenSize.width - (screenSize.width/8); int iWidthTableScroll=screenSize.width - (screenSize.width/8); int iWidthTableCalculado=0;//730 int iHeightTable=0;//screenSize.height/3; int iHeightTableTotal=0; //ANCHO COLUMNAS SIMPLES iWidthTableCalculado+=330; //ANCHO COLUMNAS OCULTAS if(Constantes.ISDEVELOPING) { iWidthTableCalculado+=400; } //ANCHO COLUMNAS RELACIONES iWidthTableCalculado+=0; //ESPACION PARA SELECT RELACIONES if(this.conMaximoRelaciones && this.parametrotesoreriadefectoSessionBean.getConGuardarRelaciones() ) { } //SI CALCULADO ES MENOR QUE MAXIMO /* if(iWidthTableCalculado<=iWidthTable) { iWidthTable=iWidthTableCalculado; } */ //SI TABLA ES MENOR QUE SCROLL if(iWidthTableCalculado<=iWidthTableScroll) { iWidthTableScroll=iWidthTableCalculado; } //NO VALE SIEMPRE PONE TAMANIO COLUMNA 200 /* int iTotalWidth=0; int iWidthColumn=0; int iCountColumns=this.jTableDatosParametroTesoreriaDefecto.getColumnModel().getColumnCount(); if(iCountColumns>0) { for(int i = 0; i < this.jTableDatosParametroTesoreriaDefecto.getColumnModel().getColumnCount(); i++) { TableColumn column = this.jTableDatosParametroTesoreriaDefecto.getColumnModel().getColumn(i); iWidthColumn=column.getWidth(); iTotalWidth+=iWidthColumn; } //iWidthTableCalculado=iTotalWidth; } */ if(iTamanioFilaTabla<=0) { iTamanioFilaTabla=this.jTableDatosParametroTesoreriaDefecto.getRowHeight();//ParametroTesoreriaDefectoConstantesFunciones.ITAMANIOFILATABLA; } if(iNumFilas>0) { iHeightTable=(iNumFilas * iTamanioFilaTabla); } else { iHeightTable=iTamanioFilaTabla; } iHeightTableTotal=iHeightTable; if(!this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()) { if(iHeightTable > ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) { //SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O if(!this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.isSelected()) { iHeightTable=ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS; } else { iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30); } } else { if(iHeightTable < ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) { iHeightTable=ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOS; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS; } } } else { if(iHeightTable > ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL) { //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS) { //SI SE SELECCIONA MAXIMO TABLA SE AMPLIA A ALTO MAXIMO DE SCROLL, PARA QUE SCROLL NO SEA TAN PEQUE?O if(!this.jCheckBoxConAltoMaximoTablaParametroTesoreriaDefecto.isSelected()) { iHeightTable=ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MAXIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMAXIMO_TABLADATOS; } else { iHeightTable=iHeightTableTotal + FuncionesSwing.getValorProporcion(iHeightTableTotal,30); } } else { if(iHeightTable < ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL) {//Constantes.ISWING_TAMANIOMINIMO_TABLADATOS) { iHeightTable=ParametroTesoreriaDefectoConstantesFunciones.TAMANIO_ALTO_MINIMO_TABLADATOSREL; //Constantes.ISWING_TAMANIOMINIMO_TABLADATOS; } } } //OJO:SE DESHABILITA CALCULADO //NO SE UTILIZA CALCULADO SI POR DEFINICION if(iWidthTableDefinicion>0) { iWidthTableCalculado=iWidthTableDefinicion; } this.jTableDatosParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal)); this.jTableDatosParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthTableCalculado,iHeightTableTotal)); this.jTableDatosParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthTableCalculado,iHeightTableTotal));//iWidthTable this.jScrollPanelDatosParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable)); this.jScrollPanelDatosParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable)); this.jScrollPanelDatosParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable)); //ORDER BY //OrderBy int iHeightTableOrderBy=0; int iNumFilasOrderBy=this.arrOrderBy.size(); int iTamanioFilaTablaOrderBy=0; if(this.jInternalFrameOrderByParametroTesoreriaDefecto!=null && this.jInternalFrameOrderByParametroTesoreriaDefecto.getjTableDatosOrderBy()!=null) { //if(!this.parametrotesoreriadefectoSessionBean.getEsGuardarRelacionado()) { iTamanioFilaTablaOrderBy=this.jInternalFrameOrderByParametroTesoreriaDefecto.getjTableDatosOrderBy().getRowHeight(); if(iNumFilasOrderBy>0) { iHeightTableOrderBy=iNumFilasOrderBy * iTamanioFilaTablaOrderBy; } else { iHeightTableOrderBy=iTamanioFilaTablaOrderBy; } this.jInternalFrameOrderByParametroTesoreriaDefecto.getjTableDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTableCalculado/4 this.jInternalFrameOrderByParametroTesoreriaDefecto.getjTableDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy)); this.jInternalFrameOrderByParametroTesoreriaDefecto.getjTableDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY,iHeightTableOrderBy));//iWidthTable this.jInternalFrameOrderByParametroTesoreriaDefecto.getjScrollPanelDatosOrderBy().setMinimumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY));//iHeightTableOrderBy,iWidthTableScroll this.jInternalFrameOrderByParametroTesoreriaDefecto.getjScrollPanelDatosOrderBy().setMaximumSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY)); this.jInternalFrameOrderByParametroTesoreriaDefecto.getjScrollPanelDatosOrderBy().setPreferredSize(new Dimension(Constantes2.ISWING_TAMANIO_ANCHO_TABLADATOS_ORDERBY+30,Constantes2.ISWING_TAMANIO_ALTO_TABLADATOS_ORDERBY)); } //ORDER BY //this.jScrollPanelDatosParametroTesoreriaDefecto.setMinimumSize(new Dimension(iWidthTableScroll,iHeightTable)); //this.jScrollPanelDatosParametroTesoreriaDefecto.setMaximumSize(new Dimension(iWidthTableScroll,iHeightTable)); //this.jScrollPanelDatosParametroTesoreriaDefecto.setPreferredSize(new Dimension(iWidthTableScroll,iHeightTable)); //VERSION 0 /* //SI CALCULADO ES MENOR QUE MAXIMO if(iWidthTableCalculado<=iWidthTable) { iWidthTable=iWidthTableCalculado; } //SI TABLA ES MENOR QUE SCROLL if(iWidthTable<=iWidthTableScroll) { iWidthTableScroll=iWidthTable; } */ } public void redimensionarTablaDatosConTamanio(int iTamanioFilaTabla) throws Exception { int iSizeTabla=0; //ARCHITECTURE if(Constantes.ISUSAEJBLOGICLAYER) { iSizeTabla=parametrotesoreriadefectoLogic.getParametroTesoreriaDefectos().size(); } else if(Constantes.ISUSAEJBREMOTE || Constantes.ISUSAEJBHOME) { iSizeTabla=parametrotesoreriadefectos.size(); } //ARCHITECTURE this.redimensionarTablaDatos(iSizeTabla,iTamanioFilaTabla); } //PARA REPORTES public static List<ParametroTesoreriaDefecto> TraerParametroTesoreriaDefectoBeans(List<ParametroTesoreriaDefecto> parametrotesoreriadefectos,ArrayList<Classe> classes)throws Exception { try { for(ParametroTesoreriaDefecto parametrotesoreriadefecto:parametrotesoreriadefectos) { if(!(ParametroTesoreriaDefectoConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_GENERICO) || ParametroTesoreriaDefectoConstantesFunciones.S_TIPOREPORTE_EXTRA.equals(Constantes2.S_REPORTE_EXTRA_GROUP_TOTALES_GENERICO)) ) { parametrotesoreriadefecto.setsDetalleGeneralEntityReporte(ParametroTesoreriaDefectoConstantesFunciones.getParametroTesoreriaDefectoDescripcion(parametrotesoreriadefecto)); } else { //parametrotesoreriadefecto.setsDetalleGeneralEntityReporte(parametrotesoreriadefecto.getsDetalleGeneralEntityReporte()); } //parametrotesoreriadefectobeans.add(parametrotesoreriadefectobean); } } catch(Exception ex) { throw ex; } return parametrotesoreriadefectos; } //PARA REPORTES FIN }
53.05819
399
0.828837
53bb9424d6e29b06197f63b7eb00c59fc67dc774
585
package cn.edu.ccit.JavaEEsx.zh04.sxcsglxt.model; public class RoleMenu { private Long pkRmid; private Long pkRid; private Long pkMid; public Long getPkRmid() { return pkRmid; } public void setPkRmid(Long pkRmid) { this.pkRmid = pkRmid; } public Long getPkRid() { return pkRid; } public void setPkRid(Long pkRid) { this.pkRid = pkRid; } public Long getPkMid() { return pkMid; } public void setPkMid(Long pkMid) { this.pkMid = pkMid; } }
17.727273
50
0.555556
b4bd5612e903e62896a27e5b244eba31e7b91b3a
937
package parser; import static org.junit.Assert.assertEquals; import java.awt.*; import org.junit.Test; /** * Created by jhellinckx on 11/05/16. */ public class TikzColorsTest { @Test public void testNearestColors() throws Exception { Color expectedColor = new Color(0x80, 0x80, 0x00); Color closeToExpected = new Color(0x80, 0x80, 0x03); assertEquals(expectedColor, TikzColors.nearestTikzColor(closeToExpected)); } @Test public void testString2Color() throws Exception { Color expectedColor = new Color(0x00, 0x80, 0x80); String colorString = "teal"; assertEquals(expectedColor, TikzColors.StringToColor(colorString)); } @Test public void testColor2String() throws Exception { Color color = new Color(0x00, 0x80, 0x80); String expectedString = "teal"; assertEquals(expectedString, TikzColors.ColorToString(color)); } }
26.027778
82
0.683031
6effce579a1c21a3f45a225c64be4febb0966320
486
package org.finos.symphony.practice.rsanag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Configuration; import org.springframework.mail.MailSender; @SpringBootApplication @Configuration public class Main { public static void main(String[] args) { SpringApplication.run(Main.class, args); } }
24.3
68
0.829218
1156638a9037fea1ce0e863a3879086c809b11d6
2,720
//Deobfuscated with https://github.com/SimplyProgrammer/Minecraft-Deobfuscator3000 using mappings "C:\Users\u1\Documents\Java Decompiler\1.12 stable mappings"! //Decompiled by Procyon! package com.veteran.hack.gui.kami.theme.kami; import com.veteran.hack.gui.rgui.component.use.*; import com.veteran.hack.gui.rgui.render.*; import com.veteran.hack.gui.rgui.render.font.*; import com.veteran.hack.util.*; import org.lwjgl.opengl.*; import com.veteran.hack.gui.kami.*; import com.veteran.hack.gui.rgui.component.container.*; import com.veteran.hack.gui.rgui.component.*; public class RootCheckButtonUI<T extends CheckButton> extends AbstractComponentUI<CheckButton> { @Override public void renderComponent(final CheckButton component, final FontRenderer ff) { GL11.glColor4f(ColourConverter.toF(ColourSet.bgColour.getRed()), ColourConverter.toF(ColourSet.bgColour.getGreen()), ColourConverter.toF(ColourSet.bgColour.getBlue()), component.getOpacity()); if (component.isToggled()) { GL11.glColor3f(ColourConverter.toF(ColourSet.bgColourOther), ColourConverter.toF(ColourSet.bgColour.getGreen()), ColourConverter.toF(ColourSet.bgColour.getBlue())); } if (component.isHovered() || component.isPressed()) { GL11.glColor4f(ColourConverter.toF(ColourSet.bgColourHover.getRed()), ColourConverter.toF(ColourSet.bgColourHover.getGreen()), ColourConverter.toF(ColourSet.bgColourHover.getBlue()), component.getOpacity()); } final String text = component.getName(); int c = component.isPressed() ? ColourConverter.rgbToInt(ColourSet.buttonPressed.getRed(), ColourSet.buttonPressed.getGreen(), ColourSet.buttonPressed.getBlue()) : (component.isToggled() ? ColourConverter.rgbToInt(ColourSet.buttonIdleT.getRed(), ColourSet.buttonIdleT.getGreen(), ColourSet.buttonIdleT.getBlue()) : ColourConverter.rgbToInt(ColourSet.buttonHoveredT.getRed(), ColourSet.buttonHoveredT.getGreen(), ColourSet.buttonHoveredT.getBlue())); if (component.isHovered()) { c = (c & ColourConverter.rgbToInt(ColourSet.buttonHoveredN.getRed(), ColourSet.buttonHoveredN.getGreen(), ColourSet.buttonHoveredN.getBlue())) << 1; } GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glEnable(3553); KamiGUI.fontRenderer.drawString(0, KamiGUI.fontRenderer.getFontHeight() / 2 - 2, c, text); GL11.glDisable(3553); GL11.glDisable(3042); } @Override public void handleAddComponent(final CheckButton component, final Container container) { component.setWidth(KamiGUI.fontRenderer.getStringWidth(component.getName()) + 28); component.setHeight(KamiGUI.fontRenderer.getFontHeight() + 2); } }
60.444444
457
0.740809
353799abf6cff988a742b1f1d7d37342bdc4e3ec
554
package org.simplity.fm.example.gen.list; import org.simplity.fm.core.validn.RuntimeList; public class SubjectTypeList extends RuntimeList { private static final String NAME = "subjectTypeList"; private static final String LIST_SQL = "SELECT subject_type_id, name FROM subject_types"; private static final String CHECK_SQL = "SELECT subject_type_id FROM subject_types WHERE subject_type_id=?"; /** * */ public SubjectTypeList() { this.name = NAME; this.listSql = LIST_SQL; this.checkSql = CHECK_SQL; this.valueIsNumeric = true; } }
30.777778
110
0.759928
a9e915ec5a70b5b78658f8dca1f10f846f49fe35
774
package com.google.android.gms.internal.ads; /* compiled from: com.google.android.gms:play-services-ads@@19.4.0 */ public final class zzdpr implements zzeoy<zzdpn> { private final zzeph<zzdpl> zzfoh; private final zzdpp zzhgo; private final zzeph<String> zzhgp; private zzdpr(zzdpp zzdpp, zzeph<zzdpl> zzeph, zzeph<String> zzeph2) { this.zzhgo = zzdpp; this.zzfoh = zzeph; this.zzhgp = zzeph2; } public static zzdpr zza(zzdpp zzdpp, zzeph<zzdpl> zzeph, zzeph<String> zzeph2) { return new zzdpr(zzdpp, zzeph, zzeph2); } public final /* synthetic */ Object get() { return (zzdpn) zzepe.zza(this.zzfoh.get().zzgv(this.zzhgp.get()), "Cannot return null from a non-@Nullable @Provides method"); } }
33.652174
134
0.666667
a1cbe8aa510d3abd210e6d8669a9d22952fd607f
6,010
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package zoo; import renderable.Renderable; import airHabitat.AirHabitat; import cell.Cell; import entrance.Entrance; import exit.Exit; import landHabitat.LandHabitat; import park.Park; import restaurant.Restaurant; import road.Road; import waterHabitat.WaterHabitat; /** * * @author Rizky Faramita 13515055@std.stei.itb.ac.id * @version 1.1 (current version number of program) * @since 1.1 (the version of the package this class was first added to) */ public class Zoo { /** * height dari matriks */ public final int nbaris; /** * width dari matriks */ public final int nkolom; /** * matriks untuk menyimpan map Zoo dari file eksternal */ private Cell[][] input_matrix; /** * matriks untuk mencetak map Zoo setelah transformasi */ private char[][] output_matrix; /** * ctor tanpa parameter */ public Zoo(){ this.nbaris = 1; this.nkolom = 1; input_matrix = new Cell[1][1]; input_matrix[1][1] = new Cell(); output_matrix = new char[1][1]; } /** * ctor dengan dua parameter * @param nbrs Description masukan untuk nbaris * @param nkol Description masukan untuk nkolom */ public Zoo(int nbrs, int nkol){ this.nbaris = nbrs; this.nkolom = nkol; input_matrix = new Cell[nkolom][nbaris]; for (int i = 0;i<nkolom;i++) { for (int j = 0;j<nbaris;j++) { input_matrix[i][j] = new Cell(); } } output_matrix = new char[nkolom][nbaris]; } /** * cctor * @param z objek zoo yang akan di-assign */ public Zoo(final Zoo z){ this.nbaris = z.nbaris; this.nkolom = z.nkolom; input_matrix = new Cell[nkolom][nbaris]; for (int i = 0; i < nbaris; i++) { System.arraycopy(z.input_matrix[i], 0, input_matrix[i], 0, nkolom); } } /** * getter * @param x absis * @param y ordinat * @return nilai ell */ public int getElementZoo(int x, int y){ return input_matrix[x][y].getNilaiCell(); } /** * getter output_matrix * @param x absis * @param y ordinat * @return char pada indeks ke x,y */ public char getOutputMatrix(int x, int y) { return output_matrix[x][y]; } /** * mencetak map ke layar * @param nbrs Description masukan untuk baris * @param nkol Description masukan untuk kolom */ public void printZoo(int nbrs, int nkol){ LandHabitat land_habitat = new LandHabitat(); WaterHabitat water_habitat = new WaterHabitat(); AirHabitat air_habitat = new AirHabitat(); Road road = new Road(); Park park = new Park(); Restaurant restaurant = new Restaurant(); Entrance entrance = new Entrance(); Exit exit = new Exit(); for (int i = 0; i < nbrs; i++) { for (int j = 0; j < nkol; j++) { switch (getElementZoo(i,j)) { case 1: land_habitat.render(); break; case 2: air_habitat.render(); break; case 3: water_habitat.render(); break; case -1: road.render(); break; case -2: park.render(); break; case -3: restaurant.render(); break; case -4: entrance.render(); break; case -5: exit.render(); break; default: break; } } } for (int i = 0; i < nbrs; i++) { for (int j = 0; j < nkolom; j++) { System.out.print(output_matrix[i][j]); } System.out.println(""); } System.out.println("Legenda; "); System.out.println("+ = Land Habitat" + " " + "# = Road"); System.out.println("@ = Air Habitat" + " " + "~ = Park"); System.out.println("$ = Water Habitat" + " " + "& = Restaurant"); } /** * setter elemen Zoo * @param x absis * @param y ordinat * @param k elemen zoo */ public void setElementZoo(int x, int y, int k){ LandHabitat land_habitat = new LandHabitat(); WaterHabitat water_habitat = new WaterHabitat(); AirHabitat air_habitat = new AirHabitat(); Road road = new Road(); Park park = new Park(); Restaurant restaurant = new Restaurant(); Entrance entrance = new Entrance(); Exit exit = new Exit(); switch (k) { case 1: input_matrix[x][y] = land_habitat; break; case 2: input_matrix[x][y] = water_habitat; break; case 3: input_matrix[x][y] = air_habitat; break; case -1: input_matrix[x][y] = road; break; case -2: input_matrix[x][y] = park; break; case -3: input_matrix[x][y] = restaurant; break; case -4: input_matrix[x][y] = entrance; break; case -5: input_matrix[x][y] = exit; break; default: break; } } }
28.349057
79
0.479035
d1edbb858fe61dc0b4a944765969cf093f8ccda6
3,654
package com.chutneytesting.tools.loader; import static com.chutneytesting.tools.loader.ExtensionLoaders.Mappers.instantiate; import static com.chutneytesting.tools.loader.ExtensionLoaders.Mappers.splitByLine; import static com.chutneytesting.tools.loader.ExtensionLoaders.Sources.classpath; import com.google.common.io.CharStreams; import com.chutneytesting.tools.loader.ExtensionLoader.ExtensionLoaderSource; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.net.URL; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; import com.chutneytesting.tools.ThrowingFunction; /** * Reference common {@link ExtensionLoader ExtensionLoaders}. */ public abstract class ExtensionLoaders { private ExtensionLoaders() { } /** * @param path to config files to read * @return and extension loader behaving like {@link java.util.ServiceLoader} except it loads classes instead of instances */ public static ExtensionLoader<Class<?>> classpathToClass(String path) { return ExtensionLoader.Builder .<String, Class<?>>withSource(classpath(path)) .withMapper(splitByLine().andThen(instantiate())); } /** * Reference common {@link ExtensionLoaderSource ExtensionLoaderSources}. */ public static abstract class Sources { private Sources() { } /** * @param path to the files to load from in classpath * @return an {@link ExtensionLoaderSource} */ public static ExtensionLoaderSource<String> classpath(String path) { return () -> { try { Set<String> sources = new HashSet<>(); for (URL url : Collections.list(ExtensionLoaders.class.getClassLoader().getResources(path))) { try (InputStream is = url.openStream()) { sources.add(CharStreams.toString(new InputStreamReader(is))); } } return sources; } catch (IOException e) { throw new UncheckedIOException(e); } }; } } /** * Reference common {@link Function Functions} usable as mapper for {@link ExtensionLoader}. */ public static abstract class Mappers { private Mappers() { } /** * @return a function splitting {@link String} by line, ignoring comments starting with '#' character */ public static Function<String, Set<String>> splitByLine() { return splitByLineIgnoring("#"); } /** * @return a function splitting {@link String} by line, ignoring comments starting with the given character */ public static Function<String, Set<String>> splitByLineIgnoring(String commentMarker) { return document -> Arrays .stream(document.split("\\r?\\n")) .filter(line -> !line.trim().startsWith(commentMarker) && !line.trim().isEmpty()) .collect(Collectors.toSet()); } /** * @return a function mapping a {@link Set} of {@link String} to a {@link Set} of {@link Class} */ public static Function<Set<String>, Set<Class<?>>> instantiate() { return classnames -> classnames.stream().map(ThrowingFunction.toUnchecked(Class::forName)).collect(Collectors.toSet()); } } }
36.909091
131
0.629721
7e522f26b8856f0fe3dfefcd74517deb42ef03cd
3,181
/******************************************************************************* * * Copyright (C) 2015-2021 the BBoxDB project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *******************************************************************************/ package org.bboxdb; import java.util.ArrayList; import java.util.List; import org.bboxdb.commons.concurrent.ThreadHelper; import org.junit.Assert; import org.junit.Test; public class TestThreadHelper { @Test(timeout=60000) public void testEmptyList() { final List<Thread> threads = new ArrayList<>(); final List<Thread> result = ThreadHelper.stopThreads(threads); Assert.assertTrue(result.isEmpty()); } @Test(timeout=60000) public void testThreadInterruptable() { final Thread thread = getInterruptibleThread(); final List<Thread> threads = new ArrayList<>(); threads.add(thread); final List<Thread> result = ThreadHelper.stopThreads(threads); Assert.assertTrue(result.isEmpty()); } @Test(timeout=20000) public void testThreadInterruptable2() { final Thread thread = getNonInterruptibleThread(); final List<Thread> threads = new ArrayList<>(); threads.add(thread); // This call need a test with timeout, because otherwise // we will interrupt the regular testcase thread Thread.currentThread().interrupt(); final List<Thread> result = ThreadHelper.stopThreads(threads); Assert.assertFalse(result.isEmpty()); } @Test(timeout=20000) public void testThreadNonInterruptable() { final Thread thread = getNonInterruptibleThread(); final List<Thread> threads = new ArrayList<>(); threads.add(thread); final List<Thread> result = ThreadHelper.stopThreads(threads); Assert.assertEquals(1, result.size()); Assert.assertTrue(result.contains(thread)); } /** * Get a interruptible thread * @return */ protected Thread getInterruptibleThread() { final Thread thread = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(10000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } }); thread.start(); return thread; } /** * Get a non interruptible thread. A non interruptible * task 10 * THREAD_WAIT_TIMEOUT * @return */ protected Thread getNonInterruptibleThread() { final Thread thread = new Thread(new Runnable() { @Override public void run() { for(int i = 0; i < 10; i++) { try { Thread.sleep(ThreadHelper.THREAD_WAIT_TIMEOUT); } catch (InterruptedException e) { // Ignore } } } }); thread.start(); return thread; } }
27.66087
81
0.65734
9fb48a8ff47a88c834ed43070a087e398ccaf103
847
package system.web.file; /** * * @author ik */ public class FI { /** * 上传的文件名 */ public String fileName; /** * 加工后的文件名 */ public String saveName; /** * 保证的路径(相对项目的绝对路径) */ public String path_saveName; /** * 是否上传成功 */ public boolean isok = false; /** * 信息 */ public String message; @Override public String toString() { return new StringBuilder() .append("{\"fileName\":\"").append(fileName) .append("\",\"saveName\":\"").append(saveName) .append("\",\"path_fileName\":\"").append(path_saveName) .append("\",\"isok\":\"").append(isok) .append("\",\"message\":\"").append(message).append("\"}").toString(); } }
21.175
87
0.455726
863e276cd5f664e481a49663ddf810630b8439ad
1,088
package no.rosbach.jcoru.rest.facade; import no.rosbach.jcoru.rest.JavaSourceStringDto; import no.rosbach.jcoru.rest.reports.CompilationReport; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; import java.util.*; import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @SpringBootTest public class CompilerResourceTest extends CompilerResourceTestBase { @Resource private CompilerResource compilerResource; @Test public void compilerReturnsSuccessReport() { CompilationReport result = compile(Arrays.asList(TEST_CLASS_SOURCE, TEST_CLASS_I_SOURCE)); assertTrue(result.isSuccess()); } @Test public void returnsSuccessForEmptyList() { CompilationReport report = compile(Collections.emptyList()); assertTrue(report.isSuccess()); } @Override protected CompilationReport compile(List<JavaSourceStringDto> sources) { return compilerResource.compilePost(sources); } }
28.631579
94
0.799632
c1bc6fa39045f7dd2e933430567bca22430568b0
81
package ${package}.constant; /** * Value Constants */ public interface V { }
9
28
0.641975
a3d76be43703f08e33d0506b061a9a189d7432cf
2,203
package com.hl.module_location.view.adapter; import android.content.Context; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.hl.base_module.adapter.BaseMulViewHolder; import com.hl.base_module.adapter.BaseMutilayoutAdapter; import com.hl.lib_miniui.view.texts.Text_LightBg; import com.hl.module_location.R; import com.hl.module_location.model.bean.AddressListBean; import java.util.List; public class AddressListAdapter extends BaseMutilayoutAdapter<AddressListBean> { public AddressListAdapter(Context context, List<AddressListBean> datas) { super(context, datas); } @Override protected BaseMulViewHolder getHolder(Context context, ViewGroup parent, int viewType) throws Exception { return new BaseMulViewHolder<AddressListBean>(LayoutInflater.from(context).inflate(R.layout.activity_location_list_item, parent, false)); } @Override protected void handleHolder(Context context, BaseMulViewHolder baseHolder, int viewType) { } @Override protected void bindData(Context context, BaseMulViewHolder baseHolder, AddressListBean addressList, int postion, int itemViewType) { baseHolder.setText(R.id.alli_addrName, addressList.getAddressName()); baseHolder.setText(R.id.alli_addrPhone, addressList.getAddressPhone()); baseHolder.setText(R.id.alli_addrSiteInfo, addressList.getSiteInfo()); // 是否是默认地址 if (1 == addressList.getIsDefault()) { baseHolder.setVisible(R.id.alli_isDefaultPic, View.VISIBLE); baseHolder.setVisible(R.id.alli_addrDefultState, View.VISIBLE); } else { baseHolder.setVisible(R.id.alli_isDefaultPic, View.GONE); baseHolder.setVisible(R.id.alli_addrDefultState, View.GONE); } if (!TextUtils.isEmpty(addressList.getLabelName())){ Text_LightBg text_lightBg = (Text_LightBg) baseHolder.getView(R.id.alli_addrHomeCompany); text_lightBg.updateText(addressList.getLabelName()); } addOnItemClickListener(baseHolder.getView(R.id.alli_editorPic), postion, addressList, itemViewType, null); } }
43.196078
145
0.746709
27950c1e0cd2bd743c230851fd55a045d8c9fa25
1,384
package org.hswebframework.web.dictionary.starter; import org.hswebframework.web.dao.Dao; import org.hswebframework.web.dict.DictDefineRepository; import org.hswebframework.web.dict.DictSupportApi; import org.hswebframework.web.dict.defaults.DefaultDictSupportApi; import org.hswebframework.web.dictionary.api.builder.DictionaryParserBuilder; import org.hswebframework.web.dictionary.simple.builder.SimpleDictionaryParserBuilder; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /** * @author zhouhao */ @Configuration @ComponentScan({"org.hswebframework.web.dictionary.simple" , "org.hswebframework.web.controller.dictionary"}) @MapperScan(value = "org.hswebframework.web.dictionary.simple.dao",markerInterface = Dao.class) public class DictionaryFactoryAutoConfiguration { @Bean @ConditionalOnMissingBean(DictionaryParserBuilder.class) public DictionaryParserBuilder dictionaryParserBuilder() { return new SimpleDictionaryParserBuilder(); } @Bean public DictSupportApi dictSupportApi(DictDefineRepository repository) { return new DefaultDictSupportApi(repository); } }
40.705882
95
0.820809
db5cdc971c9cdcbea8d696fea33268ed489c8b0e
1,288
package com.datacloudsec.core.sink; import com.datacloudsec.config.Context; import com.datacloudsec.config.Event; import com.datacloudsec.config.EventDeliveryException; import com.datacloudsec.core.Channel; import com.datacloudsec.core.conf.Configurable; import com.datacloudsec.core.instrumentation.SinkCounter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LoggerSink extends AbstractSink implements Configurable { private static final Logger logger = LoggerFactory.getLogger(LoggerSink.class); @Override public void configure(Context context) { // no oper } @Override public Status process() throws EventDeliveryException { Status result = Status.READY; Channel channel = getChannel(); Event event = null; try { event = channel.take(); if (event != null) { logger.info("Event: " + event.valueMapToJSONString()); } else { result = Status.BACKOFF; } } catch (Exception ex) { throw new EventDeliveryException("Failed to log event: " + event, ex); } finally { } return result; } @Override public SinkCounter getSinkCounter() { return null; } }
26.833333
83
0.650621
535cebd946a07d0b948216ec07ebba48687e1736
4,152
package de.dm.intellij.bndtools.parser; import com.intellij.codeInsight.daemon.JavaErrorMessages; import com.intellij.lang.annotation.AnnotationHolder; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiDirectory; import com.intellij.psi.PsiReference; import de.dm.intellij.bndtools.psi.BndHeader; import de.dm.intellij.bndtools.psi.BndHeaderValue; import de.dm.intellij.bndtools.psi.BndHeaderValuePart; import de.dm.intellij.bndtools.psi.Clause; import de.dm.intellij.bndtools.psi.util.BndPsiUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; public class BasePackageParser extends BndHeaderParser { public static final BasePackageParser INSTANCE = new BasePackageParser(); @NotNull @Override public PsiReference[] getReferences(@NotNull BndHeaderValuePart bndHeaderValuePart) { //TODO add test to resolve reference if (bndHeaderValuePart.getParent() instanceof Clause) { return BndPsiUtil.getPackageReferences(bndHeaderValuePart); } return PsiReference.EMPTY_ARRAY; } @Override public boolean annotate(@NotNull BndHeader bndHeader, @NotNull AnnotationHolder annotationHolder) { boolean annotated = false; for (BndHeaderValue bndHeaderValue : bndHeader.getBndHeaderValues()) { if (bndHeaderValue instanceof Clause) { Clause clause = (Clause)bndHeaderValue; BndHeaderValuePart bndHeaderValuePart = clause.getValue(); if (bndHeaderValuePart != null) { String packageName = bndHeaderValuePart.getUnwrappedText(); packageName = StringUtil.trimEnd(packageName, ".*"); if (StringUtil.isEmptyOrSpaces(packageName)) { annotationHolder.createErrorAnnotation( bndHeaderValuePart.getHighlightingRange(), "Invalid reference" ); annotated = true; continue; } packageName = packageName.trim(); if (packageName.charAt(0) == '!') { packageName = packageName.substring(1); } if (! "*".equals(packageName)) { PsiDirectory[] psiDirectories = BndPsiUtil.resolvePackage(bndHeader, packageName); if (psiDirectories.length == 0) { annotationHolder.createErrorAnnotation( bndHeaderValuePart.getHighlightingRange(), JavaErrorMessages.message("cannot.resolve.package", packageName) ); annotated = true; } } } } } return annotated; } @Nullable @Override public Object getConvertedValue(@NotNull BndHeader bndHeader) { List<BndHeaderValue> bndHeaderValues = bndHeader.getBndHeaderValues(); if (! bndHeaderValues.isEmpty()) { List<String> packages = new ArrayList<>(); for (BndHeaderValue bndHeaderValue : bndHeaderValues) { if (bndHeaderValue instanceof Clause) { Clause clause = (Clause) bndHeaderValue; BndHeaderValuePart bndHeaderValuePart = clause.getValue(); if (bndHeaderValuePart != null) { String packageName = bndHeaderValuePart.getText(); packageName = packageName.replaceAll("\\s+", ""); packageName = packageName.trim(); if (packageName.charAt(0) == '!') { packageName = packageName.substring(1); } packages.add(packageName); } } } return packages; } return null; } }
34.6
106
0.573218
2a8f49b47c035b5a85a753e270ab70cf7abc666f
1,737
package com.premar.muvi.model; import com.google.gson.annotations.SerializedName; public class PersonMovie { @SerializedName("character") private String character; @SerializedName("credit_id") private String credit_id; @SerializedName("poster_path") private String poster_path; @SerializedName("id") private int id; @SerializedName("title") private String title; @SerializedName("backdrop_path") private String backdrop_path; @SerializedName("release_date") private String release_date; public String getCharacter() { return character; } public void setCharacter(String character) { this.character = character; } public String getCredit_id() { return credit_id; } public void setCredit_id(String credit_id) { this.credit_id = credit_id; } public String getPoster_path() { return poster_path; } public void setPoster_path(String poster_path) { this.poster_path = poster_path; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getBackdrop_path() { return backdrop_path; } public void setBackdrop_path(String backdrop_path) { this.backdrop_path = backdrop_path; } public String getRelease_date() { return release_date; } public void setRelease_date(String release_date) { this.release_date = release_date; } }
20.927711
57
0.614277
1b2b0a95d739e5d08daae4ec7a4b01edff3177cf
879
import java.util.Scanner; /** * @author Kamil Çoban * @since 11.10.2019 */ public class AlanBulma { public static void main(String[]args){ Scanner k= new Scanner(System.in); System.out.println("Lütfen birinci kenarı gininiz."); int a= k.nextInt(); System.out.println("Lütfen ikinci kenarı giriniz."); int b= k.nextInt(); System.out.println("Lütfen üçüncü kenarı giriniz."); int c= k.nextInt(); if (a>0&&b>0&&c>0){ if (a+b>c&&b+c>a&&a+c>b){ System.out.println("Üçgen geçerlidir."); int u=(a+b+c)/2; double A=Math.sqrt(u*(u-a)*(u-c)*(u-b)); System.out.println("Üçgenin alanı:"+A); } else{ System.out.println("Üçgen geçersizdir."); } } } }
29.3
62
0.49033
3aca950e78f07791caba1867642af121501b8d7b
3,370
package com.project; import android.net.Uri; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Intent; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class Emergency extends Activity { Button b,b1,b2; AlertDialog alertDialog; Intent intent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_emergency); b=(Button)findViewById(R.id.button1); b.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub try{ String number = "102"; String uri="tel:"+ number.trim(); Intent in=new Intent(Intent.ACTION_CALL); in.setData(Uri.parse(uri)); startActivity(in); } catch(ActivityNotFoundException e){ Toast.makeText(getApplicationContext(), "error"+e, Toast.LENGTH_SHORT).show(); } } }); b1=(Button)findViewById(R.id.button2); b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub try{ String number = "100"; String uri="tel:"+ number.trim(); Intent in1=new Intent(Intent.ACTION_CALL); in1.setData(Uri.parse(uri)); startActivity(in1); }catch(ActivityNotFoundException e) { Toast.makeText(getApplicationContext(), "error"+e, Toast.LENGTH_SHORT).show(); } } }); b2=(Button)findViewById(R.id.button3); b2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub try{ String number = "101"; String uri="tel:"+ number.trim(); Intent in2=new Intent(Intent.ACTION_CALL); in2.setData(Uri.parse(uri)); startActivity(in2); } catch(ActivityNotFoundException e) { Toast.makeText(getApplicationContext(), "error"+e, Toast.LENGTH_SHORT).show(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.home_page: intent = new Intent(this, HomePageActivity.class); startActivity(intent); return true; case R.id.greetings: alertDialog = new AlertDialog.Builder(this).setMessage(R.string.greetings_text).create(); alertDialog.setTitle("Greetings"); alertDialog.show(); return true; case R.id.feedback: intent = new Intent(this, Feedback.class); startActivity(intent); return true; case R.id.credits: alertDialog = new AlertDialog.Builder(this).setMessage(R.string.credits_text).create(); alertDialog.setTitle("Credits"); alertDialog.show(); return true; default: return super.onOptionsItemSelected(item); } } }
25.338346
96
0.662611
bfd7ea80f6766b0ce2fe34b355c0522f010aaaa2
2,688
package javasmmr.zoowsome.views; import java.awt.GridLayout; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SpringLayout; public class ReptileFrame extends AbstractAnimalFormFrame { private JButton crocodilesButton; private JButton lizardButton; private JButton turtleButton; public JCheckBox migratesYesCheckBox; public JCheckBox migratesNoCheckBox; public ReptileFrame(String title) { super(title); contentPanel.setLayout(new GridLayout(0, 3, 0, 0)); JLabel canFlyLabel = new JLabel("Does it migrate?"); slPanel.putConstraint(SpringLayout.NORTH, canFlyLabel, 200, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, canFlyLabel, 90, SpringLayout.WEST, pan); pan.add(canFlyLabel); migratesYesCheckBox = new JCheckBox("Yes"); slPanel.putConstraint(SpringLayout.NORTH,migratesYesCheckBox, 220, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, migratesYesCheckBox, 90, SpringLayout.WEST, pan); pan.add(migratesYesCheckBox); migratesNoCheckBox = new JCheckBox("No"); slPanel.putConstraint(SpringLayout.NORTH,migratesNoCheckBox, 240, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, migratesNoCheckBox, 90, SpringLayout.WEST, pan); pan.add(migratesNoCheckBox); crocodilesButton = new JButton("Crocodiles"); slPanel.putConstraint(SpringLayout.NORTH, crocodilesButton, 340, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, crocodilesButton, 0, SpringLayout.WEST, pan); pan.add(crocodilesButton); lizardButton = new JButton("Lizard"); slPanel.putConstraint(SpringLayout.NORTH, lizardButton, 340, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, lizardButton, 81, SpringLayout.WEST, pan); pan.add(lizardButton); turtleButton = new JButton("Turtle"); slPanel.putConstraint(SpringLayout.NORTH, turtleButton, 340, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, turtleButton, 150, SpringLayout.WEST, pan); pan.add(turtleButton); } @Override public void goBack() { // TODO Auto-generated method stub } public void setCrocodilesButtonActionListener(ActionListener a) { crocodilesButton.addActionListener(a); } public void setLizardButtonActionListener(ActionListener a) { lizardButton.addActionListener(a); } public void setTurtleButtonActionListener(ActionListener a) { turtleButton.addActionListener(a); } public void setMigratesCheckBoxesActionListener(ActionListener a) { migratesYesCheckBox.addActionListener(a); migratesNoCheckBox.addActionListener(a); } }
33.6
94
0.790551
5932065b371bef4db4af84f78388fe29a0e8c7e1
3,089
package com.sadman.medicalinventory.controller; import com.sadman.medicalinventory.dto.IndicationDTO; import com.sadman.medicalinventory.exception.RecordNotFoundException; import com.sadman.medicalinventory.iservice.GenericService; import com.sadman.medicalinventory.iservice.IndicationService; import com.sadman.medicalinventory.model.Generic; import com.sadman.medicalinventory.model.Indication; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List; @Controller public class IndicationController { @Autowired IndicationService service; @Autowired GenericService genericService; @RequestMapping(value = "/indications") public String getAllIndications(Model model) { List<Indication> list = service.getAllIndications(); List<Generic> genericList = genericService.getAllGenerics(); model.addAttribute("indication", new Indication()); model.addAttribute("indicationdto", new IndicationDTO()); model.addAttribute("indications", list); model.addAttribute("genericList", genericList); return "indication-list"; } @GetMapping("/indications/{id}") public ResponseEntity<Indication> getIndicationById(@PathVariable(value = "id") Long indicationId) throws RecordNotFoundException { Indication indication = service.getIndicationById(indicationId); return ResponseEntity.ok(indication); } @PostMapping(value="/indications/add") public ResponseEntity<String> addGeneric(Indication indication){ service.createIndication(indication); return new ResponseEntity<>("Indication is added successfully", HttpStatus.OK); } @PutMapping("/indications/edit/{id}") public ResponseEntity<String> editGenericById(@RequestBody IndicationDTO newIndicationDTO, @PathVariable(value = "id") Long indicationId) { service.updateIndicationDTO(newIndicationDTO, indicationId); return new ResponseEntity<>("Indication is Edited Successfully", HttpStatus.OK); } // @PutMapping("/indications/edit/{id}") // public ResponseEntity<String> editGenericById(@RequestBody Indication newIndication, @PathVariable(value = "id") Long indicationId) { // service.updateIndication(newIndication, indicationId); // return new ResponseEntity<>("Indication is Edited Successfully", HttpStatus.OK); // } @DeleteMapping("/indications/delete/{id}") @ResponseBody public ResponseEntity<Object> deleteIndicationById(@PathVariable(value = "id") Long indicationId){ return service.deleteIndicationById(indicationId); } @PostMapping(value="/indications/checkName") public ResponseEntity<Boolean> checkName(String name){ boolean isName = !service.existsByName(name); return new ResponseEntity<>(isName, HttpStatus.OK); } }
40.644737
143
0.74911
dfb06c11521a6746d0c3a5fc7cc6fe76697fbbf3
3,119
package com.cy.core.serviceNewsType.entity; import com.cy.base.entity.DataEntity; import com.cy.core.news.entity.News; import java.util.List; public class ServiceNewsType extends DataEntity<ServiceNewsType> { //父id private String parentId; //类型名称 private String name; //1.新闻类别,2.链接,3.单页面 private int type; //新闻的来源,1.总会新闻,2校友会新闻 private int origin; //栏目访问地址 private String url; //排列顺序 private int orderNum; //所在地,市 private String cityName; //是否上首页 private int isMain; //是否上导航 private int isNavigation; //服务Id private String serviceId; //服务名 private String serviceName; //组织Id private String deptId; //类别 private String channel; /**--该栏目下所有新闻集合--**/ private List<News> newsList; /**--取相应的新闻web用到--**/ private String json_news_url; public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getType() { return type; } public void setType(int type) { this.type = type; } public int getOrigin() { return origin; } public void setOrigin(int origin) { this.origin = origin; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public int getOrderNum() { return orderNum; } public void setOrderNum(int orderNum) { this.orderNum = orderNum; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public int getIsMain() { return isMain; } public void setIsMain(int isMain) { this.isMain = isMain; } public int getIsNavigation() { return isNavigation; } public void setIsNavigation(int isNavigation) { this.isNavigation = isNavigation; } public String getServiceId() { return serviceId; } public void setServiceId(String serviceId) { this.serviceId = serviceId; } public String getServiceName() { return serviceName; } public void setServiceName(String serviceName) { this.serviceName = serviceName; } public String getDeptId() { return deptId; } public void setDeptId(String deptId) { this.deptId = deptId; } public String getChannel() { return channel; } public void setChannel(String channel) { this.channel = channel; } public List<News> getNewsList() { return newsList; } public void setNewsList(List<News> newsList) { this.newsList = newsList; } public String getJson_news_url() { return json_news_url; } public void setJson_news_url(String json_news_url) { this.json_news_url = json_news_url; } }
17.522472
67
0.600513
16b68777c9e50e8c1b84800302a90d924b967b96
2,748
/** * Copyright 2011 The Open Source Research Group, * University of Erlangen-Nürnberg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.fau.cs.osr.ptk.common.ast; import java.io.IOException; import de.fau.cs.osr.utils.StringTools; public abstract class AstStringNodeImpl<T extends AstNode<T>> extends AstLeafNodeImpl<T> implements AstStringNode<T> { private static final long serialVersionUID = -3995972757553601033L; protected AstStringNodeImpl(Uninitialized u) { } protected AstStringNodeImpl(String content) { setContent(content); } // ========================================================================= private String content; @Override public String getContent() { return content; } @Override public void setContent(String content) { if (content == null) throw new NullPointerException(); this.content = content; } @Override public int getPropertyCount() { return 1; } @Override public AstNodePropertyIterator propertyIterator() { return new StringContentNodePropertyIterator(); } protected class StringContentNodePropertyIterator extends AstNodePropertyIterator { @Override protected int getPropertyCount() { return 1; } @Override protected String getName(int index) { switch (index) { case 0: return "content"; default: throw new IndexOutOfBoundsException(); } } @Override protected Object getValue(int index) { switch (index) { case 0: return AstStringNodeImpl.this.getContent(); default: throw new IndexOutOfBoundsException(); } } @Override protected Object setValue(int index, Object value) { switch (index) { case 0: { String old = AstStringNodeImpl.this.getContent(); AstStringNodeImpl.this.setContent((String) value); return old; } default: throw new IndexOutOfBoundsException(); } } } // ========================================================================= @Override public void toString(Appendable out) throws IOException { out.append(getClass().getSimpleName()); out.append("(\""); out.append(StringTools.escJava(getContent())); out.append("\")"); } }
20.205882
77
0.66048
87b09a139040cedd016f20d93b4b17bdf7914914
1,196
/* * Copyright (c) 2012-2017 The Khronos Group Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.khronos.openvx; public class Target extends Reference { protected Target(long c, int index) { get(c, index); } private native void get(long c, int index); public native void release(); public native int getIndex(); public native String getName(); public native int getNumKernels(); public class TargetKernel { public TargetKernel() { enumeration = 0; name = "unknown"; } public int enumeration; public String name; } public native TargetKernel[] getTable(); }
29.170732
75
0.676421
5b672fad29c9855c5ce38b176d767163155fc46d
325
package me.ele.jarch.athena.sql; public abstract class OnePacketCommand extends ComposableCommand { protected byte[] packet; protected byte[] sendBuf; public byte[] getSendBuf() { return sendBuf; } public OnePacketCommand(byte[] packet) { super(); this.packet = packet; } }
20.3125
66
0.646154
1197b966983645599ead4c4e4f1c759dd6d0f5a2
1,292
package com.mypls.model; import javax.persistence.*; @Entity @Table public class Lesson { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private Long course_id; private Long week_id; private String lesson_content_path; private String content_type; private Integer status; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getCourse_id() { return course_id; } public void setCourse_id(Long course_id) { this.course_id = course_id; } public Long getWeek_id() { return week_id; } public void setWeek_id(Long week_id) { this.week_id = week_id; } public String getLesson_content_path() { return lesson_content_path; } public void setLesson_content_path(String lesson_content_path) { this.lesson_content_path = lesson_content_path; } public String getContent_type() { return content_type; } public void setContent_type(String content_type) { this.content_type = content_type; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } }
19.283582
68
0.640867
2a4b7acc529b66132743616e501f5163b36e21fd
9,034
package services; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import db.WebShopDB; import io.grpc.stub.StreamObserver; import services.WebShopGrpc.WebShop; import services.Webshop.Availability; import services.Webshop.Costs; import services.Webshop.ListProductsParams; import services.Webshop.Order; import services.Webshop.Order.Status; import services.Webshop.OrderId; import services.Webshop.Payment; import services.Webshop.Product; import services.Webshop.ProductId; /** * WebShop service implementation for gRPC. * * @author Tobias Freundorfer * */ public class WebShopImpl implements WebShop { /** * The logging instance. */ private static final Logger logger = Logger.getLogger(WebShopImpl.class.getName()); /** * The demo database. */ private WebShopDB db = null; /** * Creates a new instance of the WebShop Service Implementation. */ public WebShopImpl() { this.db = WebShopDB.getInstance(); } /** * Lists all products within the given limit (max replied products). */ public void listProducts(ListProductsParams request, StreamObserver<Product> responseObserver) { logger.info("### Received request for listProducts with limit " + request.getLimit() + "."); // The amount of products requested int limit = -1; if (request.getLimit() > this.db.getProducts().size()) { limit = this.db.getProducts().size(); } else { limit = request.getLimit(); } for (int i = 0; i < limit; i++) { logger.info("### Responding with product id = " + this.db.getProducts().get(i).getId() + " | name = " + this.db.getProducts().get(i).getName()); responseObserver.onNext(this.db.getProducts().get(i)); } responseObserver.onCompleted(); logger.info("### Sent response."); } /** * Checks if the given product (identified by its productId) is available. */ public void checkAvailability(ProductId request, StreamObserver<Availability> responseObserver) { logger.info("### Received request for availability for product = " + request.getId()); boolean productAvailable = false; for (int i = 0; i < this.db.getProducts().size(); i++) { if (this.db.getProducts().get(i).getId().equals(request.getId())) { productAvailable = true; break; } } responseObserver.onNext(Availability.newBuilder().setAvailable(productAvailable).build()); responseObserver.onCompleted(); logger.info("### Sent response with availability " + productAvailable); } /** * Stores the given order details. */ public void storeOrderDetails(Order request, StreamObserver<OrderId> responseObserver) { logger.info("### Received request for storeOrderDetails."); this.db.getOrders().add(request); OrderId oi = OrderId.newBuilder().setId(request.getId()).build(); responseObserver.onNext(oi); responseObserver.onCompleted(); logger.info("### Sent response for id = " + request.getId() + " | orders database size = " + this.db.getOrders().size()); } /** * Returns order information for the requested orderId. */ public void getOrderDetails(OrderId request, StreamObserver<Order> responseObserver) { logger.info("### Received request for getOrderDetails with orderId = " + request.getId()); Order requestedOrder = null; for (int i = 0; i < this.db.getOrders().size(); i++) { if (this.db.getOrders().get(i).getId().equals(request.getId())) { requestedOrder = this.db.getOrders().get(i); break; } } if (requestedOrder == null) { logger.warning("### Corresponding order for orderId = " + request.getId() + " could not be found."); responseObserver.onNext(null); } else { responseObserver.onNext(requestedOrder); } responseObserver.onCompleted(); logger.info("### Sent response."); } /** * Cancels an order. */ public void cancelOrder(OrderId request, StreamObserver<Order> responseObserver) { logger.info("### Received request for cancelOrder with orderId = " + request.getId()); Order requestedOrder = null; for (int i = 0; i < this.db.getOrders().size(); i++) { if (this.db.getOrders().get(i).getId().equals(request.getId())) { requestedOrder = this.db.getOrders().get(i); String statusBefore = requestedOrder.getStatus().toString(); Order newOrder = requestedOrder.toBuilder().setStatus(Status.CANCELED).build(); logger.info("### Set status from " + statusBefore + " to " + this.db.getOrders().get(i).getStatus().toString()); this.db.getOrders().set(i, newOrder); responseObserver.onNext(newOrder); break; } } if (requestedOrder == null) { logger.warning("### Corresponding order for orderId = " + request.getId() + " could not be found."); responseObserver.onNext(null); } responseObserver.onCompleted(); logger.info("### Sent response."); } /** * Calcualtes the transaction costs. */ public void calcTransactionCosts(OrderId request, StreamObserver<Costs> responseObserver) { logger.info("### Received request for calcTransactionCosts with orderId = " + request.getId()); float costs = 0.0F; List<Product> prod = this.db.getProductsOfOrder(request); for (Product p : prod) { logger.info("### Added productId = " + p.getId() + " | price = " + p.getPrice()); costs += p.getPrice(); } responseObserver.onNext(Costs.newBuilder().setCosts(costs).build()); responseObserver.onCompleted(); logger.info("### Sent response with cost = " + costs); } /** * Conducts the payment for the given order. */ public void conductPayment(Payment request, StreamObserver<Order> responseObserver) { logger.info("### Received request for conductPayment with orderId = " + request.getId()); List<ProductId> productIds = new ArrayList<ProductId>(); Order requestedOrder = null; int requestedOrderIndex = -1; float costs = 0.0F; logger.info("### Searching in database containing " + this.db.getOrders().size() + " orders."); // Get products associated to the specific order for (int i = 0; i < this.db.getOrders().size(); i++) { if (this.db.getOrders().get(i).getId().equals(request.getId().getId())) { logger.info("### Found requested order."); requestedOrder = this.db.getOrders().get(i); requestedOrderIndex = i; productIds = requestedOrder.getProductsList(); break; } } logger.info("### Order contains " + productIds.size() + " products."); for (int i = 0; i < this.db.getProducts().size(); i++) { for (int j = 0; j < productIds.size(); j++) { if (this.db.getProducts().get(i).getId().equals(productIds.get(j).getId())) { logger.info("### Added productId = " + this.db.getProducts().get(i).getId() + " | price = " + this.db.getProducts().get(i).getPrice()); costs += this.db.getProducts().get(i).getPrice(); } } } if (costs == request.getAmount()) { Order newOrder = Order.newBuilder(requestedOrder).setStatus(Status.PAYED).build(); this.db.getOrders().remove(requestedOrderIndex); this.db.getOrders().add(newOrder); responseObserver.onNext(newOrder); } else { logger.warning("### Tried to pay costs = " + costs + " with payment = " + request.getAmount()); responseObserver.onNext(null); } responseObserver.onCompleted(); logger.info("### Sent response."); } /** * Calculates the shipment costs, which is the sum of all product weights. */ public void calcShipmentCosts(OrderId request, StreamObserver<Costs> responseObserver) { logger.info("### Received request for calcShipmentCosts with orderId = " + request.getId()); float weight = 0.0F; List<Product> prod = this.db.getProductsOfOrder(request); for (Product p : prod) { logger.info("### Added productId = " + p.getId() + " | weight = " + p.getWeight()); weight += p.getWeight(); } responseObserver.onNext(Costs.newBuilder().setCosts(weight).build()); responseObserver.onCompleted(); logger.info("### Sent response with weight = " + weight); } /** * Ships the products and updates the orders status. */ public void shipProducts(OrderId request, StreamObserver<Order> responseObserver) { logger.info("### Received request for shipProducts with orderId = " + request.getId()); Order requestedOrder = null; for (int i = 0; i < this.db.getOrders().size(); i++) { if (this.db.getOrders().get(i).getId().equals(request.getId())) { String statusBefore = this.db.getOrders().get(i).getStatus().toString(); requestedOrder = this.db.getOrders().get(i).toBuilder().setStatus(Status.SHIPPED).build(); this.db.getOrders().set(i, requestedOrder); logger.info("### Set status from " + statusBefore + " to " + requestedOrder.getStatus().toString()); responseObserver.onNext(requestedOrder); break; } } if (requestedOrder == null) { logger.warning("### Corresponding order for orderId = " + request.getId() + " could not be found."); responseObserver.onNext(null); } responseObserver.onCompleted(); logger.info("### Sent response."); } }
29.42671
104
0.673456
7fedfa162fcaa308c703851b5b980bcbe89ec6d1
3,716
package utils; import java.io.IOException; import java.net.URL; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; import model.Bishop; import model.ChessBoardBase; import model.Jumper; import model.King; import model.Knight; import model.Pawn; import model.Piece; import model.Queen; import model.Rook; import model.StandardChessBoard; import model.SuperQueen; public class BoardBuilder { /** * Create a board from board class name. * * @param boardName The class name of the board. * @param height The height of the board. * @param width The width of the board. */ public static ChessBoardBase boardFactory(String boardName, int height, int width) { if (boardName.equals("StandardChessBoard")) { return new StandardChessBoard(height, width); } return null; } /** * Create a piece from piece name and side name. */ public static Piece pieceFactory(ChessBoardBase board, String pieceName, String sideName) { Side side; try { side = Side.valueOf(sideName); } catch (IllegalArgumentException e) { throw new RuntimeException("Unknown side name: " + sideName); } if (pieceName.equals("Bishop")) { return new Bishop(board, side); } if (pieceName.equals("SuperQueen")) { return new SuperQueen(board, side); } if (pieceName.equals("Jumper")) { return new Jumper(board, side); } if (pieceName.equals("King")) { return new King(board, side); } if (pieceName.equals("Knight")) { return new Knight(board, side); } if (pieceName.equals("Pawn")) { Pawn pawn = new Pawn(board, side); pawn.setMovingUp(side == Side.White); return pawn; } if (pieceName.equals("Rook")) { return new Rook(board, side); } if (pieceName.equals("Queen")) { return new Queen(board, side); } return null; } /** * Construct a board from a file. * * @param filePath The file URL. */ public static ChessBoardBase constructFromFile(URL filePath) throws RuntimeException, IOException { Scanner scanner = new Scanner(filePath.openStream()); int height = Integer.parseInt(scanner.nextLine()); int width = Integer.parseInt(scanner.nextLine()); String boardName = scanner.nextLine(); ChessBoardBase board = boardFactory(boardName, height, width); if (board == null) { throw new RuntimeException("Invalid board name: " + boardName); } Pattern pattern = Pattern .compile("\\s*((?<piece>[a-zA-Z]+)_(?<side>[A-Z][a-zA-Z]*))?(\\s*|,)"); for (int i = 0; i < height; ++i) { String row = scanner.nextLine(); Matcher matcher = pattern.matcher(row); int j = 0; for (int k = 0; k < row.length() && j < width && matcher.find(k); ++j, k = matcher.end() + 1) { String pieceName = matcher.group("piece"); String sideName = matcher.group("side"); if (pieceName == null && sideName == null) { continue; } Piece piece = pieceFactory(board, pieceName, sideName); if (piece == null) { throw new RuntimeException(String .format("Invalid piece config at %d, %d: (%s, %s)", i, j, pieceName, sideName)); } if (piece instanceof King) { board.setKing((King) piece, new Location(i, j)); } else { board.setPiece(piece, new Location(i, j)); } } if (j != width) { throw new RuntimeException(String .format("Insufficient pieces for row %d, expected %d, got %d", i, width, j)); } } return board; } }
29.259843
79
0.60845
8ad8640d36fcd60836240075f8ee5785e9214daa
760
import java.util.HashSet; import java.util.Set; class TestCaller1<P1> { { TestCaller1.foo(null); } public static void foo(HashSet<Integer> fn) { } public <P> void foo(Set<String> fn) { } } class TestCaller2 { { TestCaller2.foo<error descr="Ambiguous method call: both 'TestCaller2.foo(HashSet<Integer>)' and 'TestCaller2.foo(Set<String>)' match">(null)</error>; } public static void foo(HashSet<Integer> fn) { } public <P> void foo(Set<String> fn) { } } class TestCaller3 { { TestCaller2.foo<error descr="Ambiguous method call: both 'TestCaller2.foo(HashSet<Integer>)' and 'TestCaller2.foo(Set<String>)' match">(null)</error>; } public static void foo(HashSet<Integer> fn) { } public static void foo(Set<String> fn) { } }
29.230769
154
0.685526
3615b0b120e9f3e3ac74a653cab510846d4b8c22
4,477
package de.bitsharesmunich.graphenej; import com.google.common.math.DoubleMath; import com.google.common.primitives.UnsignedLong; import java.math.RoundingMode; import java.util.List; import de.bitsharesmunich.graphenej.operations.LimitOrderCreateOperation; /** * This class will maintain a snapshot of the order book between two assets. * * It also provides a handy method that should return the appropriate LimitOrderCreateOperation * object needed in case the user wants to perform market-priced operations. * * It is important to keep the order book updated, ideally by listening to blockchain events, and calling the 'update' method. * * Created by nelson on 3/25/17. */ public class OrderBook { private List<LimitOrder> limitOrders; public OrderBook(List<LimitOrder> limitOrders){ this.limitOrders = limitOrders; } /** * Replaces the current limit order by the list provided as parameter. * @param limitOrders: New list of orders */ public void update(List<LimitOrder> limitOrders){ this.limitOrders = limitOrders; } public void update(LimitOrder limitOrder){ //TODO: Implement the method that will update a single limit order from the order book } /** * High level method used to exchange a specific amount of an asset (The base) for another * one (The quote) at market value. * * It should analyze the order book and figure out the optimal amount of the base asset to give * away in order to obtain the desired amount of the quote asset. * * @param seller: User account of the seller, used to build the limit order create operation * @param myBaseAsset: The asset the user is willing to give away * @param myQuoteAmount: The amount of a given asset the user wants * @param expiration: The expiration time of the limit order * * @return An instance of the LimitOrderCreateOperation class, which is ready to be broadcasted. */ public LimitOrderCreateOperation exchange(UserAccount seller, Asset myBaseAsset, AssetAmount myQuoteAmount, int expiration){ AssetAmount toSell = new AssetAmount(UnsignedLong.valueOf(calculateRequiredBase(myQuoteAmount)), myBaseAsset); AssetAmount toReceive = myQuoteAmount; LimitOrderCreateOperation buyOrder = new LimitOrderCreateOperation(seller, toSell, toReceive, expiration, true); return buyOrder; } /** * Given a specific amount of a desired asset, this method will calculate how much of the corresponding * asset we need to offer to perform a successful transaction with the current order book. * @param quoteAmount: The amount of the desired asset. * @return: The minimum amount of the base asset that we need to give away */ public long calculateRequiredBase(AssetAmount quoteAmount){ long totalBought = 0; long totalSold = 0; for(int i = 0; i < this.limitOrders.size() && totalBought < quoteAmount.getAmount().longValue(); i++){ LimitOrder order = this.limitOrders.get(i); // If the base asset is the same as our quote asset, we have a match if(order.getSellPrice().base.getAsset().getObjectId().equals(quoteAmount.getAsset().getObjectId())){ // My quote amount, is the order's base amount long orderAmount = order.getForSale(); // The amount of the quote asset we still need long stillNeed = quoteAmount.getAmount().longValue() - totalBought; // If the offered amount is greater than what we still need, we exchange just what we need if(orderAmount >= stillNeed) { totalBought += stillNeed; double additionalRatio = (double) stillNeed / (double) order.getSellPrice().base.getAmount().longValue(); double additionalAmount = order.getSellPrice().quote.getAmount().longValue() * additionalRatio; long longAdditional = DoubleMath.roundToLong(additionalAmount, RoundingMode.HALF_UP); totalSold += longAdditional; }else{ // If the offered amount is less than what we need, we exchange the whole order totalBought += orderAmount; totalSold += order.getSellPrice().quote.getAmount().longValue(); } } } return totalSold; } }
45.222222
128
0.675452
afd542b4de35a87261f1886f0dd5fbad10498078
2,929
/* * Copyright 2015-2018 Igor Maznitsa. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.igormaznitsa.mindmap.plugins.attributes.emoticon; import com.igormaznitsa.mindmap.plugins.api.PluginContext; import com.igormaznitsa.mindmap.swing.panel.utils.MiscIcons; import com.igormaznitsa.mindmap.swing.panel.utils.Utils; import java.awt.Color; import java.awt.GridLayout; import java.util.Enumeration; import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.JToggleButton; import javax.swing.plaf.metal.MetalToggleButtonUI; public final class IconPanel extends JPanel { private static final long serialVersionUID = 4823626757838675154L; private final ButtonGroup group = Utils.UI_COMPO_FACTORY.makeButtonGroup(); private final PluginContext context; public IconPanel(@Nonnull final PluginContext context) { super(new GridLayout(0, 6)); this.context = context; add(makeIconButton(group, "empty")); for (final String s : MiscIcons.getNames()) { add(makeIconButton(group, s)); } } @Nullable public String getSelectedName() { final Enumeration<AbstractButton> iterator = this.group.getElements(); while (iterator.hasMoreElements()) { final JToggleButton button = (JToggleButton) iterator.nextElement(); if (button.isSelected()) { return button.getName(); } } return null; } @Nonnull private JToggleButton makeIconButton(@Nonnull final ButtonGroup group, @Nonnull final String name) { final JToggleButton result = Utils.UI_COMPO_FACTORY.makeToggleButton(); final Color panelColor = this.getBackground(); result.setUI(new MetalToggleButtonUI() { @Override @Nullable protected Color getSelectColor() { return panelColor.brighter(); } }); result.setBackground(panelColor.darker()); result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(3, 3, 3, 3))); result.setIcon(new ImageIcon(MiscIcons.findForName(name))); result.setName(name); result.setFocusPainted(false); result.setToolTipText(name); group.add(result); return result; } }
32.186813
91
0.731308
5aef16eadbfc3ff0873f594229e5e2c84bb326a2
127
package perobobbot.lang; import lombok.NonNull; public interface Identified<I> { @NonNull I getIdentification(); }
11.545455
32
0.716535
d7d4d18f800f2920e508841dd1183bcb2d22fcfc
456
package org.xyz.mapstruct.mapper; import org.mapstruct.InheritConfiguration; import org.mapstruct.MapperConfig; import org.mapstruct.factory.Mappers; import java.util.List; public interface CommonMapper<S, T> { @InheritConfiguration T sourceToTarget(S s); @InheritConfiguration S targetToSource(T t); @InheritConfiguration List<T> sourceToTarget(List<S> s); @InheritConfiguration List<S> targetToSource(List<T> t); }
19.826087
42
0.743421
53e3f5b9ec22615bbf814c7675d7aa0c9505ccc2
1,186
package com.xueyi.tenant.api.tenant.domain.po; import com.xueyi.common.core.web.entity.base.BaseEntity; import com.baomidou.mybatisplus.annotation.TableField; import com.xueyi.common.core.annotation.Excel; /** * 数据源策略 持久化对象 * * @author xueyi */ public class TeStrategyPo extends BaseEntity { private static final long serialVersionUID = 1L; /** 数据源Id */ @Excel(name = "数据源Id") @TableField("source_id") private Long sourceId; /** 数据源编码 */ @Excel(name = "数据源编码") @TableField("source_slave") private String sourceSlave; /** 默认策略(Y是 N否) */ @Excel(name = "默认策略", readConverterExp = "Y=是,N=否") @TableField("is_default") private String isDefault; public void setSourceId(Long sourceId) { this.sourceId = sourceId; } public Long getSourceId() { return sourceId; } public void setSourceSlave(String sourceSlave) { this.sourceSlave = sourceSlave; } public String getSourceSlave() { return sourceSlave; } public void setIsDefault(String isDefault) { this.isDefault = isDefault; } public String getIsDefault() { return isDefault; } }
21.563636
56
0.652614
194a9752aaa9af831ab4b3912b23b8281ba7ef9c
1,744
package com.lifeonwalden.forestbatis.example.meta; import com.lifeonwalden.forestbatis.constant.JdbcType; import com.lifeonwalden.forestbatis.meta.*; import java.util.ArrayList; import java.util.List; public class AccountTableInfo { private final static String TABLE_NAME = "Account"; private final static String ALIAS_NAME = "a"; private final static String _id = "id"; public final static PropertyMeta id = new AbstractPropertyMeta(_id, JdbcType.VARCHAR) { }; private final static String _name = "name"; public final static PropertyMeta name = new AbstractPropertyMeta(_name, JdbcType.VARCHAR) { }; private final static String _userId = "userId"; public final static PropertyMeta userId = new AbstractPropertyMeta(_userId, JdbcType.VARCHAR) { }; private final static String _balance = "balance"; public final static PropertyMeta balance = new AbstractPropertyMeta(_balance, JdbcType.DECIMAL) { }; private final static List<ColumnMeta> columnList = new ArrayList<>(); public final static TableMeta TABLE = new AbstractTableMeta(TABLE_NAME, ALIAS_NAME, columnList) { }; public final static ColumnMeta Id = new AbstractColumnMeta(_id, JdbcType.VARCHAR, TABLE, id) { }; public final static ColumnMeta Name = new AbstractColumnMeta(_name, JdbcType.VARCHAR, TABLE, name) { }; public final static ColumnMeta UserId = new AbstractColumnMeta(_userId, JdbcType.VARCHAR, TABLE, userId) { }; public final static ColumnMeta Balance = new AbstractColumnMeta(_balance, JdbcType.DECIMAL, TABLE, balance) { }; static { columnList.add(Id); columnList.add(Name); columnList.add(UserId); columnList.add(Balance); } }
39.636364
113
0.725344
1de6c2aa5db0769b31180f516dd36b9669e2c3a1
255
package sample.thread.server; public class UDP { public static void main(String[] args) { UDPSender udpSender = new UDPSender(); new Thread(udpSender).start(); UDPReceiver udpReceiver = new UDPReceiver(); new Thread(udpReceiver).start(); } }
19.615385
46
0.717647
01fe9e4ffcc316cf81dad28f60e4b89457651a54
3,127
/* * Copyright (C) 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.api.tools.framework.aspects.servicecontrol; /** * Represents bounds used for the service control config validation. */ class ServiceControlConfigBounds { private final int maxMonitoredResources; private final int maxMetrics; private final int maxLogs; private final int maxLabels; private final int maxStringLength; private ServiceControlConfigBounds(final int maxMonitoredResources, final int maxMetrics, final int maxLogs, final int maxLabels, final int maxStringLength) { this.maxMonitoredResources = maxMonitoredResources; this.maxMetrics = maxMetrics; this.maxLogs = maxLogs; this.maxLabels = maxLabels; this.maxStringLength = maxStringLength; } /** * Maximum number of resource entities that can be defined in the service control config. */ public int getMaxMonitoredResources() { return maxMonitoredResources; } /** * Maximum number of metrics that can be defined in the service control config. */ public int getMaxMetrics() { return maxMetrics; } /** * Maximum number of logs that can be defined in the service control config. */ public int getMaxLogs() { return maxLogs; } /** * Maximum number of labels used by resource entity, label key transformation or metric. */ public int getMaxLabels() { return maxLabels; } /** * Maximum length of a user specified string like name or label. */ public int getMaxStringLength() { return maxStringLength; } public static class Builder { private int maxMonitoredResources = 128; private int maxMetrics = 1024; private int maxLogs = 1024; private int maxLabels = 128; private int maxStringLength = 512; public Builder setMaxMonitoredResources(int maxMonitoredResources) { this.maxMonitoredResources = maxMonitoredResources; return this; } public Builder setMaxMetrics(int maxMetrics) { this.maxMetrics = maxMetrics; return this; } public Builder setMaxLogs(int maxLogs) { this.maxLogs = maxLogs; return this; } public Builder setMaxLabels(int maxLabels) { this.maxLabels = maxLabels; return this; } public Builder setMaxStringLength(int maxStringLength) { this.maxStringLength = maxStringLength; return this; } public ServiceControlConfigBounds build() { return new ServiceControlConfigBounds(maxMonitoredResources, maxMetrics, maxLogs, maxLabels, maxStringLength); } } }
28.171171
92
0.711864
860024d52dcd2a371e08611d6a152e843dc29457
2,309
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.analysis; import com.google.common.base.Preconditions; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.packages.OutputFile; import com.google.devtools.build.lib.rules.fileset.FilesetProvider; import com.google.devtools.build.lib.vfs.PathFragment; /** * A configured target for output files generated by {@code Fileset} rules. They are almost the * same thing as output files except that they implement {@link FilesetProvider} so that * {@code Fileset} can figure out the link tree behind them. * * <p>In an ideal world, this would not be needed: Filesets would depend on other Filesets and not * their output directories. However, sometimes a Fileset depends on the output directory of * another Fileset. Thus, we need this hack. */ public final class FilesetOutputConfiguredTarget extends OutputFileConfiguredTarget implements FilesetProvider { private final Artifact filesetInputManifest; private final PathFragment filesetLinkDir; FilesetOutputConfiguredTarget(TargetContext targetContext, OutputFile outputFile, TransitiveInfoCollection generatingRule, Artifact outputArtifact) { super(targetContext, outputFile, generatingRule, outputArtifact); FilesetProvider provider = generatingRule.getProvider(FilesetProvider.class); Preconditions.checkArgument(provider != null); filesetInputManifest = provider.getFilesetInputManifest(); filesetLinkDir = provider.getFilesetLinkDir(); } @Override public Artifact getFilesetInputManifest() { return filesetInputManifest; } @Override public PathFragment getFilesetLinkDir() { return filesetLinkDir; } }
41.232143
98
0.781291
fb1cb81d0923b93011dae569610cf6fd22ee1b90
3,784
/** * Copyright 2017-2021 Fred Feng (paganini.fy@gmail.com) * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.paganini2008.springworld.fastjpa; import java.util.List; import javax.persistence.criteria.Join; import javax.persistence.criteria.JoinType; import javax.persistence.criteria.Path; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import javax.persistence.criteria.Selection; import javax.persistence.metamodel.EntityType; /** * * SiblingModel * * @author Fred Feng * @since 2.0.1 */ public class SiblingModel<X, Y> implements Model<Y> { private final Model<X> model; private final Model<Y> sibling; SiblingModel(Model<Y> sibling, Model<X> model) { this.sibling = sibling; this.model = model; } @Override public EntityType<Y> getEntityType() { return sibling.getEntityType(); } @Override public Class<?> getRootType() { return sibling.getRootType(); } @Override public Class<Y> getType() { return sibling.getType(); } @Override public boolean isManaged(Class<?> type) { return getType().equals(type); } @Override public boolean hasAttribute(String name, String attributeName) { return sibling.hasAttribute(name, attributeName) ? true : model.hasAttribute(name, attributeName); } @Override public <T> Path<T> getAttribute(String attributeName) { return sibling.getAttribute(attributeName); } @Override public <T> Path<T> getAttribute(String name, String attributeName) { if (sibling.hasAttribute(name, attributeName)) { return sibling.getAttribute(name, attributeName); } return model.getAttribute(name, attributeName); } @Override public Root<?> getRoot() { return model.getRoot(); } @Override public String getAlias() { return sibling.getAlias(); } @Override public Selection<?> getSelection(String alias) { if (sibling.getAlias().equals(alias)) { return sibling.getSelection(alias); } return model.getSelection(alias); } @Override public List<Selection<?>> getSelections(String alias, String[] attributeNames) { if (sibling.getAlias().equals(alias)) { return sibling.getSelections(alias, attributeNames); } return model.getSelections(alias, attributeNames); } @Override public List<JpaAttributeDetail> getAttributeDetails(String name) { return sibling.getAttributeDetails(name); } @Override public <Z> Model<Z> join(String attributeName, String alias, Predicate on) { Join<Y, Z> join = this.sibling.getRoot().join(attributeName, JoinType.INNER); if (on != null) { join.on(on); } return new JoinModel<Y, Z>(join, alias, null, this); } @Override public <Z> Model<Z> leftJoin(String attributeName, String alias, Predicate on) { Join<Y, Z> join = this.sibling.getRoot().join(attributeName, JoinType.LEFT); if (on != null) { join.on(on); } return new JoinModel<Y, Z>(join, alias, null, this); } @Override public <Z> Model<Z> rightJoin(String attributeName, String alias, Predicate on) { Join<Y, Z> join = this.sibling.getRoot().join(attributeName, JoinType.RIGHT); if (on != null) { join.on(on); } return new JoinModel<Y, Z>(join, alias, null, this); } @Override public <S> Model<S> sibling(Model<S> sibling) { return new SiblingModel<Y, S>(sibling, this); } }
25.741497
100
0.723573
afd6636024210f3e3c676f046c4ae2a1eee57e2e
2,118
/* * Copyright (C) 2012 Square, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package retrofit; import java.util.concurrent.Executor; import static retrofit.RetrofitError.unexpectedError; /** * A {@link Runnable} executed on a background thread to invoke {@link #obtainResponse()} which * performs an HTTP request. The response of the request, whether it be an object or exception, is * then marshaled to the supplied {@link Executor} in the form of a method call on a * {@link Callback}. */ abstract class CallbackRunnable<T> implements Runnable { private final Callback<T> callback; private final Executor callbackExecutor; private final ErrorHandler errorHandler; CallbackRunnable(Callback<T> callback, Executor callbackExecutor, ErrorHandler errorHandler) { this.callback = callback; this.callbackExecutor = callbackExecutor; this.errorHandler = errorHandler; } @SuppressWarnings("unchecked") @Override public final void run() { try { final ResponseWrapper wrapper = obtainResponse(); callbackExecutor.execute(new Runnable() { @Override public void run() { callback.success((T) wrapper.responseBody, wrapper.response); } }); } catch (RetrofitError e) { Throwable cause = errorHandler.handleError(e); final RetrofitError handled = cause == e ? e : unexpectedError(e.getUrl(), cause); callbackExecutor.execute(new Runnable() { @Override public void run() { callback.failure(handled); } }); } } public abstract ResponseWrapper obtainResponse(); }
34.721311
98
0.711048
ded8cf66cdf2c3968a76ea9a3b6b7c80a92229cf
1,722
package com.dgex.offspring.nxtCore.service; public class TransactionException extends Exception { public static final String INCORRECT_AMOUNT = "Incorrect amount"; public static final String INCORRECT_FEE = "Incorrect fee"; public static final String INCORRECT_DEADLINE = "Incorrect deadline"; public static final String NOT_ENOUGH_FUNDS = "Not enough funds"; public static final String INCORRECT_ALIAS_LENGTH = "Incorrect alias length"; public static final String ALIAS_ALREADY_REGISTERED = "Alias already registered"; public static final String INCORRECT_ALIAS = "Incorrect alias"; public static final String INCORRECT_URI_LENGTH = "Incorrect uri length"; public static final String INCORRECT_ARBITRARY_MESSAGE = "Incorrect arbitrary message"; public static final String MISSING_NAME = "Missing name"; public static final String INCORRECT_ASSET_NAME_LENGTH = "Incorrect asset name length"; public static final String INCORRECT_ASSET_NAME = "Incorrect asset name"; public static final String ASSET_NAME_ALREADY_USED = "Asset name already used"; public static final String INCORRECT_ASSET_DESCRIPTION = "Incorrect asset descritption"; public static final String INCORRECT_ASSET_QUANTITY = "Incorrect asset quantity"; public static final String INCORRECT_PRICE = "Incorrect price"; public static final String INCORRECT_QUANTITY = "Incorrect quantity"; public static final String INTERNAL_ERROR = "Fatal internal error. Quit and restart application"; public static final String UNKNOWN_ORDER = "Unknown order"; private final String type; public TransactionException(String type) { this.type = type; } public String getType() { return type; } }
31.888889
99
0.782811
cf8fe1e0aefbe3fe7e53bc0ff510df2688995a00
4,748
/* Copyright 2015 David Standish Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.wtdiff.util.ui; import java.util.ArrayList; import java.util.List; import javax.swing.text.BadLocationException; import javax.swing.text.StyledDocument; public class TwoDocumentDiffWriter extends DocumentDiffWriter { private StyledDocument oldDoc; private StyledDocument newDoc; private ChangeType currentType = ChangeType.COMMON; private List<ChangeRange> oldChangeList = new ArrayList<>(); private List<ChangeRange> newChangeList = new ArrayList<>(); public TwoDocumentDiffWriter(StyledDocument oldD, StyledDocument newD) { oldDoc = oldD; initStyleSets(oldDoc); newDoc = newD; } @Override public void append(List<String> oldLines, int oldBeginLineOffset, List<String> newLines, int newBeginLineOffset) { int oldBegin = oldDoc.getLength(); int newBegin = newDoc.getLength(); StyleSet sSet = styleSetForChangeType(currentType); String indicator = " "; if ( currentType == ChangeType.OLD_ONLY ) { indicator = "- "; } else if ( currentType == ChangeType.NEW_ONLY ) { indicator = "+ "; } else if ( currentType == ChangeType.CHANGED ) { indicator = "! "; } try { int oldLineNo = oldBeginLineOffset; for( String line: oldLines ) { oldLineNo++; if ( isNumberLines() ) { oldDoc.insertString(oldDoc.getLength(), lineNumberToString(oldLineNo) , sSet.lineno); } oldDoc.insertString(oldDoc.getLength(), indicator, sSet.indicator); oldDoc.insertString(oldDoc.getLength(), formatLine(line) + LS, sSet.text); } int newLineNo = newBeginLineOffset; for( String line: newLines ) { newLineNo++; if ( isNumberLines() ) { newDoc.insertString(newDoc.getLength(), lineNumberToString(newLineNo) , sSet.lineno); } newDoc.insertString(newDoc.getLength(), indicator, sSet.indicator); newDoc.insertString(newDoc.getLength(), formatLine(line) + LS, sSet.text); } if ( oldLines.size() > newLines.size() ) { for( int i = oldLines.size() - newLines.size(); i > 0 ; i-- ) { newDoc.insertString(newDoc.getLength(), LS, sSet.text); } } else { for( int i = newLines.size() - oldLines.size(); i > 0 ; i-- ) { oldDoc.insertString(oldDoc.getLength(), LS, sSet.text); } } } catch (BadLocationException e) { e.printStackTrace(); } int oldEnd = oldDoc.getLength(); int newEnd = newDoc.getLength(); if ( currentType != ChangeType.COMMON ) { oldChangeList.add( new ChangeRange(oldBegin, oldEnd)); newChangeList.add( new ChangeRange(newBegin, newEnd)); } } @Override public void newChange(ChangeType type, int oldBegin, int oldEnd, int newBegin, int newEnd) { currentType = type; switch ( type ) { case COMMON: break; case NEW_ONLY: break; case OLD_ONLY: break; case WARNING: break; case CHANGED: break; default: throw new IllegalArgumentException( "BUG unknown change type " + type); } } public int numberOfDifferences() { if (oldChangeList.size() != newChangeList.size()) { throw new IllegalStateException( "old and new change list sizes different " + oldChangeList.size() + " vs " + newChangeList.size() ); } return oldChangeList.size(); } public List<ChangeRange> getOldChangeRanges() { return oldChangeList; } public List<ChangeRange> getNewChangeRanges() { return newChangeList; } }
34.911765
119
0.574768
121a4c146a4ae43ccb26a1ca039e0d52f7ab479e
733
package net.hashsploit.clank.server.medius.serializers; import java.nio.ByteBuffer; import net.hashsploit.clank.server.medius.MediusConstants; import net.hashsploit.clank.server.medius.MediusMessageType; import net.hashsploit.clank.server.medius.objects.MediusMessage; public class GetBuddyInvitationsRequest extends MediusMessage { private byte[] messageId = new byte[MediusConstants.MESSAGEID_MAXLEN.value]; public GetBuddyInvitationsRequest(byte[] data) { super(MediusMessageType.GetBuddyInvitations, data); ByteBuffer buf = ByteBuffer.wrap(data); buf.get(messageId); } public byte[] getMessageId() { return messageId; } public void setMessageId(byte[] messageId) { this.messageId = messageId; } }
24.433333
77
0.785812
b3ef0caa540f40da5115b5b1c49a5edefd0cb990
2,522
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.metastore.model; import java.util.List; public class MIndexItem { private String db; private String tbl; private String name; private String field_list; private String location; private int type; private int status; public static int IndexTypePrimary = 0; public static int IndexTypeSecond = 1; public static int IndexTypeUnion = 2; public static int IndexStatusInit = 0; public static int IndexStatusBuilding = 1; public static int IndexStatusDone = 2; public MIndexItem() { } public MIndexItem(String db, String tbl, String name, String fieldList, String location, int type, int status) { this.db = db; this.tbl = tbl; this.name = name; this.field_list = fieldList; this.location = location; this.type = type; this.status = status; } public void setDb(String db) { this.db = db; } public String getDb() { return this.db; } public String getTbl() { return this.tbl; } public void setTbl(String tbl) { this.tbl = tbl; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getFieldList() { return this.field_list; } public void setFieldList(String fieldList) { this.field_list = fieldList; } public String getLocation() { return this.location; } public void setLocation(String location) { this.location = location; } public int getType() { return this.type; } public void setType(int type) { this.type = type; } public int getStatus() { return this.status; } public void setStatus(int status) { this.status = status; } }
23.137615
75
0.691911
189e69b575fdfa7dbf12d943f7a93e911929d132
948
package com.tallate.test.http; import com.tallate.test.keyprovider.SpanIdKeyProvider; import javax.servlet.http.HttpServletRequest; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; /** */ @Slf4j @Data public class HttpInterceptor { public void httpService() { } private String getSpanId(ProceedingJoinPoint pjp) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); return request.getHeader("spanId"); } public Object intercept(ProceedingJoinPoint pjp) throws Throwable { String spanId = getSpanId(pjp); SpanIdKeyProvider.put(spanId); Object res = pjp.proceed(); SpanIdKeyProvider.remove(); return res; } }
29.625
123
0.746835