blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
132
path
stringlengths
2
382
src_encoding
stringclasses
34 values
length_bytes
int64
9
3.8M
score
float64
1.5
4.94
int_score
int64
2
5
detected_licenses
listlengths
0
142
license_type
stringclasses
2 values
text
stringlengths
9
3.8M
download_success
bool
1 class
bab5bd80d8c12d8d0848ac9698288503ab1322f5
Java
GarlandZhang/ShopifyApplicationDemo
/demo/src/main/java/com/shopify/demo/configs/JwtSecurityConfig.java
UTF-8
3,046
2.234375
2
[]
no_license
package com.shopify.demo.configs; import com.shopify.demo.security.JwtAuthenticationEntryPoint; import com.shopify.demo.security.JwtAuthenticationProvider; import com.shopify.demo.security.JwtAuthenticationTokenFilter; import com.shopify.demo.security.JwtSuccessHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.ProviderManager; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import java.util.Collections; @EnableGlobalMethodSecurity(prePostEnabled = true) @EnableWebSecurity @Configuration public class JwtSecurityConfig extends WebSecurityConfigurerAdapter { // WebSecurityConfigurerAdapter bootstraps automatically by bootstrap // here we are overriding default security configurations @Autowired private JwtAuthenticationProvider authenticationProvider; @Autowired private JwtAuthenticationEntryPoint entryPoint; // creates custom authentication manager, which requires custom Authentication Provider @Bean public AuthenticationManager authenticationManager() { return new ProviderManager(Collections.singletonList(authenticationProvider)); } @Bean public JwtAuthenticationTokenFilter authenticationTokenFilter() { JwtAuthenticationTokenFilter filter = new JwtAuthenticationTokenFilter(); filter.setAuthenticationManager(authenticationManager()); filter.setAuthenticationSuccessHandler(new JwtSuccessHandler()); // custom success handler, // to redirect request to this handler to do further processing return filter; } @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() .authorizeRequests().antMatchers("**/secure/**").authenticated() //which endpoints need auth .and() .exceptionHandling().authenticationEntryPoint(entryPoint) //redirect when user access unauthorized endpoint .and() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); //makes session stateless so there is no re http.addFilterBefore(authenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class); //before the built-in spring filter is applied, load our custom filter first http.headers().cacheControl(); } }
true
e3cd9d58989470bb42b01c463b36bdcf171d3d9a
Java
AndreyMamchur/crazyvaperV2
/src/main/java/com/crazyvaperV2/service/AtomizerServiceImpl.java
UTF-8
2,038
2.28125
2
[]
no_license
package com.crazyvaperV2.service; import com.crazyvaperV2.dao.AtomizerDao; import com.crazyvaperV2.entity.Atomizer; import com.crazyvaperV2.service.interfaces.AtomizerService; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.List; @Service public class AtomizerServiceImpl implements AtomizerService { private static final Logger logger = Logger.getLogger(ECigServiceImpl.class); @Autowired private AtomizerDao atomizerDao; @Override public void save(Atomizer entity) { save(entity); } @Override public Atomizer getById(long id) { return atomizerDao.findById(id); } @Override public List<Atomizer> getAll() { return atomizerDao.findAll(); } @Override public void delete(long id) { atomizerDao.delete(id); } @Override public Page<Atomizer> getAll(Integer page, Integer size, String order, String direction) { Page<Atomizer> page1; Pageable pageable = null; try { if (direction.equals("low")) { Sort sort = new Sort(new Sort.Order(Sort.Direction.ASC, order)); pageable = new PageRequest(page, size, sort); } else if (direction.equals("high")) { Sort sort = new Sort(new Sort.Order(Sort.Direction.DESC, order)); pageable = new PageRequest(page, size, sort); } else { pageable = new PageRequest(page, size); } page1 = atomizerDao.findAll(pageable); } catch (Exception e){ logger.error("Something wrong with getAll(Integer page, Integer size, String order, String direction)", e); page1 = null; } return page1; } }
true
67088fcb96cb14cc39fc72147765d95734f64130
Java
MyronM95/Project0
/src/main/java/com/revature/services/ValidationService.java
UTF-8
1,558
3.09375
3
[]
no_license
package com.revature.services; import java.util.Scanner; //Credit to Marielle Nolasco and her TourOfHeros application for this class. //Her work is available at https://github.com/200601-USF-Pega/trainer-code.git public class ValidationService { Scanner input = new Scanner(System.in); boolean invalid = true; public String getValidStringInput(String prompt) { String userInput; do { System.out.println(prompt); userInput = input.next(); if(!userInput.isEmpty()) break; System.out.println("Please enter a non-empty string"); } while (invalid); return userInput; } //prompts user for a valid int public int getValidInt(String prompt) { int userInput = 0; do { System.out.println(prompt); try { userInput = Integer.parseInt(input.nextLine()); break; } catch (NumberFormatException e) { System.out.println("Please input valid integers"); } } while(invalid); return userInput; } public boolean getValidBoolean(String prompt) { invalid = true; String userInput; do { System.out.println(prompt); userInput = input.nextLine(); if(userInput.equalsIgnoreCase("true") || userInput.equalsIgnoreCase("false")) break; System.out.println("Please type either 'true' or 'false'"); } while (invalid); return Boolean.parseBoolean(userInput); } }
true
9dcc07e3bc42b2072095a21aabfad35721f47649
Java
grandeemme/ol3gwt
/src/main/java/ol/gwt/source/VectorSourceOptions.java
UTF-8
859
1.851563
2
[]
no_license
package ol.gwt.source; import com.google.gwt.core.client.JsArray; import ol.gwt.Collection; import ol.gwt.feature.Feature; import ol.gwt.format.FeatureFormat; /** * Vector source options passed to vector sources on construction */ public class VectorSourceOptions extends AbstractVectorSourceOptions { protected VectorSourceOptions() { } public static native final VectorSourceOptions create()/*-{ return {}; }-*/; public final native void setFeatures(JsArray<Feature> features)/*-{ this.features = features; }-*/; public final native void setFeatureCollection(Collection<Feature> features)/*-{ this.features = features; }-*/; public final native void setUrl(String url)/*-{ this.url = url; }-*/; public final native void setFormat(FeatureFormat format)/*-{ this.format = format; }-*/; }
true
c5aa099330d3b35df39372dff71a66bde919069b
Java
chenbobaoge/easyblogback
/eurekaclient/src/main/java/com/bobochen/easyblogback/dao/EasyblogDao.java
UTF-8
1,784
2.3125
2
[]
no_license
package com.bobochen.easyblogback.dao; import com.bobochen.easyblogback.entity.Easyblog; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import java.util.List; @Repository public interface EasyblogDao extends JpaRepository<Easyblog, Integer> ,CustomRepository { // List<Easyblog> findAll(); // Easyblog findOne(Integer id); // Easyblog save(Easyblog site); //void delete(Integer id); List<Easyblog> findByUserName(String userName); @Query(value = "select * from my_users where user_name like %:name%",nativeQuery = true) List<Easyblog> findByUserName2(@Param("name") String userName); } interface CustomRepository { List<Easyblog> searchUserName(String key); } class CustomRepositoryImpl implements CustomRepository { @PersistenceContext private EntityManager em; @Override public List<Easyblog> searchUserName(String key) { List<Easyblog> es= em.createNativeQuery("select * from my_users where user_name like '%"+key+"%' ",Easyblog.class).getResultList(); return es; // CriteriaBuilder builder = em.getCriteriaBuilder(); // CriteriaQuery<Blog> query = builder.createQuery(Blog.class); // Root<Blog> root = query.from(Blog.class); // query.where(builder.like(root.get("title"), "%" + key + "%")); // return em.createQuery(query.select(root)).getResultList(); } }
true
89a53a94d99a5b9764c6db07c8d7a41f4c4232f3
Java
mehmetalixk/club-8
/src/main/java/com/example/demo384test/model/Security/Role.java
UTF-8
1,293
2.515625
3
[]
no_license
package com.example.demo384test.model.Security; import com.example.demo384test.model.Member; import javax.persistence.*; import java.util.Collection; @Entity @Table(name = "roles") public class Role { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; @ManyToMany(mappedBy = "roles") private Collection<Member> members; @ManyToMany(fetch = FetchType.EAGER) @JoinTable( name = "roles_permissions", joinColumns = @JoinColumn( name = "role_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn( name = "permission_id", referencedColumnName = "id")) private Collection<Permission> permissions; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Collection<Permission> getPermissions() { return permissions; } public void setPermissions(Collection<Permission> permissions) { this.permissions = permissions; } @Override public String toString(){ return this.name; } }
true
ad56ba48c4b440cb072022346a72e54be53fabe7
Java
ghostsite/TED
/modules/common/src/main/java/com/ted/common/support/datetime/deser/DefaultDateTimeDeserializer.java
UTF-8
1,586
2.296875
2
[]
no_license
package com.ted.common.support.datetime.deser; import java.io.IOException; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.ReadableDateTime; import org.joda.time.ReadableInstant; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.datatype.joda.deser.DateTimeDeserializer; public class DefaultDateTimeDeserializer extends DateTimeDeserializer { DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss"); public DefaultDateTimeDeserializer(Class<? extends ReadableInstant> cls) { super(cls); } private static final long serialVersionUID = 1L; @Override public ReadableDateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); if (t == JsonToken.VALUE_NUMBER_INT) { return new DateTime(jp.getLongValue(), DateTimeZone.UTC); } if (t == JsonToken.VALUE_STRING) { String str = jp.getText().trim(); if (str.length() == 0) { // [JACKSON-360] return null; } //return new DateTime(str, DateTimeZone.UTC); formatter.parseDateTime(str); } throw ctxt.mappingException(getValueClass()); } }
true
2381005b5add3f6260ba7653eea0b20138fedc7e
Java
bweninger/APD3_Loja
/src/main/java/br/mackenzie/apd3/loja/config/WebMvcConfig.java
UTF-8
937
1.929688
2
[]
no_license
package br.mackenzie.apd3.loja.config; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration @EnableWebMvc public class WebMvcConfig extends WebMvcConfigurerAdapter { @Bean(name = "messageSource") public MessageSource configureMessageSource() { ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename("classpath:messages/messages*"); messageSource.setCacheSeconds(5); messageSource.setDefaultEncoding("UTF-8"); return messageSource; } }
true
61c454007a30667a663fa9fd5f66dd8aad5f35d5
Java
Vinrithi/Quiz4Bible
/java/com/vinrithi/biblequizz/MenuExpandableAdapter.java
UTF-8
3,816
1.96875
2
[]
no_license
package com.vinrithi.biblequizz; import android.app.ActivityManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.support.v4.widget.DrawerLayout; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import static android.content.Context.ACTIVITY_SERVICE; /** * Created by vinri on 1/3/2018. */ public class MenuExpandableAdapter extends BaseExpandableListAdapter { private Context context; private List<String> expListHeaders; private LinkedHashMap<String, List<String>> expListItems; MenuExpandableAdapter(Context context, LinkedHashMap<String, List<String>> expListItems){ this.context = context; this.expListHeaders = new ArrayList<>(expListItems.keySet()); this.expListItems = expListItems; } @Override public Object getChild(int listPosition, int expandedListPosition){ return this.expListItems.get(this.expListHeaders.get(listPosition)).get(expandedListPosition); } @Override public long getChildId(int listPosition, int expandedListPosition){ return expandedListPosition; } @Override public View getChildView(int listPosition, final int expandedListPosition, boolean isLastChild, View convertView, ViewGroup parent) { final String childValue = (String) getChild(listPosition, expandedListPosition); //int drawable_id = switchFunction(childValue); if (convertView == null) { LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = layoutInflater.inflate(R.layout.menu_explist_items, null); } final TextView eltItem = (TextView) convertView.findViewById(R.id.listItems); final RelativeLayout rlItem = (RelativeLayout) convertView.findViewById(R.id.rlMenuItems); eltItem.setText(childValue); parent.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); //m_icon.setImageResource(drawable_id); return convertView; } @Override public int getChildrenCount(int listPosition) { return this.expListItems.get(this.expListHeaders.get(listPosition)).size(); } @Override public Object getGroup(int listPosition) { return this.expListHeaders.get(listPosition); } @Override public int getGroupCount() { return this.expListHeaders.size(); } @Override public long getGroupId(int listPosition) { return listPosition; } @Override public View getGroupView(int listPosition, boolean isExpanded, View convertView, ViewGroup parent) { String listTitle = (String) getGroup(listPosition); if (convertView == null) { LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = layoutInflater.inflate(R.layout.menu_explist_group, null); } TextView listTitleTextView = (TextView) convertView.findViewById(R.id.listHeader); listTitleTextView.setText(listTitle); return convertView; } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int listPosition, int expandedListPosition) { return true; } }
true
d39ba73648d754412ac37935ffd6a4516c53c447
Java
ShwetaBGit/StudentApp1
/BeanFactoryPostProcessor-PropertiesFile/src/com/sb/servixe/LoanService.java
UTF-8
194
1.75
2
[]
no_license
package com.sb.servixe; import java.sql.SQLException; import com.sb.dto.CustomerDTO; public interface LoanService { public float calculate(CustomerDTO dto) throws SQLException; }
true
c719c19b8217c046d20b8a015c5b347f59779d95
Java
zXingchu/leetcode-HBDAI
/src/solution20/DivideTwoIntegers29.java
UTF-8
646
3.296875
3
[]
no_license
package solution20; public class DivideTwoIntegers29 { public int divide(int dividend, int divisor) { if (divisor == 0 || (dividend == Integer.MIN_VALUE && divisor == -1)) return Integer.MAX_VALUE; boolean sign = true; if ((dividend > 0 && divisor < 0) || (dividend < 0 && divisor > 0)) sign = false; long dvd = Math.abs((long) dividend); long dvs = Math.abs((long) divisor); int ans = 0; while (dvd >= dvs) { long temp = dvs, multiple = 1; while (dvd >= (temp << 1)) { temp <<= 1; multiple <<= 1; } dvd -= temp; ans += multiple; } return sign ? ans : -ans; } }
true
2fd4c792d8b7d329247cf3da1a283cc07f638a05
Java
Andresfm/Ejercicio_Listas
/src/main/java/co/edu/um/Biblioteca/Vista/ventanaUno.java
UTF-8
1,785
2.78125
3
[]
no_license
package co.edu.um.Biblioteca.Vista; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; /** * Created with IntelliJ IDEA. * User: Andres * Date: 18/08/13 * Time: 10:32 * To change this template use File | Settings | File Templates. */ public class ventanaUno extends JFrame implements ActionListener { private JButton ingresar = new JButton("Ingresar"); private JButton salir = new JButton("Salir"); private JLabel bienvenida = new JLabel("Bienvenido al Sistema de Libros U.M."); public ventanaUno() { ingresar.addActionListener(this); salir.addActionListener(this); this.setTitle("Ingreso a la Librería U.M."); this.getContentPane().setLayout(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ingresar.setBounds(240, 280, 100, 20); this.getContentPane().add(ingresar); salir.setBounds(360, 280, 100, 20); this.getContentPane().add(salir); bienvenida.setBounds(150, 80, 500, 80); this.getContentPane().add(bienvenida); bienvenida.setFont(new java.awt.Font("Bernard MT Condensed", 0, 28)); getContentPane().setBackground(new java.awt.Color(110, 163, 255)); setSize(700, 500); this.setVisible(true); } @Override //maneja los eventos de los botones public void actionPerformed(ActionEvent actionEvent) { if(actionEvent.getSource() == ingresar) { ventanaAdicionar prin = new ventanaAdicionar(); prin.setVisible(true); ventanaUno uno = new ventanaUno(); uno.setVisible(false); } if(actionEvent.getSource() == salir) { System.exit(0); } } }
true
44aa43a60451e7b6cb1293edf62eb91dd59352bf
Java
mathiascouste/mxlib
/src/main/java/eu/couste/common/rolessafety/RolesGranter.java
UTF-8
160
1.625
2
[ "MIT" ]
permissive
package eu.couste.common.rolessafety; import java.util.Set; public interface RolesGranter { Set<String> grantUserRoleOn(Object user, Object object); }
true
b720fcdc0ab3be1b091c3c0d11dc7ea9a55a6d8a
Java
Preston-PLB/AdvComp
/src/Queues/GuitarString.java
UTF-8
1,234
3.390625
3
[]
no_license
package Queues; /** * Created by 131111 on 9/6/2017. */ public class GuitarString { private ArrayQueue ring; private int tics = 0; private int size; public GuitarString(double frequency){ size = (int)Math.ceil(44100/frequency); ring = new ArrayQueue(size); } public GuitarString(double[] init){ ring = new ArrayQueue(0); ring.setQueue(init); } void pluck(){ ring.clear(); while(!ring.isFull()){ ring.enqueue(Math.random()-.5); } } void tic(){ tics++; // System.out.println(ring.size()); double a = ring.dequeue(); double b = ring.peek(); double result = (a+b)*.994*.5; // System.out.println(ring.size()); ring.enqueue(result); // System.out.println(ring); } void cycle(){ ring.enqueue(ring.dequeue()); } int time(){ return tics; } double sample(){ if(!ring.isEmpty()){ return ring.peek(); }else{ return 0; } } @Override public String toString() { return ring.toString(); } }
true
2afde7f3923c7b998737dcef30edfd284a2cdeb1
Java
PrithiviKhatri/Project_Trioz
/src/main/java/trioz/project/controller/AssignmentController.java
UTF-8
4,036
2.140625
2
[]
no_license
package trioz.project.controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.bind.support.SessionStatus; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import trioz.project.domain.Assignment; import trioz.project.domain.Course; import trioz.project.service.AssignmentService; import trioz.project.service.CourseService; import trioz.project.utility.SessionCheck; @Controller @RequestMapping({ "/assignment" }) @SessionAttributes({ "user", "course" }) public class AssignmentController { @Autowired private AssignmentService assignmentService; @Autowired CourseService courseService; @RequestMapping(value = { "/add" }, method = RequestMethod.GET) public String addAssignment(@ModelAttribute("newAssignment") Assignment assignment, Model model) { if (!SessionCheck.isUserExistsInSessionExists(model)) { System.out.println("inside session check"); return "redirect:/logout"; } return "addAssignment"; } @RequestMapping(value = "/add", method = RequestMethod.POST) public String saveAssignment(@Valid @ModelAttribute("newAssignment") Assignment assignment, BindingResult bindResult, RedirectAttributes redirectAttributes, Model model) { if (!SessionCheck.isUserExistsInSessionExists(model)) { System.out.println("inside session check"); return "redirect:/logout"; } model.addAttribute(assignment); if (bindResult.hasErrors()) { return "addAssignment"; } Course course = (Course) model.asMap().get("course"); course.addAssignments(assignment); courseService.save(course); redirectAttributes.addFlashAttribute("assignment", assignment); model.addAttribute("assignment", assignment); return "redirect:/assignment/show"; } @RequestMapping(value = "/show", method = RequestMethod.GET) public String showAssignment(SessionStatus sessionStatus) { sessionStatus.setComplete(); return "assignment"; } @RequestMapping(value = "/delete/{courseId}/{assignmentId}", method = RequestMethod.GET) public String showAssignment(@PathVariable("courseId") Long courseId, @PathVariable("assignmentId") Long assignmentId, Model model) { if (!SessionCheck.isUserExistsInSessionExists(model)) { System.out.println("inside session check"); return "redirect:/logout"; } assignmentService.deleteAssignment(assignmentId); return "redirect:/course/area?courseId=" + courseId; } @PreAuthorize("hasRole('ROLE_PROFESSOR')") @RequestMapping(value = "/edit/{assignmentId}", method = RequestMethod.GET) public String updateForm(@PathVariable("assignmentId") Long assignmentId, Model model) { if (!SessionCheck.isUserExistsInSessionExists(model)) { System.out.println("inside session check"); return "redirect:/logout"; } Assignment toBeUpdated = assignmentService.getAssignmentById(assignmentId); model.addAttribute("updateAssignment", toBeUpdated); System.out.println("toBeUpdated-id:" + toBeUpdated.getAssignmentId()); return "editAssignment"; } @PreAuthorize("hasRole('ROLE_PROFESSOR')") @RequestMapping(value = "/saveUpdate", method = RequestMethod.POST) public String updateAssignment(@ModelAttribute("updateAssignment") Assignment assignment, Model model) { if (!SessionCheck.isUserExistsInSessionExists(model)) { System.out.println("inside session check"); return "redirect:/logout"; } System.out.println("id:" + assignment.getAssignmentId()); assignmentService.save(assignment); return "assignment"; } }
true
7476a0bc53adaa6de4b27c8abfd71e22b05910d4
Java
dh37789/project_002
/src/main/java/kr/or/ddit/projectWork/service/ProjectWorkService.java
UTF-8
1,427
2.09375
2
[]
no_license
package kr.or.ddit.projectWork.service; import java.util.List; import java.util.Map; import kr.or.ddit.vo.WorkVO; public interface ProjectWorkService { /** * 오명학 * 일감 목록의 수를 가져온다 * @param params * @return * @throws Exception */ int totalCount(Map<String, String> params) throws Exception; /** * 오명학 * 일감 목록을 가져온다. * @param params * @return * @throws Exception */ List<WorkVO> boardList(Map<String, String> params) throws Exception; /** * 일감 등록 * @param workInfo */ void insertWork(WorkVO workInfo) throws Exception; /** * 일감 정보를 가져온다. * @param params * @return * @throws Exception */ WorkVO boardInfo(Map<String, String> params) throws Exception; /** * 일감 삭제 * @param params * @throws Exception */ void deleteWork(Map<String, String> params) throws Exception; /** * 일감 수정 * @param workInfo */ void updateWork(WorkVO workInfo) throws Exception; /** * 일감 상위목록 * @param params * @return */ List<WorkVO> orderList(Map<String, String> params) throws Exception; /** * 상위 일감 정보 * @param params * @return * @throws Exception */ WorkVO orderInfo(Map<String, String> params) throws Exception; /** * 차트 리스트 * @param params * @return */ List<WorkVO> chartList(Map<String, String> params) throws Exception; }
true
ed6bcee24a145877578dcd21174ea4cba6380fd5
Java
Banseok6711/EnglishWordReview
/src/Main.java
UHC
426
2.078125
2
[]
no_license
import java.util.ArrayList; import util.Random; import common.Sentence; import execl.ExelData; import frame.Gui; public class Main { public static void main(String[] args){ //Exel access ExelData data= new ExelData(); ArrayList<Sentence> totalList = data.loadData(); //GUI ȭ Gui gui =new Gui(totalList); //ȭ鿡 ʿ ҵ gui.start(); } }
true
79a7aa83307806559eda638ede9c826a8c83a7e0
Java
xsm535820171/DemoCallBack
/app/src/main/java/com/my/democallback/CallBackData.java
UTF-8
407
2.3125
2
[]
no_license
package com.my.democallback; /** * Created by AOW on 2018/7/4. */ public class CallBackData { //定义接口的成员变量 public ICallBack iCallBack; //给接口对象变量赋值 public void setCallBack(ICallBack callBack){ iCallBack=callBack; } // 调用接口对象中的方法 public void doSomething(String content){ iCallBack.fail(content); } }
true
f9f71b05b45f691bafaf400295d29ec0436f7ced
Java
koentsje/jbosstools-hibernate
/orm/test/core/org.jboss.tools.hibernate.orm.test/src/org/jboss/tools/hibernate/orm/test/CoreMappingTest.java
UTF-8
5,784
1.640625
2
[]
no_license
package org.jboss.tools.hibernate.orm.test; import java.util.Arrays; import java.util.Collection; import org.jboss.tools.hibernate.orm.test.utils.CoreMappingTestHelper; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Test; import org.junit.rules.TestName; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class CoreMappingTest { @Parameters(name = "{0}") public static Collection<Object[]> packages() { return Arrays.asList(new Object[][]{ {"core.abstractembeddedcomponents.cid"}, {"core.abstractembeddedcomponents.propertyref"}, {"core.any"}, {"core.array"}, {"core.batch"}, {"core.batchfetch"}, {"core.bytecode"}, {"core.cache"}, {"core.cascade"}, {"core.cid"}, {"core.collection.bag"}, {"core.collection.idbag"}, {"core.collection.list"}, {"core.collection.map"}, {"core.collection.original"}, {"core.collection.set"}, {"core.component.basic"}, {"core.component.cascading.collection"}, {"core.component.cascading.toone"}, {"core.compositeelement"}, {"core.connections"}, {"core.criteria"}, {"core.cuk"}, {"core.cut"}, {"core.deletetransient"}, {"core.dialect.functional.cache"}, {"core.discriminator"}, {"core.discriminator"}, {"core.dynamicentity.interceptor"}, {"core.dynamicentity.tuplizer"}, {"core.ecid"}, {"core.entitymode.dom4j.many2one"}, {"core.entitymode.multi"}, {"core.exception"}, {"core.extralazy"}, {"core.filter"}, {"core.formulajoin"}, {"core.generatedkeys.identity"}, {"core.generatedkeys.select"}, {"core.generatedkeys.seqidentity"}, {"core.id"}, {"core.idbag"}, {"core.idclass"}, {"core.idprops"}, {"core.immutable"}, {"core.insertordering"}, {"core.instrument.domain"}, {"core.interceptor"}, {"core.interfaceproxy"}, {"core.iterate"}, {"core.join"}, {"core.joinedsubclass"}, {"core.joinfetch"}, {"core.jpa"}, {"core.jpa.cascade"}, {"core.jpa.fetch"}, {"core.lazycache"}, {"core.lazyonetoone"}, {"core.lob"}, {"core.manytomany"}, {"core.manytomany.ordered"}, {"core.map"}, {"core.mapcompelem"}, {"core.mapelemformula"}, {"core.mixed"}, {"core.naturalid"}, {"core.ondelete"}, {"core.onetomany"}, {"core.onetoone.formula"}, {"core.onetoone.joined"}, {"core.onetoone.link"}, {"core.onetoone.optional"}, {"core.onetoone.singletable"}, {"core.ops"}, {"core.optlock"}, {"core.ordered"}, {"core.orphan"}, {"core.pagination"}, {"core.propertyref.basic"}, {"core.propertyref.component.complete"}, {"core.propertyref.component.partial"}, {"core.propertyref.inheritence.discrim"}, {"core.propertyref.inheritence.joined"}, {"core.propertyref.inheritence.union"}, {"core.proxy"}, {"core.querycache"}, {"core.readonly"}, {"core.reattachment"}, {"core.rowid"}, {"core.sorted"}, {"core.sql.check"}, {"core.stateless"}, {"core.subselect"}, {"core.subselectfetch"}, {"core.ternary"}, {"core.timestamp"}, {"core.tool"}, {"core.typedmanytoone"}, {"core.typedonetoone"}, {"core.typeparameters"}, {"core.unconstrained"}, {"core.unidir"}, {"core.unionsubclass"}, {"core.unionsubclass2"}, {"core.usercollection.basic"}, {"core.usercollection.parameterized"}, {"core.value.type.basic"}, {"core.value.type.collection.list"}, {"core.value.type.collection.map"}, {"core.value.type.collection.set"}, {"core.version.db"}, {"core.version.nodb"}, {"core.where"} }); } @ClassRule public static TestName testName = new TestName(); private static CoreMappingTestHelper mappingTestHelper = null; @BeforeClass public static void beforeClass() throws Exception { mappingTestHelper = new CoreMappingTestHelper(testName); mappingTestHelper.beforeClass(); } @AfterClass public static void afterClass() { mappingTestHelper.afterClass(); mappingTestHelper = null; } private String packageName = null; public CoreMappingTest(String packageName) { this.packageName = packageName; } @Before public void before() throws Exception { mappingTestHelper.before(packageName); } @After public void after() throws Exception { mappingTestHelper.after(packageName); } @Test public void testCheckConsoleConfiguration() { mappingTestHelper.testCheckConsoleConfiguration(); } @Test public void testOpenMappingDiagram() { mappingTestHelper.testOpenMappingDiagram(); } @Test public void testOpenMappingFileTest() { mappingTestHelper.testOpenMappingFileTest(packageName); } @Test public void testOpenSourceFileTest() { mappingTestHelper.testOpenSourceFileTest(); } @Test public void testHbmExportExceptionTest() throws Exception { mappingTestHelper.testHbmExportExceptionTest(packageName); } }
true
de8791c2245b4302c7bd913f1f7edd57a679c3a7
Java
jonathan-perucca/discord-presence-bot
/src/test/java/com/under/discord/session/domain/SessionTest.java
UTF-8
1,634
2.421875
2
[]
no_license
package com.under.discord.session.domain; import net.dv8tion.jda.core.entities.User; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import java.time.LocalDate; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; @RunWith(MockitoJUnitRunner.class) public class SessionTest { Session session; @Mock User user; @Test public void should_compute_spentTime_when_stop_session() throws InterruptedException { LocalDate startDate = LocalDate.now(); given( user.getName() ).willReturn( "john" ); session = new Session(startDate, new SessionTimer()); session.declarePresence(user); Thread.sleep(2000L); session.stop(); assertThat( session.getSessionTimeFor("john") ).isEqualTo(2L); } @Test public void should_compute_spentTime_when_userLeave_and_stop_session() throws InterruptedException { LocalDate startDate = LocalDate.now(); User smith = mock(User.class); given( user.getName() ).willReturn( "john" ); given( smith.getName() ).willReturn( "smith" ); session = new Session(startDate, new SessionTimer()); session.declarePresence(user); session.declarePresence(smith); Thread.sleep(2000L); session.declareLeave(smith); session.stop(); assertThat( session.getSessionTimeFor("john") ).isEqualTo(2); assertThat( session.getSessionTimeFor("smith") ).isEqualTo(2); } }
true
0ebf4732dfcad1b666db6b7173bbdf0b7dd42cce
Java
yanfa401/bfxy-master
/bfxy-order/src/main/java/com/bfxy/bfxyorder/service/OrderServiceI.java
UTF-8
346
1.789063
2
[]
no_license
package com.bfxy.bfxyorder.service; import com.bfxy.bfxyorder.entity.dto.OrderDto; import com.bfxy.common.dto.Result; public interface OrderServiceI { /** * 创建订单 * @param orderDto * @return */ Result createOrder(OrderDto orderDto); void sendOrderlyMessage4Pkg(String userId, String orderId); }
true
4990eec9d9bca187c2b3a568f1d654daa6230a8a
Java
Adele0/MyJavaCodeDemo
/day25/io/buffered/TestBufferedReader.java
UTF-8
783
3.28125
3
[]
no_license
package cn.itsource.io.buffered; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class TestBufferedReader { public static void main(String[] args) throws IOException { // BufferedReader是字符的缓存流,在读的时候,对应 用fileReader BufferedReader br = new BufferedReader(new FileReader("BufferedReader")); /* System.out.println(br.readLine());//以行为单位进行读取,读取后可以直接打印 System.out.println(br.readLine()); System.out.println(br.readLine()); System.out.println(br.readLine()); */ String line = "";//当通过循环来一次性打印所有的行,需要存储每行内容先 while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); } }
true
871b4da5da4bc69ff4aa5500ebdfcc41f68260d2
Java
DChenet/Genie_Logiciel_XiangQi_L2S2
/src/intelligence/PriorityMove.java
UTF-8
2,412
3.234375
3
[]
no_license
package intelligence; import strategy.data.Coordinates; /** * PirorityMove objects are used by XiangQi's AI {@link Chesster}. A * PriorityMove associated a move (piece to move and where to put the piece) to * a priority weight (priority). * * @see Chesster * @author Dorian CHENET * */ public class PriorityMove { /* * The coordonates of the piece to move. */ private Coordinates initial = null; /* * The position where the AI must put the piece. */ private Coordinates finalposition = null; /* * The priority of the move. */ private int priority = 0; public PriorityMove() { // TODO Auto-generated constructor stub } public PriorityMove(Coordinates initial, Coordinates finalposition, int priority) { super(); this.initial = initial; this.finalposition = finalposition; this.priority = priority; } public Coordinates getInitial() { return initial; } public void setInitial(Coordinates initial) { this.initial = initial; } public Coordinates getFinalposition() { return finalposition; } public void setFinalposition(Coordinates finalposition) { this.finalposition = finalposition; } public int getPriority() { return priority; } public void setPriority(int priority) { this.priority = priority; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((finalposition == null) ? 0 : finalposition.hashCode()); result = prime * result + ((initial == null) ? 0 : initial.hashCode()); result = prime * result + priority; return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PriorityMove other = (PriorityMove) obj; if (finalposition == null) { if (other.finalposition != null) return false; } else if (!finalposition.equals(other.finalposition)) return false; if (initial == null) { if (other.initial != null) return false; } else if (!initial.equals(other.initial)) return false; if (priority != other.priority) return false; return true; } @Override public String toString() { return "PriorityMove [initial=" + initial + ", finalposition=" + finalposition + ", priority=" + priority + "]"; } }
true
bbd0a2d9a7b8277d3837fe7b0cd9745775b24de9
Java
gpalacioss/poc-microservice
/facultamiento/src/main/java/com/legosoft/facultades/commands/rol/DisableRolCommand.java
UTF-8
340
1.570313
2
[]
no_license
package com.legosoft.facultades.commands.rol; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.axonframework.commandhandling.TargetAggregateIdentifier; @Data @AllArgsConstructor @NoArgsConstructor public class DisableRolCommand { @TargetAggregateIdentifier private Long idRol; }
true
c81265ac617d59ca7108939551e160d12e66927e
Java
zenja/coursera-algorithm-part1
/hw2/RandomizedQueue.java
UTF-8
2,757
3.609375
4
[]
no_license
import edu.princeton.cs.algs4.StdRandom; import java.util.Iterator; import java.util.NoSuchElementException; public class RandomizedQueue<Item> implements Iterable<Item> { private Item[] items; private int sz = 0; // construct an empty randomized queue public RandomizedQueue() { items = (Item[]) new Object[1]; } // is the queue empty? public boolean isEmpty() { return size() == 0; } // return the number of items on the queue public int size() { return sz; } // add the item public void enqueue(Item item) { if (item == null) throw new NullPointerException("Cannot add null item"); if (sz == items.length) resize(2 * sz); int randomIdx = StdRandom.uniform(sz + 1); items[sz++] = items[randomIdx]; items[randomIdx] = item; } // remove and return a random item public Item dequeue() { if (isEmpty()) throw new NoSuchElementException("Cannot dequeue from an empty queue"); Item result = items[sz - 1]; items[sz - 1] = null; // avoid loitering sz--; if (sz < items.length / 4) { resize(items.length / 2); } return result; } // return (but do not remove) a random item public Item sample() { if (isEmpty()) throw new NoSuchElementException("Cannot sample from an empty queue"); return items[StdRandom.uniform(sz)]; } // return an independent iterator over items in random order public Iterator<Item> iterator() { return new RandomizedQueueIterator(); } private class RandomizedQueueIterator implements Iterator<Item> { int currentIdx = 0; Item[] arr; public RandomizedQueueIterator() { arr = (Item[]) new Object[sz]; for (int i = 0; i < sz; i++) { arr[i] = items[i]; } StdRandom.shuffle(arr); } @Override public boolean hasNext() { return currentIdx < arr.length; } @Override public Item next() { if (!hasNext()) { throw new NoSuchElementException("Calling next() on an empty iterator"); } return arr[currentIdx++]; } @Override public void remove() { throw new UnsupportedOperationException("Cannot remove in RandomizedQueue iterator"); } } private void resize(int capacity) { Item[] newItems = (Item[]) new Object[capacity]; for (int i = 0; i < sz; i++) { newItems[i] = items[i]; } items = newItems; } // unit testing (optional) public static void main(String[] args) { } }
true
a4b425585791e30d94eea104300297470e5b84be
Java
ankawm/Charity
/src/main/java/pl/coderslab/charity/repository/UserRepository.java
UTF-8
660
1.96875
2
[]
no_license
package pl.coderslab.charity.repository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import pl.coderslab.charity.domain.User; import java.util.List; @Repository public interface UserRepository extends JpaRepository<User, Long> { User findByUsername(String username); List<User> findAll(); //@Query(value = "SELECT * FROM tweeter_tweet WHERE title LIKE ?1% ORDER BY created DESC", nativeQuery = true) //List<User> customFindTweet(String tweetStartWith); }
true
eba1278aa163524512091e8f79da286f50771b1f
Java
rdeltour/jing-issue-240
/src/main/java/org/example/epubcheck/issue_859/App.java
UTF-8
1,168
2.0625
2
[]
no_license
package org.example.epubcheck.issue_859; import java.net.URL; import org.xml.sax.InputSource; import com.thaiopensource.util.PropertyMapBuilder; import com.thaiopensource.validate.SchemaReader; import com.thaiopensource.validate.auto.AutoSchemaReader; import com.thaiopensource.validate.auto.SchemaReaderFactorySchemaReceiverFactory; import com.thaiopensource.validate.schematron.NewSaxonSchemaReaderFactory; /** * Hello world! * */ public class App { public static boolean main(String[] args) { try { String schemaPath = "schema.sch"; URL schemaURL = App.class.getResource(schemaPath); InputSource schemaSource = new InputSource(schemaURL.toString()); PropertyMapBuilder mapBuilder = new PropertyMapBuilder(); // mapBuilder.put(ValidateProperty.ERROR_HANDLER, // new ErrorHandlerImpl()); SchemaReader schemaReader; schemaReader = new AutoSchemaReader( new SchemaReaderFactorySchemaReceiverFactory(new NewSaxonSchemaReaderFactory())); schemaReader.createSchema(schemaSource, mapBuilder.toPropertyMap()); return true; } catch (Exception e) { e.printStackTrace(); return false; } } }
true
7732ee40c34b209bb69ed04ea521bad71d46c837
Java
NachoSupreme/Java-Examples
/JavaExamples/RandomAdding.java
UTF-8
304
3.21875
3
[]
no_license
class RandomAdding { public static void main(String[] args) { int y; int x = (int) (Math.random() * 100); int sum = 0; for (x%2==0; y=0; y <= number1; y++) { sum = sum+y; } System.out.println(" The number is " + x); System.out.println(" The sum of even numbers is " + sum);} } }
true
64594f90068171602fcd21963eacff8e864275db
Java
AMORHLS/springboot-demo
/src/main/java/com/hls/web/listener/RoadListener.java
UTF-8
788
2.078125
2
[]
no_license
package com.hls.web.listener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; /** * @Package: com.hls.web.listener * @Author: helishi * @CreateDate: 2017/12/8 * @Description: 监听器 */ @WebListener public class RoadListener implements ServletContextListener { private Logger logger = LoggerFactory.getLogger(getClass()); @Override public void contextInitialized(ServletContextEvent sce) { logger.info("RoadListener$$$$$$$$$$$$$$$$$$contextInitialized"); } @Override public void contextDestroyed(ServletContextEvent sce) { logger.info("RoadListener$$$$$$$$$$$$$$$$$$contextDestroyed"); } }
true
38267181334f2e017a39e22c953dabf478258e7e
Java
ajcabrera/schedule-generator
/Entrega_Final_Scheduler/Fonts/schedule/gui/ProgramLoad.java
UTF-8
9,597
2.546875
3
[]
no_license
package schedule.gui; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.*; public class ProgramLoad extends JFrame implements ActionListener{ private static String user; private static JButton helpButton; private JTextArea helpText; private final JFileChooser openFileChooser; private JButton loadEI = new JButton("Load file"); private JButton newEI = new JButton("New file"); private JButton okButton = new JButton("Start"); private JRadioButton chooseAdmin = new JRadioButton("Admin"); private JRadioButton chooseUser = new JRadioButton("User"); private ButtonGroup radios = new ButtonGroup(); private JLabel UPC = new JLabel("FIB - UPC (Universitat Politècnica de Catalunya) "); private JLabel nameEducationalInstitution = new JLabel(""); public ProgramLoad() { super("Schedule-Generator"); JTextArea helpText = new JTextArea(""); JPanel mainPanel = new JPanel(); JTextArea route = new JTextArea(); route.setMargin(new Insets(10,10,10,10)); radios.add(chooseAdmin); radios.add(chooseUser); chooseAdmin.setSelected(true); user = chooseAdmin.isSelected() ? "Admin" : "User" ; openFileChooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("Text files", "txt"); openFileChooser.setCurrentDirectory(new File("c:\\temp")); openFileChooser.setFileFilter(filter); chooseAdmin.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent actionEvent) { newEI.setEnabled(true); user = "Admin"; } }); chooseUser.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent actionEvent) { newEI.setEnabled(false); route.setText(""); user = "User"; } }); okButton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent actionEvent) { String fullPath = route.getText(); int i = fullPath.lastIndexOf('/'); int j = fullPath.lastIndexOf('.'); String ei = j < 0 ? fullPath.substring(i+1) : fullPath.substring(i+1, j); if(!fullPath.equals("") && ei.length() > 0) { MainFrame mf = new MainFrame(route.getText(),user,ei); closeWelcomeScreen(); } } }); newEI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent actionEvent) { route.setText("Write here a name for your file"); route.setFocusable(true); } }); loadEI.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { int retVal = openFileChooser.showOpenDialog(null); if(retVal == JFileChooser.APPROVE_OPTION) { JOptionPane.showMessageDialog(null,"File successfully loaded"); route.setText(openFileChooser.getSelectedFile().getAbsolutePath()); route.setFocusable(false); PresentationControl pc = PresentationControl.getInstance(); pc.load(openFileChooser.getSelectedFile().getAbsolutePath()); } else JOptionPane.showMessageDialog(null,"No file selected"); }; }); setLayout(new BorderLayout()); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); JPanel row1 = new JPanel(); row1.setLayout(new FlowLayout(FlowLayout.RIGHT)); JPanel row2 = new JPanel(); row2.setLayout(new FlowLayout(FlowLayout.CENTER)); JPanel row3 = new JPanel(); row3.setLayout(new FlowLayout(FlowLayout.CENTER)); JPanel row4 = new JPanel(); row4.setLayout(new FlowLayout(FlowLayout.CENTER)); JPanel row5 = new JPanel(); row5.setLayout(new FlowLayout(FlowLayout.LEFT)); JPanel row6 = new JPanel(); row6.setLayout(new FlowLayout(FlowLayout.RIGHT)); JPanel row7 = new JPanel(); row7.setLayout(new FlowLayout(FlowLayout.RIGHT)); row1.setBorder(BorderFactory.createEtchedBorder(0)); row1.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row2.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row3.setBorder(BorderFactory.createEtchedBorder(1)); row3.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row4.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row5.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row6.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row7.setBorder(BorderFactory.createEtchedBorder(1)); row7.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); mainPanel.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); Dimension widDim = new Dimension(1000,50); /* row1.setPreferredSize(widDim); row2.setPreferredSize(widDim); row3.setPreferredSize(widDim); row4.setPreferredSize(widDim); row5.setPreferredSize(widDim); row6.setPreferredSize(widDim); row7.setPreferredSize(widDim); */ gc.gridy = 0; gc.weighty = 0.1; mainPanel.add(row1,gc); gc.gridy++; gc.weighty = 0.3; mainPanel.add(row2,gc); gc.gridy++; gc.weighty = 0.1; mainPanel.add(row3,gc); gc.gridy++; gc.weighty = 0.125; mainPanel.add(row4,gc); gc.gridy++; gc.weighty = 0.125; mainPanel.add(row5,gc); gc.gridy++; gc.weighty = 0.15; mainPanel.add(row6,gc); gc.gridy++; gc.weighty = 0.1; mainPanel.add(row7,gc); add(mainPanel, BorderLayout.CENTER); mainPanel.setVisible(true); /* ------------------------------------- TITLE PANEL ------------------------------------- */ JLabel title = new JLabel("Schedule-Generator"); Font letra = title.getFont(); int fontSize = letra.getSize(); title.setFont(new Font( letra.getName(), Font.BOLD, fontSize*5)); JPanel auxiliar = new JPanel(); auxiliar.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); auxiliar.setPreferredSize(widDim); row1.add(auxiliar); JButton helpButton = new JButton("Show Help"); row1.add(helpButton); helpButton.addActionListener(this); row2.add(title); /* ------------------------------------- RADIO BUTTONS - Admin/User ------------------------------------- */ chooseAdmin.setPreferredSize(new Dimension(150, 80)); chooseUser.setPreferredSize(new Dimension(150, 80)); chooseAdmin.setFont(new Font( letra.getName(), Font.BOLD, (int)(fontSize*1.7))); chooseUser.setFont(new Font( letra.getName(), Font.BOLD, (int)(fontSize*1.7))); row3.add(chooseAdmin); row3.add(chooseUser); helpText.setFocusable(false); /* ------------------------------------- BUTTONS - New/Load ------------------------------------- */ newEI.setPreferredSize(new Dimension(200, 60)); loadEI.setPreferredSize(new Dimension(200, 60)); newEI.setFont(new Font( letra.getName(), Font.PLAIN, (int)(fontSize*1.3))); loadEI.setFont(new Font( letra.getName(), Font.PLAIN, (int)(fontSize*1.3))); JPanel sepButtons = new JPanel(); sepButtons.setPreferredSize(new Dimension(25,25)); sepButtons.setBackground(Color.getHSBColor(0.6f, 0.12f, 0.9f)); row4.add(newEI); row4.add(sepButtons); row4.add(loadEI); /* ------------------------------------- ROUTE + OK ------------------------------------- */ route.setPreferredSize(new Dimension(400, 50)); okButton.setPreferredSize(new Dimension(150, 50)); route.setBorder(BorderFactory.createEtchedBorder()); route.setFocusable(false); row5.add(route); row6.add(okButton); /* ------------------------------------- Lower Panel - UPC ------------------------------------- */ row7.setBorder(BorderFactory.createEtchedBorder(0)); row7.add(UPC); /* ---------------------------------------- Window dimensions and features ---------------------------------------- */ setSize(1280,720); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public void closeWelcomeScreen() { this.dispose(); } public static void main(String[] args) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException { UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); SwingUtilities.invokeLater(new Runnable() { public void run(){ ProgramLoad PL = new ProgramLoad(); } }); } private String getDescription(String key){ Descriptor d = null; return d.getDescription(key); } @Override public void actionPerformed(ActionEvent a) { JOptionPane.showConfirmDialog(this, getDescription("welcomeHelp"), "HELP", JOptionPane.DEFAULT_OPTION); } }
true
36afd90329bb16def1aa21b5420901180b0b5f14
Java
script-source-net/oop
/src/com/company/ueb10_5/Tierleben.java
UTF-8
896
3.421875
3
[]
no_license
package com.company.ueb10_5; public class Tierleben { /* public static void gibAus(Object tier) { System.out.println("Objekt: " + tier); } */ /* public static void gibAus (Katze tier) { System.out.println("Katze: " + tier); } */ public static <T> void gibAus(T tier) { System.out.println("Unbekannt: " + tier); } public static <T extends Tier> void gibAus(T tier) { System.out.println("Tier: " + tier); } public static <T extends Haustier> void gibAus(T tier) { System.out.println("Haustier: " + tier); } public static <T extends Wildtier> void gibAus(T tier) { System.out.println("Wildtier: " + tier); } public static void main(String[] args) { gibAus("Amoebe"); gibAus(new Katze()); gibAus(new Hauskatze()); gibAus(new Wildkatze()); } }
true
21e090635f5c26b53ac18ac4b25d1b1a2bc35e0a
Java
liuhuac/leetcode
/src/edu/clemson/ece/leetcode/FourSum/FourSum.java
UTF-8
1,503
3.3125
3
[]
no_license
package edu.clemson.ece.leetcode.FourSum; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class FourSum { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } public List<List<Integer>> fourSum(int[] nums, int target) { List<List<Integer>> ans = new ArrayList<>(); Arrays.sort(nums); for(int i=0; i<nums.length-3; i++){ if(i>0&&nums[i]==nums[i-1]) continue; for(int j=i+1; j<nums.length-2; j++){ if(j>i+1&&nums[j]==nums[j-1]) continue; int l=j+1, r=nums.length-1; while(l<r){ int sum = nums[i]+nums[j]+nums[l]+nums[r]; if(sum==target){ List<Integer> list = new ArrayList<>(); list.add(nums[i]); list.add(nums[j]); list.add(nums[l]); list.add(nums[r]); ans.add(list); while(l<r&&nums[l]==nums[l+1]) l++; while(l<r&&nums[r]==nums[r-1]) r--; l++; r--; } else if(sum>target){ r--; } else if(sum<target){ l++; } } } } return ans; } }
true
6a8c301f400ba2364ec8c7ad8fd9e04be0293737
Java
alsmwsk/golfmon
/app/src/main/java/com/google/android/gms/fitness/result/DataSourcesResult.java
UTF-8
3,196
1.859375
2
[]
no_license
package com.google.android.gms.fitness.result; import android.os.Parcel; import android.os.Parcelable.Creator; import com.google.android.gms.common.api.Result; import com.google.android.gms.common.api.Status; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; import com.google.android.gms.fitness.data.DataSource; import com.google.android.gms.fitness.data.DataType; import com.google.android.gms.internal.jv; import com.google.android.gms.internal.jv.a; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class DataSourcesResult implements Result, SafeParcelable { public static final Parcelable.Creator<DataSourcesResult> CREATOR = new c(); private final int CK; private final Status Eb; private final List<DataSource> VH; DataSourcesResult(int paramInt, List<DataSource> paramList, Status paramStatus) { this.CK = paramInt; this.VH = Collections.unmodifiableList(paramList); this.Eb = paramStatus; } public DataSourcesResult(List<DataSource> paramList, Status paramStatus) { this.CK = 3; this.VH = Collections.unmodifiableList(paramList); this.Eb = paramStatus; } public static DataSourcesResult D(Status paramStatus) { return new DataSourcesResult(Collections.emptyList(), paramStatus); } private boolean b(DataSourcesResult paramDataSourcesResult) { return (this.Eb.equals(paramDataSourcesResult.Eb)) && (jv.equal(this.VH, paramDataSourcesResult.VH)); } public int describeContents() { return 0; } public boolean equals(Object paramObject) { return (this == paramObject) || (((paramObject instanceof DataSourcesResult)) && (b((DataSourcesResult)paramObject))); } public List<DataSource> getDataSources() { return this.VH; } public List<DataSource> getDataSources(DataType paramDataType) { ArrayList localArrayList = new ArrayList(); Iterator localIterator = this.VH.iterator(); while (localIterator.hasNext()) { DataSource localDataSource = (DataSource)localIterator.next(); if (localDataSource.getDataType().equals(paramDataType)) { localArrayList.add(localDataSource); } } return Collections.unmodifiableList(localArrayList); } public Status getStatus() { return this.Eb; } int getVersionCode() { return this.CK; } public int hashCode() { Object[] arrayOfObject = new Object[2]; arrayOfObject[0] = this.Eb; arrayOfObject[1] = this.VH; return jv.hashCode(arrayOfObject); } public String toString() { return jv.h(this).a("status", this.Eb).a("dataSets", this.VH).toString(); } public void writeToParcel(Parcel paramParcel, int paramInt) { c.a(this, paramParcel, paramInt); } } /* Location: C:\Users\TGKIM\Downloads\작업폴더\리버싱\androidReversetools\jd-gui-0.3.6.windows\com.appg.golfmon-1-dex2jar.jar * Qualified Name: com.google.android.gms.fitness.result.DataSourcesResult * JD-Core Version: 0.7.0.1 */
true
25130780813d6610ad488611647d78dc04ebda51
Java
bhaskar2500/lowes
/urlshortner/src/main/java/com/lowes/urlshortner/dao/models/URL.java
UTF-8
886
2.453125
2
[]
no_license
package com.lowes.urlshortner.dao.models; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "url") public class URL { public URL() { } public URL(Long id, String key, String longUrl) { this.key = key; this.longUrl = longUrl; this.id = id; } private String key; @Column(name = "long_url") private String longUrl; @Id private Long id; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getLongUrl() { return longUrl; } public void setLongUrl(String longUrl) { this.longUrl = longUrl; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
true
e34370b0cfb0fe66cff2a220a557f95fb4b18346
Java
radhoinbhk/forsimport
/src/main/java/com/leoni/forsimport/model/Error.java
UTF-8
575
2.234375
2
[]
no_license
package com.leoni.forsimport.model; public class Error { private String typeError ; private int numCellError ; /** * @return the typeError */ public String getTypeError() { return typeError; } /** * @param typeError the typeError to set */ public void setTypeError(String typeError) { this.typeError = typeError; } /** * @return the locationError */ public int getNumCellError() { return numCellError; } /** * @param locationError the locationError to set */ public void setNumCellError(int cell) { this.numCellError = cell; } }
true
ed1379f74c0bfb1a1d332af6a04b6b7c6cfb9a1f
Java
stalary/UserCenter
/src/main/java/com/stalary/usercenter/data/dto/HttpResult.java
UTF-8
390
1.671875
2
[ "MIT" ]
permissive
package com.stalary.usercenter.data.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; /** * HttpResult * * @author lirongqian * @since 2018/03/25 */ @Data @NoArgsConstructor @AllArgsConstructor public class HttpResult { /** * 响应码 */ private Integer code; /** * 响应体 */ private String body; }
true
d91fcebbf565a3d6bc77e225dc5960413b0f1109
Java
sDebski/DesignPatterns
/Exercises/ObjectPool/src/main/java/mainpackage/model/Value.java
UTF-8
407
2.8125
3
[]
no_license
package mainpackage.model; public class Value { private double _value; public Value() {}; public Value(double value) { this._value = value; } public double getValue() { return _value; } public void setValue(double value) { this._value = value; } @Override public String toString() { return String.format("[%.4f]", _value); } }
true
8d6511cda65d6415761329147afa6bd6ac0dfba8
Java
ryangardner/excursion-decompiling
/divestory-Fernflower/io/opencensus/tags/Tag.java
UTF-8
667
2.234375
2
[]
no_license
package io.opencensus.tags; public abstract class Tag { private static final TagMetadata METADATA_UNLIMITED_PROPAGATION; static { METADATA_UNLIMITED_PROPAGATION = TagMetadata.create(TagMetadata.TagTtl.UNLIMITED_PROPAGATION); } Tag() { } @Deprecated public static Tag create(TagKey var0, TagValue var1) { return create(var0, var1, METADATA_UNLIMITED_PROPAGATION); } public static Tag create(TagKey var0, TagValue var1, TagMetadata var2) { return new AutoValue_Tag(var0, var1, var2); } public abstract TagKey getKey(); public abstract TagMetadata getTagMetadata(); public abstract TagValue getValue(); }
true
d6c69470ff60204ab3c38f67faeded27b23f5f4b
Java
susichai/invoicingdemo
/src/main/java/com/example/invoicingdemo/pojo/report/Name.java
UTF-8
127
1.8125
2
[]
no_license
package com.example.invoicingdemo.pojo.report; public class Name { public String given_name; public String surname; }
true
5e5be41cdc805c53c4b64c2c38900812ab567ab5
Java
LilWingXYZ/Supermarket-Management-System
/工程迭代/3/DB1.0/DB/src/Biz/RackStoreBiz.java
UTF-8
570
2.046875
2
[]
no_license
package Biz; import java.sql.Connection; import java.sql.SQLException; import java.util.List; import OperateTarget.*; public interface RackStoreBiz { public boolean add(Connection conn, RackStore p)throws SQLException; public boolean delete(Connection conn, int gid)throws SQLException; public boolean update(Connection conn, RackStore p)throws SQLException; public RackStore findByID(int gid); public List<RackStore> findAll(); public List<RackStore> findByCondition(String condition); public List<RackStore> findByCondition(String condition,int mode); }
true
a5e7293fc6382a912e5407da12bd5d040f8491dd
Java
lqy1994/LingXi-Blog-Parent
/lingxi-common/src/main/java/cn/edu/sdu/wh/lqy/lingxi/blog/exception/LingXiException.java
UTF-8
398
2.171875
2
[]
no_license
package cn.edu.sdu.wh.lqy.lingxi.blog.exception; public class LingXiException extends RuntimeException { public LingXiException() { } public LingXiException(String message) { super(message); } public LingXiException(String message, Throwable cause) { super(message, cause); } public LingXiException(Throwable cause) { super(cause); } }
true
979354d988757e3e10026a4ea5db2f6ee9007485
Java
luisdcb97/Java
/Sheet/Ex3.java
UTF-8
980
3.609375
4
[]
no_license
/* * 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 ficha1; import java.util.Scanner; /** * * @author Luis David */ public class Ex3 { private Scanner scan = new Scanner(System.in); private int bin = 10110; public void exec(){ int pos = 0 ,temp = bin , one = 0 , zero = 0 , dec = 0; System.out.println("Count of 0s and 1s in a binary number:"); while (temp > 0) { if( temp % 10 == 1){ one++; } else{ zero++; } dec += (temp % 10) * Math.pow(2,pos); temp = (int) temp /10; pos++; } System.out.println("Binary: " + bin + " Decimal Equivalent: " + dec + " 0s: " + zero + " 1s: " + one ); } }
true
44431b3d9cdbb3bb00a6e8e16027015a3ded20cf
Java
metehangelgi/JavaProjects
/PS2c_methods/DigitName/src/digitName.java
UTF-8
837
4.125
4
[]
no_license
/* * File: digitName.java * -------------------- * This program takes a number between 0 and 9 as input * and prints its equivalent name. */ import acm.program.*; public class digitName extends ConsoleProgram { public void run() { //Get input number and print its name. int digitValue = readInt("Enter a digit between 0 and 9: "); println(getDigitName(digitValue)); } //Implement the helper method getDigitName() here private String getDigitName(int digit) { switch(digit) { case 0: return("Zero"); case 1: return("One"); case 2: return("two"); case 3: return("three"); case 4: return("four"); case 5: return("five"); case 6: return("six"); case 7: return("seven"); case 8: return("eight"); case 9: return("Nine"); default: return ("Error"); } } /* Translates a number into its name */ }
true
e1aa8a341622da33517dd50a91358c8e10246c10
Java
weber09/PortAlg
/PortAlg.Compiler/src/AST/Member.java
UTF-8
3,068
3.109375
3
[ "MIT" ]
permissive
package AST; /** * Created by Gabriel on 07/03/2016. */ abstract class Member { public String name() { return member().getName(); } public Type declaringType() { return Type.typeFor(member().getDeclaringClass()); } public boolean isStatic() { return java.lang.reflect.Modifier.isStatic(member().getModifiers()); } public boolean isPublic() { return java.lang.reflect.Modifier.isPublic(member().getModifiers()); } public boolean isProtected() { return java.lang.reflect.Modifier.isProtected(member().getModifiers()); } public boolean isPrivate() { return java.lang.reflect.Modifier.isPrivate(member().getModifiers()); } public boolean isAbstract() { return java.lang.reflect.Modifier.isAbstract(member().getModifiers()); } public boolean isFinal() { return java.lang.reflect.Modifier.isFinal(member().getModifiers()); } protected abstract java.lang.reflect.Member member(); } class Method extends Member { private java.lang.reflect.Method method; public Method(java.lang.reflect.Method method) { this.method = method; } public String toDescriptor() { String descriptor = "("; for (Class paramType : method.getParameterTypes()) { descriptor += Type.typeFor(paramType).toDescriptor(); } descriptor += ")" + Type.typeFor(method.getReturnType()).toDescriptor(); return descriptor; } public String toString() { String str = name() + "("; for (Class paramType : method.getParameterTypes()) { str += Type.typeFor(paramType).toString(); } str += ")"; return str; } public Type returnType() { return Type.typeFor(method.getReturnType()); } public boolean equals(Method that) { return Type.argTypesMatch(this.method.getParameterTypes(), that.method .getParameterTypes()); } protected java.lang.reflect.Member member() { return method; } } class Field extends Member { private java.lang.reflect.Field field; public Field(java.lang.reflect.Field field) { this.field = field; } public Type type() { return Type.typeFor(field.getType()); } protected java.lang.reflect.Member member() { return field; } } class Constructor extends Member { java.lang.reflect.Constructor constructor; public Constructor(java.lang.reflect.Constructor constructor) { this.constructor = constructor; } public String toDescriptor() { String descriptor = "("; for (Class paramType : constructor.getParameterTypes()) { descriptor += Type.typeFor(paramType).toDescriptor(); } descriptor += ")V"; return descriptor; } public Type declaringType() { return Type.typeFor(constructor.getDeclaringClass()); } protected java.lang.reflect.Member member() { return constructor; } }
true
e0cc44f54f7af3c00410d3007c866c8618d60ad3
Java
yuchunqiang/product-shopping-cart
/fh-product-webapp/src/main/java/com/fh/product/service/largeClass/ILargeClassService.java
UTF-8
442
1.726563
2
[]
no_license
package com.fh.product.service.largeClass; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import java.util.Map; @FeignClient("fh-product-server") public interface ILargeClassService { @RequestMapping(value = "queryLargeClassList",method = RequestMethod.POST) public Map queryLargeClassList(); }
true
042244c920e11c3ad41cc14e2d181129c8a70823
Java
Ranbato/JXPilot
/legacy/jxpilot/src/main/java/net/sf/jxpilot/net/packet/MessagePacket.java
UTF-8
733
2.734375
3
[]
no_license
package net.sf.jxpilot.net.packet; import net.sf.jgamelibrary.util.ByteBuffer; /** * Holds data from a Message packet. * @author Vlad Firoiu */ public final class MessagePacket extends XPilotPacketAdaptor { private final ReliableReadException MESSAGE_READ_EXCEPTION = new ReliableReadException("Message"); private String message; public String getMessage() {return message;} @Override public void readPacket(ByteBuffer in) throws ReliableReadException { //int pos = in.position(); pkt_type = in.getByte(); message = in.getString(); if(message == null) throw MESSAGE_READ_EXCEPTION; } @Override public String toString() { return "Message Packet\npacket type = " + pkt_type + "\nmessage = " + message; } }
true
90239542af1b475016eb2df2deb118c6bf2bfcab
Java
Xpyhbo/Your_Job
/src/main/java/ua/job/servlets/LoginServlet.java
UTF-8
1,013
2.203125
2
[ "Apache-2.0" ]
permissive
package ua.job.servlets; import ua.job.model.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; /** * Created by vasyl on 12/25/16. */ public class LoginServlet extends HttpServlet{ @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String login = req.getParameter("login"); String password = req.getParameter("password"); String user = req.getParameter("user"); String admin = req.getParameter("admin"); HttpSession session = req.getSession(); synchronized (session){ session.setAttribute("login", login); session.setAttribute("password", password); } resp.sendRedirect(String.format("%s/views/Application.jsp", req.getContextPath())); } }
true
d346450375e5e4132711bfc811729f71fc524758
Java
rjhtj/apts
/APTS/src/main/java/com/APTS/web/controller/PesticideController.java
UTF-8
2,342
2.109375
2
[ "MIT" ]
permissive
package com.APTS.web.controller; import com.APTS.web.entity.Pesticide; import com.APTS.web.service.PesticideService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.*; import java.util.List; import java.sql.Date; /** * Created by Yu on 2016/8/15. */ @Controller public class PesticideController { @Autowired private PesticideService pesticideService; @RequestMapping("/getAllPesticide.do") public String getAllPesticide(Model model){ List<Pesticide> list = pesticideService.getALLPesticide(); model.addAttribute("list",list); return "pesticide-list"; } @RequestMapping("/addPesticide.do") public String addPesticide(@ModelAttribute Pesticide pesticide) { pesticideService.addPesticide(pesticide); return "redirect:/getAllPesticide.do"; } @RequestMapping("/delPesticide.do") public String delPesticide(Integer id){ pesticideService.delPesticide(id); return "redirect:/getAllPesticide.do"; } @RequestMapping("/getPesticideById.do") public String getPesticideById(Integer id, Model model){ Pesticide pesticide = pesticideService.getPesticideById(id); model.addAttribute("pesticide", pesticide); return "pesticide-update"; } @RequestMapping("/updatePesticide.do/{pestId}") public String updatePesticide(@ModelAttribute Pesticide pesticide, @PathVariable int pestId){ pesticide.setPestId(pestId); pesticideService.updatePesticide(pesticide); return "redirect:/getAllPesticide.do"; } @RequestMapping("/front/getPesticideById.do") public String getPesticideInfoById(Integer id, Model model){ Pesticide pesticide = pesticideService.getPesticideById(id); model.addAttribute("Pesticide", pesticide); return "front/showPesInfo"; } }
true
d6c1aa4a41d4a3f0f740b8886937634123f8a4b5
Java
moutainhigh/vertx-game-lottery-v1.0
/yde-landlords/src/main/java/com/xt/landlords/game/eliminate/phase/EliminatePlayPhaseData.java
UTF-8
2,330
2.59375
3
[]
no_license
package com.xt.landlords.game.eliminate.phase; import org.sunyata.octopus.model.PhaseData; import java.util.ArrayList; import java.util.Comparator; import java.util.List; /** * Created by leo on 17/5/16. */ public class EliminatePlayPhaseData extends PhaseData { public List<EliminatePlayPhaseDataItem> getItems() { return items; } public EliminatePlayPhaseData setItems(List<EliminatePlayPhaseDataItem> items) { this.items = items; return this; } private List<EliminatePlayPhaseDataItem> items = new ArrayList<>(); public EliminatePlayPhaseData addItem(int betGamePoint, int awardGamePoint, int doubleKingCount, boolean isOver) { // private int betGamePoint;//本次投注点数 // private int awardGamePoint;//本次投注完成后,赢得的点数 // private int doubleKingCount = 0;//本次投注意完成后,双王的数量,即游戏进度 EliminatePlayPhaseDataItem eliminatePlayPhaseDataItem = new EliminatePlayPhaseDataItem().setAwardGamePoint (awardGamePoint).setBetGamePoint(betGamePoint) .setTotalDoubleKingCount(doubleKingCount).setOver(isOver); eliminatePlayPhaseDataItem.setOrderBy(items.size() + 1); items.add(eliminatePlayPhaseDataItem); return this; } public EliminatePlayPhaseDataItem getLastPlayPhaseDataItem() { EliminatePlayPhaseDataItem eliminatePlayPhaseDataItem = items.stream().max(Comparator.comparing (EliminatePlayPhaseDataItem::getOrderBy)).orElse(null); return eliminatePlayPhaseDataItem; } public EliminatePlayPhaseDataItem getPenultimateDataItem() { EliminatePlayPhaseDataItem lastPlayPhaseDataItem = getLastPlayPhaseDataItem(); if (lastPlayPhaseDataItem != null) { int orderBy = lastPlayPhaseDataItem.getOrderBy() - 1; EliminatePlayPhaseDataItem eliminatePlayPhaseDataItem = items.stream().filter(p -> p.getOrderBy() == orderBy) .findFirst().orElse(null); return eliminatePlayPhaseDataItem; } return null; } public EliminatePlayPhaseData addItem(EliminatePlayPhaseDataItem item) { item.setOrderBy(items.size() + 1); items.add(item); return this; } }
true
f754a8d1f18edec09b7290c70827add079c54f7e
Java
ahmedhamed105/rimdev
/accounting/src/main/java/com/rimdev/accounting/Repo/ErrorCodesRepo.java
UTF-8
537
2.046875
2
[]
no_license
package com.rimdev.accounting.Repo; import java.util.Optional; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.rimdev.accounting.Enttities.ErrorCodes; @Repository public interface ErrorCodesRepo extends CrudRepository<ErrorCodes, Integer>{ @Query(value ="select * from rim_accounting.error_codes where error_code = ?1" , nativeQuery = true) Optional<ErrorCodes> findbyiderrorcode(Integer error_code); }
true
e9c3d56668b469bf5b5db096d0cd22b39710ca5a
Java
rajnishi/SmartLocumTenensSuperAdminPortal
/src/main/java/PO/PostJobPO.java
UTF-8
5,060
1.875
2
[]
no_license
package PO; import BasePage.BasePage; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class PostJobPO extends BasePage { public PostJobPO(WebDriver driver) { super(driver); } ///////////////Locators for ProfilePage////////// public By DropDown_xpath = By.xpath("//a[@role= 'button']"); public By PostJob_xpath = By.xpath("//a[text()= 'Post a Job']"); public By JobTitle_xpath = By.xpath("//input[@name ='title']"); public By JobDesc_xpath = By.xpath("//textarea[@name ='description']"); public By City_xpath = By.xpath("//input[@name ='city']"); public By HState_xpath = By.xpath("//mat-select[@name='locationId']"); public By HState1_xpath = By.xpath("//span[contains((text()), ' Arizona ')]"); public By AddSpecialty_xpath = By.xpath("//a[contains((text()), 'Add specialty/subspecialty')]"); public By Specialty_xpath = By.xpath("//mat-select[@name = 'specialityId']"); public By SpecialtyTxt_xpath = By.xpath("//span[contains(text(), ' Anesthesiology ')]"); public By Subspecialty_xpath = By.xpath("//mat-select[@name = 'subSpecialityId']"); public By SubspecialtyTxt_xpath = By.xpath("//span[contains(text(), ' Addiction Medicine ')]"); public By AddSkills_xpath = By.xpath("//a[contains((text()), ' Add Skills ')]"); public By SkillsChkList_xpath = By.xpath("//div[@id='divSkillsCheckboxlist']"); public By SkillsChkList1_xpath = By.xpath("//span[text()= 'Acupuncture for pain management']"); public By SkillsChkList2_xpath = By.xpath("//span[text() = ' Mechanical ventilation']"); public By SkillsChkList3Add_xpath = By.xpath("(//span[text() = ' Add '])[2]"); public By AddBtn_xpath = By.xpath("//span[text()= ' Add ']"); public By BEBC_xpath = By.xpath("(//mat-radio-group[@role= 'radiogroup'])[1]//mat-radio-button[@id='mat-radio-5']"); //Job Listing Dates public By StartDtOpenCal_xpath = By.xpath("(//button[@aria-label= 'Open calendar'])[1]"); public By StartMonYrDt_xpath = By.xpath("//button[@aria-label= 'Choose month and year']"); public By StartYr_xpath = By.xpath("//td[@aria-label= '2020']"); public By StartMonth_xpath = By.xpath("//div[contains(text(),' JULY ')]"); public By StartDay_xpath = By.xpath("//td[@aria-label = 'July 1, 2020']"); public By NoEndDate_xpath = By.xpath("//mat-checkbox[@name = 'IsEndDate']"); public By EndDtOpenCal_xpath = By.xpath("(//button[@aria-label= 'Open calendar'])[2]"); public By EndDtMonYrDt_xpath = By.xpath("//button[@aria-label= 'Choose month and year']"); public By EndDtYr_xpath = By.xpath("//td[@aria-label='2020']"); public By EndDtMonth_xpath = By.xpath("//div[contains(text(),' JULY ')]"); public By EndDayDt_xpath = By.xpath("//td[@aria-label = 'July 30, 2020']"); //Job Dates public By Start1DtOpenCal_xpath = By.xpath("(//button[@aria-label= 'Open calendar'])[3]"); public By Start1MonYrDt_xpath = By.xpath("//button[@aria-label= 'Choose month and year']"); public By Start1Yr_xpath = By.xpath("//td[@aria-label= '2020']"); public By Start1Month_xpath = By.xpath("//div[contains(text(),' JULY ')]"); public By Start1Day_xpath = By.xpath("//td[@aria-label = 'July 20, 2020']");//chg date public By NoEndDate1_xpath = By.xpath("//mat-checkbox[@name = 'IsEndDate']"); public By EndDtOpenCal1_xpath = By.xpath("(//button[@aria-label= 'Open calendar'])[4]"); public By EndDtMonYrDt1_xpath = By.xpath("//button[@aria-label= 'Choose month and year']"); public By EndDtyr1_xpath = By.xpath("//td[@aria-label='2020']"); public By EndDtMonth1_xpath = By.xpath("//div[contains(text(),' JULY ')]"); public By EndDayDt1_xpath = By.xpath("//td[@aria-label = 'July 30, 2020']");// chg date public By AddDts_xpath = By.xpath("//span[text()=' Add Dates ']"); public By RateType_xpath = By.xpath("//mat-select[@name= 'payFrequencyId']"); public By Hourly_xpath = By.xpath("//span[text()=' Hourly ']"); public By PayRate_xpath = By.xpath("//input[@name ='mopayRate']"); public By StateLicReq_xpath = By.xpath("//mat-select[@name= 'stateLicenceIds']"); public By StateSelection_xpath = By.xpath("//span[text()=' Alaska ']"); public By StateSelection1_xpath = By.xpath("//span[text()=' California ']"); public By WillLicPosi_xpath = By.xpath("(//mat-radio-group[@role= 'radiogroup'])[2]//mat-radio-button[@id='mat-radio-7']"); public By FacilityCover_xpath = By.xpath("(//mat-radio-group[@role= 'radiogroup'])[3]//mat-radio-button[@id='mat-radio-9']"); //input[@id = 'mat-radio-21-input']"); public By JobSetting_xpath = By.xpath("//mat-select[@name= 'jobSettingId']"); public By JobSettDropDwn_xpath = By.xpath("//span[text()=' Hospital ']"); public By EstCredTime_xpath = By.xpath("//input[@name ='estimatedCredentialTime']"); public By Submit_xpath = By.xpath("//span[text()=' Submit ']"); public By ToastMessage_xpath = By.xpath("//div[@aria-label = 'This job posting has been successfully created.']"); }
true
72f21680302aa9b3c3d3602ebd9d7ece169445e3
Java
AlesiRic/ProjectGame
/TPDM_UNIT4_PROJECT/app/src/main/java/mx/edu/ittepic/tpdm_unit4_project/Shoot.java
UTF-8
1,505
2.5625
3
[]
no_license
package mx.edu.ittepic.tpdm_unit4_project; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; /** * Created by ClownToy on 09/05/2018. */ public class Shoot { Bitmap shootLaser; //des,reazón de desplazamiento del disparo //x,y: coordenadas de la posicion del tiro int des,x,y; int[][] coor=new int[4][2]; boolean hit; public Shoot(Player p){ if(p.shootColor==1) { shootLaser = BitmapFactory.decodeResource(Resources.getSystem(), R.drawable.shooty); } if(p.shootColor==2) { shootLaser = BitmapFactory.decodeResource(Resources.getSystem(), R.drawable.shootp); } x=p.getX()+36; y=p.getY(); des=8; //coordenadas para la colisión coor[0][0]=x; coor[0][1]=y; coor[1][0]=x+shootLaser.getWidth(); coor[1][1]=y; coor[2][0]=x+shootLaser.getWidth(); coor[2][1]=y+shootLaser.getHeight(); coor[3][0]=x; coor[3][1]=y+shootLaser.getHeight(); } public Shoot(Player2 p){ if(p.shootColor==1) { shootLaser = BitmapFactory.decodeResource(Resources.getSystem(), R.drawable.shootp); } if(p.shootColor==2) { shootLaser = BitmapFactory.decodeResource(Resources.getSystem(), R.drawable.shooty); } x=p.getX()+36; y=p.getY(); des=-8; } public void movement(){ y=y+des; } }
true
8e47b4967e7d617397164b27b9ada3b7571a9ac5
Java
rkosakov/Java-PHs
/Employees/src/main/java/edu/aubg/employees/EmployeeService.java
UTF-8
982
2.4375
2
[]
no_license
package edu.aubg.employees; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service @Transactional public class EmployeeService { @Autowired private EmployeeRepository employeerepository; // Get list of all employees from database public List<Employee> listAll(){ return employeerepository.findAll(); } // Save details of a single employee in database public void save(Employee employee) { employeerepository.save(employee); } // Get details of a single employee from database public Employee get(long id) { return employeerepository.findById(id).get(); } // Delete details of a single employee from database public void delete(long id) { employeerepository.deleteById(id); } public List<Employee> findEmployee() { return (List<Employee>) employeerepository.findEmployee(); } }
true
9f9405be5dd6173d183beae16308bdb4b4ff4d93
Java
yangyusong1121/Android-car
/app/src/main/java/com/tgf/kcwc/me/integral/PublishPurchaseActivity.java
UTF-8
9,796
1.742188
2
[]
no_license
package com.tgf.kcwc.me.integral; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.TextView; import com.tgf.kcwc.R; import com.tgf.kcwc.adapter.WrapAdapter; import com.tgf.kcwc.base.BaseActivity; import com.tgf.kcwc.common.Constants; import com.tgf.kcwc.driving.driv.SponsorDrivingActivity; import com.tgf.kcwc.entity.DataItem; import com.tgf.kcwc.mvp.model.BaseArryBean; import com.tgf.kcwc.mvp.model.BaseBean; import com.tgf.kcwc.mvp.model.CommentService; import com.tgf.kcwc.mvp.model.IntegralPurchaseRecordListBean; import com.tgf.kcwc.mvp.model.IntegralRecordBean; import com.tgf.kcwc.mvp.model.IntegralRecordListBean; import com.tgf.kcwc.mvp.presenter.IntegralPublishPresenter; import com.tgf.kcwc.mvp.presenter.IntegralRecordPresenter; import com.tgf.kcwc.mvp.view.IntegralPublishView; import com.tgf.kcwc.mvp.view.IntegralRecordView; import com.tgf.kcwc.util.CommonUtils; import com.tgf.kcwc.util.IOUtils; import com.tgf.kcwc.util.TextUtil; import com.tgf.kcwc.view.DropUpPhonePopupWindow; import com.tgf.kcwc.view.FunctionView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import cn.bingoogolapple.refreshlayout.BGARefreshLayout; /** * Created by Administrator on 2017/10/25. * 发布交易信息 */ public class PublishPurchaseActivity extends BaseActivity implements IntegralPublishView { IntegralPublishPresenter mIntegralPublishPresenter; private LinearLayout mTypeLayout; //类型layout private LinearLayout mTimeLayout; //时间layout private TextView mTypeName; private TextView mTimeName; private TextView mBalance; //余额 private TextView mConfirm; //发布 private EditText mNum; //数量 private EditText mPrice; //售价 private CheckBox mCheckBoxLicense; //是否同意协议 private DropUpPhonePopupWindow mDropUpPopupWindow; //type数据 private DropUpPhonePopupWindow mDropTimeUpPopupWindow;//time数据 private List<DataItem> mDataList = new ArrayList<>(); //type数据 private List<DataItem> mTimeList = new ArrayList<>(); //time数据 private DataItem mTypeDataItem; //选择的类型 private DataItem mTimeDataItem; //选择的时间 int gold = 0; //金币余额 int mSilverDollar = 0; //银元余额 public void gainTypeDataList() { mDataList.clear(); DataItem dataItem = null; dataItem = new DataItem(); dataItem.id = -1; dataItem.name = "选择类型"; mDataList.add(dataItem); dataItem = new DataItem(); dataItem.id = 1; dataItem.name = "金币(个人)"; mDataList.add(dataItem); dataItem = new DataItem(); dataItem.id = 2; dataItem.name = "银元(商务)"; mDataList.add(dataItem); mTypeDataItem = mDataList.get(1); } public void gainTimeDataList() { mTimeList.clear(); DataItem dataItem = null; dataItem = new DataItem(); dataItem.id = -1; dataItem.name = "选择时间"; mTimeList.add(dataItem); dataItem = new DataItem(); dataItem.id = 7; dataItem.name = "7天"; mTimeList.add(dataItem); dataItem = new DataItem(); dataItem.id = 15; dataItem.name = "15天"; mTimeList.add(dataItem); dataItem = new DataItem(); dataItem.id = 30; dataItem.name = "一个月"; mTimeList.add(dataItem); dataItem = new DataItem(); dataItem.id = 90; dataItem.name = "3个月"; mTimeList.add(dataItem); mTimeDataItem = mTimeList.get(1); } @Override protected void setUpViews() { } @Override protected void titleBarCallback(ImageButton back, FunctionView function, TextView text) { backEvent(back); text.setText("发布积分出售信息"); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_integral_publishpurchase); gainTypeDataList(); gainTimeDataList(); gold = getIntent().getIntExtra(Constants.IntentParams.ID, 0); mSilverDollar = getIntent().getIntExtra(Constants.IntentParams.ID2, 0); mIntegralPublishPresenter = new IntegralPublishPresenter(); mIntegralPublishPresenter.attachView(this); mTypeLayout = (LinearLayout) findViewById(R.id.type); mTimeLayout = (LinearLayout) findViewById(R.id.timelayout); mTypeName = (TextView) findViewById(R.id.typename); mBalance = (TextView) findViewById(R.id.balance); mNum = (EditText) findViewById(R.id.num); mPrice = (EditText) findViewById(R.id.price); mTimeName = (TextView) findViewById(R.id.time); mConfirm = (TextView) findViewById(R.id.confirm); mCheckBoxLicense = (CheckBox) findViewById(R.id.checkBox_license); mTypeLayout.setOnClickListener(this); mTimeLayout.setOnClickListener(this); mConfirm.setOnClickListener(this); mBalance.setText("余额(" + gold + ")"); } @Override public void onClick(View view) { super.onClick(view); switch (view.getId()) { case R.id.type: mDropUpPopupWindow = new DropUpPhonePopupWindow(mContext, mDataList); mDropUpPopupWindow.show(this); mDropUpPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { DataItem selectDataItem = mDropUpPopupWindow.getSelectDataItem(); if (selectDataItem != null && mDropUpPopupWindow.getIsSelec()) { mTypeDataItem = selectDataItem; mTypeName.setText(mTypeDataItem.name); if (mTypeDataItem.id == 1) { mBalance.setText("余额(" + gold + ")"); } else { mBalance.setText("余额(" + mSilverDollar + ")"); } //setTypeLay(mTypeDataItem.id); } } }); break; case R.id.timelayout: mDropTimeUpPopupWindow = new DropUpPhonePopupWindow(mContext, mTimeList); mDropTimeUpPopupWindow.show(this); mDropTimeUpPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { DataItem selectDataItem = mDropTimeUpPopupWindow.getSelectDataItem(); if (selectDataItem != null && mDropTimeUpPopupWindow.getIsSelec()) { mTimeDataItem = selectDataItem; mTimeName.setText(mTimeDataItem.name); //setTypeLay(mTypeDataItem.id); } } }); break; case R.id.confirm: String trim = mNum.getText().toString().trim(); int num = Integer.parseInt(trim); if (mTypeDataItem.id == 1) { if (gold < num) { CommonUtils.showToast(mContext, "超出余额"); return; } } else { if (mSilverDollar < num) { CommonUtils.showToast(mContext, "超出余额"); return; } } if (TextUtil.isEmpty(mPrice.getText().toString().trim())) { CommonUtils.showToast(mContext, "请输入出售价格"); return; } if (TextUtil.isEmpty(mNum.getText().toString().trim())) { CommonUtils.showToast(mContext, "请输入出售数量"); return; } if (!mCheckBoxLicense.isChecked()) { CommonUtils.showToast(mContext, "请同意积分出售信息协议"); return; } mIntegralPublishPresenter.getPointsReceiveList(builderParams()); break; } } private Map<String, String> builderParams() { Map<String, String> params = new HashMap<String, String>(); params.put("token", IOUtils.getToken(mContext)); params.put("price", mPrice.getText().toString().trim()); params.put("point_type", mTypeDataItem.id + ""); params.put("points", mNum.getText().toString().trim()); params.put("unsale", mTimeDataItem.id + ""); params.put("vehicle_type", "car"); return params; } @Override public void setLoadingIndicator(boolean active) { } @Override public void showLoadingTasksError() { CommonUtils.showToast(mContext, "系统异常"); } @Override public void DataSucceed(BaseArryBean baseBean) { CommonUtils.showToast(mContext, "发布成功"); finish(); } @Override public void dataListDefeated(String msg) { CommonUtils.showToast(mContext, msg); } @Override public Context getContext() { return mContext; } }
true
2e7b895e6faf2dbc8924837c022666276d843c61
Java
kurashovp/Minesweeper
/Problems/Getting the max element of a stack/src/Main.java
UTF-8
1,709
3.28125
3
[]
no_license
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.Deque; import java.util.Queue; class Main { static Deque<Integer> mainStack = new ArrayDeque<>(); static Deque<Integer> trackStack = new ArrayDeque<>(); static Queue<String> s = new ArrayDeque<>(); public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int cmdCount = Integer.parseInt(reader.readLine()); for (int i = 0; i < cmdCount; i++) { String command = reader.readLine(); switch (command.split("\\s+")[0]) { case "push": doPush(Integer.parseInt(command.split("\\s+")[1])); break; case "pop": doPop(); break; case "max": doMax(); break; default: break; } } } private static void doPush(int element) { if (!mainStack.isEmpty()) { mainStack.push(element); if (element > trackStack.peek()) { trackStack.push(element); } else { trackStack.push(trackStack.peek()); } } else { mainStack.push(element); trackStack.push(element); mainStack.pollLast(element) } } private static void doPop() { mainStack.pop(); trackStack.pop(); } private static void doMax() { System.out.println(trackStack.peek()); } }
true
d80475a386aaa2eabbd60eaf504ca3b629a9374f
Java
FedeBrg/HAL9000Mobile
/app/src/main/java/hci/hal9000/CreateDevice.java
UTF-8
6,925
1.820313
2
[]
no_license
package hci.hal9000; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.util.SparseArray; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import com.android.volley.NetworkResponse; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.HttpHeaderParser; import com.google.gson.Gson; import org.json.JSONException; import org.json.JSONObject; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.text.SimpleDateFormat; import java.util.Date; import static android.support.v4.content.FileProvider.getUriForFile; public class CreateDevice extends AppCompatActivity { private String deviceName; private String deviceType; private Uri photoUri; private static final String TAKE_PHOTO_TAG = "Take Photo"; //getString(R.string.takephoto); private static final int REQUEST_TAKE_PHOTO = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_create_device); ActionBar actionBar = getSupportActionBar(); if(actionBar != null){ actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(getString(R.string.createnewdevice)); } Button done = findViewById(R.id.create_new_device); done.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { deviceName = ((EditText) findViewById(R.id.device_name)).getText().toString(); deviceType = ((Spinner) findViewById(R.id.device_type)).getSelectedItem().toString().toLowerCase().replaceAll(" ","_"); Device device = new Device(); String[] toPut = getTypeID(deviceType); device.setMeta(toPut[1]); device.setTypeId(toPut[0]); device.setName(deviceName); Api.getInstance(getApplicationContext()).addDevice(device, new Response.Listener<Device>() { @Override public void onResponse(Device response) { // Intent intent = new Intent(CreateDevice.this,HomeScreen.class); // startActivity(intent); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { handleError(error); } }); finish(); } }); } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.qr_menu: Intent intent = new Intent(CreateDevice.this,QRReader.class); startActivityForResult(intent,1); //finish(); return true; } return super.onOptionsItemSelected(item); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch(requestCode) { case (1) : { if (resultCode == 1) { finish(); } break; } } } public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.qr_menu,menu); return true; } private void handleError(VolleyError error) { Error response = null; NetworkResponse networkResponse = error.networkResponse; if ((networkResponse != null) && (error.networkResponse.data != null)) { try { String json = new String( error.networkResponse.data, HttpHeaderParser.parseCharset(networkResponse.headers)); JSONObject jsonObject = new JSONObject(json); json = jsonObject.getJSONObject("error").toString(); Gson gson = new Gson(); response = gson.fromJson(json, Error.class); } catch (JSONException e) { } catch (UnsupportedEncodingException e) { } } Log.e("Testing", error.toString()); //String text = getResources().getString(R.string.error_message); String text = getString(R.string.connectionError); if (response != null) text += " " + response.getDescription().get(0); Toast.makeText(this, text, Toast.LENGTH_LONG).show(); } String[] getTypeID(String device){ String[] toReturn = new String[2]; if(device.compareTo("light") == 0 || device.compareTo("luz") == 0){ toReturn[0] = "go46xmbqeomjrsjr"; toReturn[1] = "light"; return toReturn; } else if(device.compareTo("oven") == 0 || device.compareTo("horno") == 0){ toReturn[0] = "im77xxyulpegfmv8"; toReturn[1] = "oven"; return toReturn; } else if(device.compareTo("curtains") == 0){ toReturn[0] = "eu0v2xgprrhhg41g"; toReturn[1] = "curtains"; return toReturn; } else if(device.compareTo("air_conditioner") == 0 || device.compareTo("aire_acondicionado") == 0){ toReturn[0] = "li6cbv5sdlatti0j"; toReturn[1] = "air_conditioner"; return toReturn; } else if(device.compareTo("timer") == 0 || device.compareTo("temporizador") == 0){ toReturn[0] = "ofglvd9gqX8yfl3l"; toReturn[1] = "timer"; return toReturn; } else if(device.compareTo("alarm") == 0 || device.compareTo("alarma") == 0){ toReturn[0] = "mxztsyjzsrq7iaqc"; toReturn[1] = "alarm"; return toReturn; } else if(device.compareTo("door") == 0 || device.compareTo("puerta") == 0){ toReturn[0] = "lsf78ly0eqrjbz91"; toReturn[1] = "door"; return toReturn; } else if(device.compareTo("fridge") == 0 || device.compareTo("heladera") == 0){ toReturn[0] = "rnizejqr2di0okho"; toReturn[1] = "fridge"; return toReturn; } else{ return null; } } }
true
96b8d553d39263520eb32ca3eedd321d488b5423
Java
jfcpcosta/spring-jwt-authentication
/src/main/java/io/reativ/samples/springauthenticationtoken/core/http/responses/errors/CustomErrorResponse.java
UTF-8
273
2.046875
2
[]
no_license
package io.reativ.samples.springauthenticationtoken.core.http.responses.errors; public class CustomErrorResponse extends AbstractErrorResponse { public CustomErrorResponse(Integer status, String error, String message) { super(status, error, message); } }
true
ffd7f71cb47eba3159030b212483f6a9f2fd4ad5
Java
omeruysal/springboot-examples
/spring-feignClient/src/main/java/com/example/demo/dto/UserDTO.java
UTF-8
1,484
2.140625
2
[]
no_license
package com.example.demo.dto; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty.Access; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @JsonPropertyOrder({"userId","name","username","lastname","company","address"}) @JsonInclude(value = Include.NON_NULL) @Builder @ApiModel(value= "UserDTO Model/ value of @@ApiModel" , description = "my description / description of @@ApiModel") public class UserDTO { @ApiModelProperty(value= "id field of User object / value of @@ApiModelProperty") @JsonProperty(access = Access.READ_ONLY,value = "userId") private Integer id; private String username; private String name; @JsonProperty(value="lastName") private String lastname; private AddressDTO address; @JsonManagedReference private CompanyDTO company; @JsonIgnore //artik post ile user create ederken passwordu request uzerinden de alamayiz. Cunku hem response hem de request uzerinden ignore eder private String password; }
true
dfa4866cd9fe326af03c3592eedbd757335a03b9
Java
NandiniDR29/123
/ren-automation-tests/src/test/java/com/exigen/ren/modules/policy/gb_di_ltd/master/TestAlignAffectsRatingFieldsVerification.java
UTF-8
13,610
1.734375
2
[]
no_license
package com.exigen.ren.modules.policy.gb_di_ltd.master; import com.exigen.istf.utils.TestInfo; import com.exigen.ren.main.enums.ProductConstants; import com.exigen.ren.main.modules.policy.common.GroupBenefitsMasterPolicyType; import com.exigen.ren.main.modules.policy.gb_di_ltd.masterpolicy.LongTermDisabilityMasterPolicyContext; import com.exigen.ren.main.modules.policy.gb_di_ltd.masterpolicy.metadata.PlanDefinitionTabMetaData; import com.exigen.ren.main.modules.policy.gb_di_ltd.masterpolicy.metadata.PolicyInformationTabMetaData; import com.exigen.ren.main.modules.policy.gb_di_ltd.masterpolicy.tabs.PremiumSummaryTab; import com.exigen.ren.main.pages.summary.QuoteSummaryPage; import com.exigen.ren.modules.policy.scenarios.master.ScenarioAlignAffectsRatingFieldsVerification; import org.testng.annotations.Test; import static com.exigen.istf.verification.CustomAssertions.assertThat; import static com.exigen.ren.utils.components.Components.POLICY_GROUPBENEFITS; import static com.exigen.ren.utils.groups.Groups.*; public class TestAlignAffectsRatingFieldsVerification extends ScenarioAlignAffectsRatingFieldsVerification implements LongTermDisabilityMasterPolicyContext { @Test(groups = {GB, GB_PRECONFIGURED, GB_DI_LTD, WITHOUT_TS, REGRESSION}) @TestInfo(testCaseId = {"REN-40578"}, component = POLICY_GROUPBENEFITS) public void testAlignAffectsRatingFieldsVerification() { initiateAndRateQuote(GroupBenefitsMasterPolicyType.GB_DI_LTD, tdSpecific().getTestData("TestData"), PremiumSummaryTab.class); //verification steps //MP → Policy Information verificationField(policyInformationTab.getAssetList().getAsset(PolicyInformationTabMetaData.RATE_GUARANTEE_MONTHS), policyInformationTab, "24", true); //MP → Plan Definition → Plan Selection verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.ASSUMED_PARTICIPATION), planDefinitionTab, "80%", true); //MP → Plan Definition → Coverage Included in Package verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.COVERAGE_INCLUDED_IN_PACKAGE) .getAsset(PlanDefinitionTabMetaData.CoverageIncludedInPackageMetaData.STD_ADMINISTERED), planDefinitionTab, true, false); //MP → Plan Definition → Sponsor/Participant Funding Structure verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.SPONSOR_PARTICIPANT_FUNDING_STRUCTURE) .getAsset(PlanDefinitionTabMetaData.SponsorParticipantFundingStructureMetaData.PARTICIPANT_CONTRIBUTION), planDefinitionTab, "25", true); //MP → Plan Definition → Benefit Schedule verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.MAX_MONTHLY_BENEFIT_AMOUNT), planDefinitionTab, "5000", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.BENEFIT_PERCENTAGE), planDefinitionTab, "65%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.MINIMUM_MONTHLY_BENEFIT_PERCENTAGE), planDefinitionTab, "15%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.MINIMUM_MONTHLY_BENEFIT_AMOUNT), planDefinitionTab, "$200", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.MAXIMUM_BENEFIT_PERIOD), planDefinitionTab, "To Age 70", false); //Verification Elimination period also is checked 'Accumulation Period' field (rule is GB_DI_LTD160216-CvLiY --> Accumulation Period is disabled but = Elimination Period (days) * 2). verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.ELIMINATION_PERIOD_DAYS), planDefinitionTab, "90", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.DEFINITION_OF_DISABILITY), planDefinitionTab, "X months Regular Occ ADL", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.TEST_DEFINITION), planDefinitionTab, "Loss of Duties or Earnings", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.NUMBER_OF_MONTH), planDefinitionTab, "36 months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.RESIDUAL), planDefinitionTab, "Not Included", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.PARTIAL_DISABILITY_BENEFIT), planDefinitionTab, "Proportionate Loss", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.WIB_DURATION), planDefinitionTab, "12 Months", false); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.SPECIALTY_OWN_OCCUPATION), planDefinitionTab, false, true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.OWN_OCCUPATION_EARNINGS_TEST), planDefinitionTab, "99%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.ANY_OCCUPATION_EARNINGS_TEST), planDefinitionTab, "80%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.PRE_EXISTING_CONDITION_LOOK_BACK_PERIOD), planDefinitionTab, "6 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.PRE_EXISTING_CONDITION_CONTINUOUSLY_INSURED_PERIOD), planDefinitionTab, "24 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.PRE_EXISTING_CONDITION_TREATMENT_FREE_PERIOD), planDefinitionTab, "12 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.PRE_EXISTING_CONDITIONS), planDefinitionTab, "Not Included", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.SURVIVOR_FAMILY_INCOME_BENEFIT_TYPE), planDefinitionTab, "6 Months Survivor Income Benefit", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_SCHEDULE) .getAsset(PlanDefinitionTabMetaData.BenefitScheduleMetaData.PAY_SURVIVOR_BENEFIT_GROSS), planDefinitionTab, false, true); //MP → Plan Definition → Offsets verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OFFSETS) .getAsset(PlanDefinitionTabMetaData.OffsetsMetaData.SOCIAL_SECURITY_INTEGRATION_METHOD), planDefinitionTab, "All Sources", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OFFSETS) .getAsset(PlanDefinitionTabMetaData.OffsetsMetaData.INTEGRATION_PERCENT), planDefinitionTab, "60%", true); //MP → Plan Definition → Options verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.PRUDENT_PERSON), planDefinitionTab, "Yes", false); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.MENTAL_ILLNESS_LIMITATION), planDefinitionTab, "24 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.SPECIAL_CONDITIONS_LIMITATION), planDefinitionTab, "12 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.SUBSTANCE_ABUSE_LIMITATION), planDefinitionTab, "None", false); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.SELF_REPORTED_CONDITIONS_LIMITATION), planDefinitionTab, "24 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.TERMINAL_ILLNESS_BENEFIT), planDefinitionTab, "3 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.COST_OF_LIVING_ADJUSTMENT_BENEFIT), planDefinitionTab, "3%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.NUMBER_OF_ADJUSTMENTS), planDefinitionTab, "10 Years", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.COBRA_PREMIUM_REIMB_AMOUNT), planDefinitionTab, "600", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.RECOVERY_INCOME_BENEFIT), planDefinitionTab, "6 Months", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.PRESUMPTIVE_DISABILITY), planDefinitionTab, "90 days", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.CATASTROPHIC_DISABILITY_BENEFIT), planDefinitionTab, "10%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.CHILD_EDUCATION_BENEFIT), planDefinitionTab, "Not Included", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.FOUR_HUNDRED_ONE_K_CONTRIBUTION_DURING_DISABILITY), planDefinitionTab, "11%", true); verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.OPTIONS) .getAsset(PlanDefinitionTabMetaData.OptionsMetaData.FICA_MATCH), planDefinitionTab, "None", true); //MP → Plan Definition → Benefit Termination Option verificationField(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.BENEFIT_TERM_OPTION) .getAsset(PlanDefinitionTabMetaData.BenefitTerminationOptionMetaData.MANDATORY_REHAB), planDefinitionTab, "Included", false); //MP → Plan Definition → Plan Selection 'Census Type' (not checked as usual way as it requires filling in additional fields) LOGGER.info("Step 1 verification for 'Census Type' field"); planDefinitionTab.navigateToTab(); assertThat(QuoteSummaryPage.labelQuoteStatus).hasValue(ProductConstants.StatusWhileCreating.PREMIUM_CALCULATED); planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.CENSUS_TYPE).setValue("Enrolled"); assertThat(QuoteSummaryPage.labelQuoteStatus).hasValue(ProductConstants.StatusWhileCreating.DATA_GATHERING); planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.TOTAL_NUMBER_OF_ELIGIBLE_LIVES).setValue("25"); checkQuoteStatusAfterSetNewValue(planDefinitionTab.getAssetList().getAsset(PlanDefinitionTabMetaData.CENSUS_TYPE), planDefinitionTab, true); } }
true
de327c5296837498e5eaae022aa00b1fc39066f5
Java
thiscouldbebetter/GameFrameworkJava
/Source/Display/Visuals/VisualEllipse.java
UTF-8
1,386
2.921875
3
[]
no_license
package Display.Visuals; import Display.*; import Model.*; public class VisualEllipse implements Visual { private double semimajorAxis; private double semiminorAxis; private double rotationInTurns; private String colorFill; private String colorBorder; public VisualEllipse ( double semimajorAxis, double semiminorAxis, double rotationInTurns, String colorFill ) { this(semimajorAxis, semiminorAxis, rotationInTurns, colorFill, null); } public VisualEllipse ( double semimajorAxis, double semiminorAxis, double rotationInTurns, String colorFill, String colorBorder ) { this.semimajorAxis = semimajorAxis; this.semiminorAxis = semiminorAxis; this.rotationInTurns = rotationInTurns; this.colorFill = colorFill; this.colorBorder = colorBorder; } public void draw(Universe universe, World world, Display display, Entity entity) { var drawableLoc = entity.locatable().loc; var drawableOrientation = drawableLoc.orientation; var drawableRotationInTurns = drawableOrientation.headingInTurns(); display.drawEllipse ( drawableLoc.pos, this.semimajorAxis, this.semiminorAxis, (this.rotationInTurns + drawableRotationInTurns).wrapToRangeZeroOne(), this.colorFill, this.colorBorder ); } // Clonable. public Visual clonify() { return this; // todo } public Visual overwriteWith(Visual other) { return this; // todo } }
true
63d852c2fc91a7c171b66be118d22ae616a0dfa0
Java
wambakun/LoginCRUDVolley
/app/src/main/java/developerkampus/logincrud/utils/JSONParser.java
UTF-8
862
2.46875
2
[]
no_license
package developerkampus.logincrud.utils; import android.content.Context; import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; /** * Created by Wamba on 23/05/2017. */ public class JSONParser { private Context mContext; public JSONParser(Context context) { this.mContext = context; } public boolean isSuccess(JSONObject jsonObject){ int kode = 0; String pesan = ""; try { kode = jsonObject.getInt("kode"); pesan = jsonObject.getString("pesan"); } catch (JSONException e) { Toast.makeText(mContext, "" + e, Toast.LENGTH_SHORT).show(); } Toast.makeText(mContext, "" + jsonObject, Toast.LENGTH_SHORT).show(); if(kode==2){ return true; }else{ return false; } } }
true
c7c079afabe72dbbadb8798cd1d3df8ac360fab2
Java
ksksks2222/pl-workspace
/jinxiaocun/jxc-admin/src/main/java/hg/jxc/admin/controller/setting/UnitController.java
UTF-8
3,295
2.09375
2
[]
no_license
package hg.jxc.admin.controller.setting; import javax.servlet.http.HttpServletRequest; import jxc.app.service.system.UnitService; import jxc.domain.model.system.Unit; import hg.common.model.qo.DwzPaginQo; import hg.common.page.Pagination; import hg.jxc.admin.common.CommandUtil; import hg.jxc.admin.common.JsonResultUtil; import hg.jxc.admin.common.Tools; import hg.jxc.admin.controller.BaseController; import hg.pojo.command.CreateUnitCommand; import hg.pojo.command.ModifyUnitCommand; import hg.pojo.command.RemoveUnitCommand; import hg.pojo.exception.ProductException; import hg.pojo.qo.UnitQO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/unit") public class UnitController extends BaseController { @Autowired UnitService unitService; final static String navTabRel = "unit_list"; @RequestMapping("/list") public String queryUnitList(Model model, HttpServletRequest request, @ModelAttribute DwzPaginQo dwzPaginQo, UnitQO qo) { qo.setNameLike(true); Pagination pagination = createPagination(dwzPaginQo, qo); pagination = unitService.queryPagination(pagination); model.addAttribute("pagination", pagination); JsonResultUtil.AddFormData(model, qo); return "setting/unit/unitList.html"; } @RequestMapping("/to_add") public String toAddUnit(Model model, HttpServletRequest request) { return "setting/unit/unitAdd.html"; } @RequestMapping("/create") @ResponseBody public String createUnit(Model model, HttpServletRequest request, CreateUnitCommand command) { CommandUtil.SetOperator(getAuthUser(), command); Unit unit; try { unit = unitService.createUnit(command); } catch (ProductException e) { return JsonResultUtil.dwzExceptionMsg(e); } // 返回json return JsonResultUtil.dwzSuccessMsg("保存成功", navTabRel, "<option value=\\\"" + unit.getId() + "\\\">" + unit.getUnitName() + "</option>"); } @RequestMapping("/edit") public String editUnit(Model model, HttpServletRequest request, UnitQO qo) { Tools.modelAddFlag("edit", model); Unit unit = unitService.queryUnique(qo); JsonResultUtil.AddFormData(model, unit); return "setting/unit/unitAdd.html"; } @RequestMapping("/update") @ResponseBody public String updateUnit(Model model, HttpServletRequest request, ModifyUnitCommand command) { CommandUtil.SetOperator(getAuthUser(), command); try { unitService.modifyUnit(command); } catch (ProductException e) { return JsonResultUtil.dwzExceptionMsg(e); } return JsonResultUtil.dwzSuccessMsg("修改成功", navTabRel); } @RequestMapping("/remove") @ResponseBody public String removeUnit(RemoveUnitCommand command) { CommandUtil.SetOperator(getAuthUser(), command); try { unitService.removeUnit(command); } catch (ProductException e) { return JsonResultUtil.dwzExceptionMsg(e); } return JsonResultUtil.dwzSuccessMsgNoClose("删除成功", navTabRel); } }
true
213518db3894d7f27f5c3cd846d2d79974b0956b
Java
NotGeri/Minestorm
/src/main/java/net/minestorm/server/entity/metadata/monster/CaveSpiderMeta.java
UTF-8
473
1.960938
2
[ "Apache-2.0" ]
permissive
package net.minestorm.server.entity.metadata.monster; import net.minestorm.server.entity.Entity; import net.minestorm.server.entity.Metadata; import org.jetbrains.annotations.NotNull; public class CaveSpiderMeta extends SpiderMeta { public static final byte OFFSET = SpiderMeta.MAX_OFFSET; public static final byte MAX_OFFSET = OFFSET + 0; public CaveSpiderMeta(@NotNull Entity entity, @NotNull Metadata metadata) { super(entity, metadata); } }
true
5e9b398aa4a85166a64ab122c864637f7e819958
Java
Babken08/frilance1
/Monitoring/app/src/main/java/com/example/armen/monitoring/ChoiceOnWhatShelf.java
UTF-8
4,906
2.015625
2
[]
no_license
package com.example.armen.monitoring; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.RelativeLayout; import android.widget.Toast; import com.example.armen.monitoring.db.DBHelper; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class ChoiceOnWhatShelf extends AppCompatActivity { private DBHelper dbHelper; private String qrCode; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choic_on_what_shelf); ButterKnife.bind(this); dbHelper = DBHelper.newInstance(this); qrCode = getIntent().getStringExtra("qrcode"); if(qrCode == null || qrCode.equals("")){ Log.i("ssssssssssssssss", "qrCode" + null); }else { Log.i("ssssssssssssssss", "qrCode" + qrCode); } } @OnClick(R.id.btn_brim_hat) void clickBrimHat() { clickToButtons("шляпа край<"); } @OnClick(R.id.btn_brim_eyes) void clickBrimEyes() { clickToButtons("глаза край<"); } @OnClick(R.id.btn_brim_hand) void clickBrimHand() { clickToButtons("руки край<"); } @OnClick(R.id.btn_brim_belt) void clickBrimBelt() { clickToButtons("пояс край<"); } @OnClick(R.id.btn_brim_knees) void clickBrimKnees() { clickToButtons("колени край<"); } @OnClick(R.id.btn_brim_foot) void clickBrimFoot() { clickToButtons("ноги край<"); } @OnClick(R.id.btn_left_hat) void clickLeftHat() { clickToButtons("шляпа левее"); } @OnClick(R.id.btn_left_eyes) void clickLeftEyes() { clickToButtons("глаза левее"); } @OnClick(R.id.btn_left_hand) void clickLeftHand() { clickToButtons("руки левее"); } @OnClick(R.id.btn_left_belt) void clickLeftBelt() { clickToButtons("пояс левее"); } @OnClick(R.id.btn_left_knees) void clickLeftKnees() { clickToButtons("колени левее"); } @OnClick(R.id.btn_left_foot) void clickLeftFoot() { clickToButtons("ноги левее"); } @OnClick(R.id.btn_centre_hat) void clickCentreHat() { clickToButtons("шляпа центр"); } @OnClick(R.id.btn_centre_eyes) void clickCentreEyes() { clickToButtons("глаза центр"); } @OnClick(R.id.btn_centre_hand) void clickCentreHand() { clickToButtons("руки центр"); } @OnClick(R.id.btn_centre_belt) void clickCentreBelt() { clickToButtons("пояс центр"); } @OnClick(R.id.btn_centre_knees) void clickCentreKness() { clickToButtons("колени центр"); } @OnClick(R.id.btn_centre_foot) void clickCentreFoot() { clickToButtons("ноги центр"); } @OnClick(R.id.btn_right_hat) void clickRightHat() { clickToButtons("шляпа правее"); } @OnClick(R.id.btn_right_eyes) void clickRightEyes() { clickToButtons("глаза правее"); } @OnClick(R.id.btn_right_hand) void clickRightHand() { clickToButtons("руки правее"); } @OnClick(R.id.btn_right_belt) void clickRightBelt() { clickToButtons("пояс правее"); } @OnClick(R.id.btn_right_knees) void clickRightKnees() { clickToButtons("колени правее"); } @OnClick(R.id.btn_right_foot) void clickRightFoot() { clickToButtons("ноги правее"); } @OnClick(R.id.btn_end_hat) void clickEndHat() { clickToButtons("шляпа край >"); } @OnClick(R.id.btn_end_eyes) void clickEndEyes() { clickToButtons("глаза край >"); } @OnClick(R.id.btn_end_hand) void clickEndHand() { clickToButtons("руки край >"); } @OnClick(R.id.btn_end_belt) void clickEndBelt() { clickToButtons("пояс край >"); } @OnClick(R.id.btn_end_knees) void clickEndKnees() { clickToButtons("колени край >"); } @OnClick(R.id.btn_end_foot) void clickEndFoot() { clickToButtons("ноги край >"); } private void colorButton(RelativeLayout layout) { layout.setBackgroundResource(R.color.colorPrimaryDark); } private void clickToButtons(String position) { dbHelper.addQRCode("штрих код товарa: " +qrCode + ": находится " + position); Intent intent = new Intent(ChoiceOnWhatShelf.this, PhotoActivity.class); startActivity(intent); // finish(); } }
true
7af34d43f8509fafd22a0bc88d9a1cde818d24ec
Java
MishaJava/EpamTask
/EpamTask/src/epam/Bouquet.java
UTF-8
962
3.15625
3
[]
no_license
package epam; import java.util.ArrayList; import java.util.List; public class Bouquet { private List<Flower> flowers = new ArrayList<>(); public List<Flower> getFlowers() { return flowers; } public void setFlowers(List<Flower> flowers) { this.flowers = flowers; } public void searchByName(String name){ List<Flower> list = new ArrayList<>(); for(Flower f : this.flowers){ if(f.getName().equals(name)){ list.add(f); } } this.getFlowersFromBouquet(list); } public void searchByObject(Flower flower){ List<Flower> list = new ArrayList<>(); for(Flower f : this.flowers){ if(f.equals(flower)){ list.add(f); } } this.getFlowersFromBouquet(list); } private void getFlowersFromBouquet(List<Flower> list){ if(list.size()>0){ for(Flower flower : list){ System.out.println(flower.toString()); } }else{ System.out.println("Букет не містить такої квітки"); } } }
true
6e77e91f0a87488f3278a05184a059f011a32015
Java
PeterJames12/instatask
/app/src/main/java/com/example/instatask/model/dto/GumRoom.java
UTF-8
3,247
2.171875
2
[]
no_license
package com.example.instatask.model.dto; import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import lombok.ToString; /** * @author Igor Hnes on 12/26/17. */ @SuppressWarnings("CheckStyle") @ToString @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "id", "club", "title", "description", "image", "time_open", "time_close", "instructor" }) public class GumRoom { @JsonProperty("id") private int id; @JsonProperty("club") private int club; @JsonProperty("title") private String title; @JsonProperty("description") private String description; @JsonProperty("image") private String image; @JsonProperty("time_open") private String timeOpen; @JsonProperty("time_close") private String timeClose; @JsonProperty("instructor") private List<Object> instructor = null; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<>(); @JsonProperty("id") public int getId() { return id; } @JsonProperty("id") public void setId(int id) { this.id = id; } @JsonProperty("club") public int getClub() { return club; } @JsonProperty("club") public void setClub(int club) { this.club = club; } @JsonProperty("title") public String getTitle() { return title; } @JsonProperty("title") public void setTitle(String title) { this.title = title; } @JsonProperty("description") public String getDescription() { return description; } @JsonProperty("description") public void setDescription(String description) { this.description = description; } @JsonProperty("image") public String getImage() { return image; } @JsonProperty("image") public void setImage(String image) { this.image = image; } @JsonProperty("time_open") public String getTimeOpen() { return timeOpen; } @JsonProperty("time_open") public void setTimeOpen(String timeOpen) { this.timeOpen = timeOpen; } @JsonProperty("time_close") public String getTimeClose() { return timeClose; } @JsonProperty("time_close") public void setTimeClose(String timeClose) { this.timeClose = timeClose; } @JsonProperty("instructor") public List<Object> getInstructor() { return instructor; } @JsonProperty("instructor") public void setInstructor(List<Object> instructor) { this.instructor = instructor; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
true
b0c754c1d05986c4441d14ed87c14a3cfd543851
Java
jerrylovepizza/JavaLearning-1
/aliyun/src/main/java/cn/mldn/demo/service/IUserService.java
UTF-8
150
1.742188
2
[]
no_license
package cn.mldn.demo.service; public interface IUserService { public boolean isExit(); public boolean login(String name, String passwd); }
true
c8042a575801c526b3b6b8a2433f7fb643819ffc
Java
BertMoretz/zipline
/backend/src/main/java/com/zipline/repository/RoleRepository.java
UTF-8
532
2.28125
2
[]
no_license
package com.zipline.repository; import com.zipline.model.Role; import com.zipline.model.RoleType; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * The role repository contains methods for roles entities. */ @Repository public interface RoleRepository extends JpaRepository<Role, Long> { /** * Find a role by its name. * * @param name the name of the role * @return the optional role */ Role findByName(final RoleType name); }
true
88c53f5870de381e5759545743902038fcba38ab
Java
betacampello/Quer-Ser-Milion-rio-
/src/com/example/quersermilionario/Fase_5.java
UTF-8
520
1.625
2
[]
no_license
package com.example.quersermilionario; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class Fase_5 extends Fases { @Override protected void onCreate(Bundle savedInstanceState) { quantidade_perguntas_fase = 1; valor_primeira_pergunta = 1000000; score_pergunta = 100000; arquivo = "fase5.txt"; super.seguinte_fase = Win.class; super.onCreate(savedInstanceState); } }
true
ac4bb6ff8ddae244a077c09a0c5cd52058f3a58e
Java
MaurilioDeveloper/ccr
/ccr-ejb/src/main/java/br/gov/caixa/ccr/dominio/barramento/MensagemAvaliacao.java
UTF-8
959
1.90625
2
[]
no_license
package br.gov.caixa.ccr.dominio.barramento; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import br.gov.caixa.ccr.dominio.barramento.siric.DadosAvaliacao; @XmlRootElement(name="avaliacao_risco_credito:SERVICO_ENTRADA") public class MensagemAvaliacao extends MensagemBarramento { private static final long serialVersionUID = -1289042495758899650L; @XmlAttribute(name="xmlns:avaliacao_risco_credito") private String xmlns_avaliacaoRiscoCredito = "http://caixa.gov.br/sibar/avaliacao_risco_credito"; @XmlAttribute(name="xmlns:sibar_base") private String xmlns_sibarBase = "http://caixa.gov.br/sibar"; // pode ser por beneficio ou por cpf private DadosAvaliacao dados; @XmlElement(name="DADOS") public DadosAvaliacao getDados(){ return this.dados; } public void setDados(DadosAvaliacao dados){ this.dados = dados; } }
true
56846f843890d5526c0f5419217e78e91944c133
Java
UstadMobile/NanoLRS
/nanolrs-core/src/main/java/com/ustadmobile/nanolrs/core/manager/XapiVerbManager.java
UTF-8
367
1.898438
2
[]
no_license
package com.ustadmobile.nanolrs.core.manager; import com.ustadmobile.nanolrs.core.model.XapiVerb; /** * Created by mike on 15/11/16. */ public interface XapiVerbManager extends NanoLrsManagerSyncable{ XapiVerb make(Object dbContext, String verbId); void persist(Object dbContext, XapiVerb data); XapiVerb findById(Object dbContext, String id); }
true
70ab883cd0c3ef8cf71f5f421d2f7769fd9de4df
Java
jagnip/formatter_spring_context_project
/src/main/java/com/codecool/formatters/TableOutputFormatter.java
UTF-8
592
3.21875
3
[]
no_license
package com.codecool.formatters; import java.util.List; import java.util.Map; public class TableOutputFormatter implements OutputFormatter{ public void printToConsole(List<Map<String, String>> data) { for (String key : data.get(0).keySet()) { System.out.print(String.format("%1$20s | ", key)); } System.out.println(); for (Map<String, String> map : data) { for (String value : map.values()) { System.out.print(String.format("%1$20s | ", value)); } System.out.println(); } } }
true
eedc05acf2a10c0ac196c99a16a01fc05e45d57c
Java
Elias-Contrubis/VascalCompiler
/src/semanticActions/Quadruple.java
UTF-8
1,459
3.359375
3
[]
no_license
package semanticActions; /* The quadruple class represents one TVI operation */ public class Quadruple { /* Fields The four strings that populate a quadruple */ private String String0; private String String1; private String String2; private String String3; /*Quadruple creater INPUT: Four strings which will make up the tvi operation OUTPUT: None */ public Quadruple(String string0, String string1, String string2, String string3) { this.String0 = string0; this.String1 = string1; this.String2 = string2; this.String3 = string3; } //--------------------------------------------------------------------- //Getters and Setters for the Quadruple fields //--------------------------------------------------------------------- public String GetString0() { return this.String0; } public void SetString0(String s) { this.String0 = s; } public String GetString1() { return this.String1; } public void SetString1(String s) { this.String1 = s; } public String GetString2() { return this.String2; } public void SetString2(String s) { this.String2 = s; } public String GetString3() { return this.String3; } public void SetString3(String s) { this.String3 = s; } }
true
b5a6b852cb69201e6c0fd125cbbdff14d2bd48b2
Java
omartaktak/gestcommercial_V5
/src/main/java/tn/taktak/GestCommerciale_V1/controller/UniteListController.java
UTF-8
3,722
2.03125
2
[]
no_license
package tn.taktak.GestCommerciale_V1.controller; import java.io.IOException; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; import javax.annotation.PostConstruct; import javax.faces.FacesException; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletRequest; import org.primefaces.context.RequestContext; import lombok.Getter; import lombok.Setter; import tn.taktak.GestCommerciale_V1.entity.Unite; import tn.taktak.GestCommerciale_V1.service.UniteService; @ManagedBean @Getter @Setter @ViewScoped public class UniteListController implements Serializable { @ManagedProperty("#{uniteService}") private UniteService uniteService; private List<Unite> unites; private Unite unite = new Unite(); public static List<Unite> listunite=null; public static String id=null; @PostConstruct public void loadUnite() { unites = uniteService.findAll(); } public List<String> findDesUnite(){ return uniteService.findDesUnite(); } public void save() { uniteService.save(unite); unite=new Unite(); unites = uniteService.findAll(); FacesContext.getCurrentInstance().addMessage (null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Unité Enregistré!", null)); } public void remove(Unite unite) { uniteService.remove(unite); unites = uniteService.findAll(); FacesContext.getCurrentInstance().addMessage (null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Unité Supprimé!", null)); } public void clear() { unite=new Unite(); } public String redirect() { FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext extContext = ctx.getExternalContext(); String url = extContext.encodeActionURL(ctx.getApplication().getViewHandler().getActionURL(ctx, "/ListeUnite.xhtml")); try { extContext.redirect(url); } catch (IOException ioe) { throw new FacesException(ioe); } return null; } public void filterUnite() { HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); String recherche=(String)request.getParameter("formArticle:rechercheArticle"); if(recherche!=null && recherche.isEmpty()!=true && recherche!=" ") { RequestContext context = RequestContext.getCurrentInstance(); unites=uniteService.filterUnite(recherche); listunite=unites; context.update("formArticle:articleTable"); } else { unites=uniteService.findAll(); listunite=unites; } } public void selectedUnite(Unite art) { setUnite(art); id=art.getCunite(); RequestContext context = RequestContext.getCurrentInstance(); context.execute("PF('articleDialog').show();"); } public void update() { boolean champs_vide=false; unite.setCunite(id); if(unite.getCunite().isEmpty()) { FacesContext.getCurrentInstance().addMessage (null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Le code ne peut pas etre null!", null)); champs_vide=true; } if(unite.getDesUnite().isEmpty()) { FacesContext.getCurrentInstance().addMessage (null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "La désignation ne peut pas etre null!", null)); champs_vide=true; } if(champs_vide==false) { uniteService.save(unite); unite=new Unite(); unites = uniteService.findAll(); FacesContext.getCurrentInstance().addMessage (null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Unité Mis à jour!", null)); } } }
true
9f0004f4dd8f41e8def37213f262bc1bf6e5e315
Java
danielzhe/kie-wb-common
/kie-wb-common-screens/kie-wb-common-project-editor/kie-wb-common-project-editor-client/src/main/java/org/kie/workbench/common/screens/projecteditor/client/build/exec/dialog/BuildDialog.java
UTF-8
1,473
2.0625
2
[ "Apache-2.0" ]
permissive
/* * Copyright 2019 Red Hat, Inc. and/or its affiliates. * * 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.kie.workbench.common.screens.projecteditor.client.build.exec.dialog; import javax.inject.Inject; import javax.inject.Singleton; @Singleton public class BuildDialog { private boolean building = false; private BuildDialogView view; @Inject public BuildDialog(BuildDialogView view) { this.view = view; } public boolean isBuilding() { return building; } public void startBuild() { if (building) { throw new IllegalStateException("Build already running"); } building = true; } public void stopBuild() { hideBusyIndicator(); building = false; } public void showBusyIndicator(String message) { view.showBusyIndicator(message); } public void hideBusyIndicator() { view.hideBusyIndicator(); } }
true
055c95a2d4f619a8786d7ccef20431b3dcedcb3a
Java
wkfahfkdy/Spring-UITest
/UITest/src/main/java/co/kjm/uitest/member/map/MemberMapper.java
UTF-8
159
1.617188
2
[]
no_license
package co.kjm.uitest.member.map; import co.kjm.uitest.member.vo.MemberVO; public interface MemberMapper { MemberVO memberLogin(MemberVO vo); }
true
169fc94a12e7b87c845f92b3077b1e7b2634f000
Java
haube/rfid-navigation
/NxtNavigator/src/de/fhhannover/inform/lejos/comm/Task.java
UTF-8
617
2.421875
2
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.fhhannover.inform.lejos.comm; /** * * @author Michael Antemann <antemann.michael at gmail.com> */ public class Task { Type type; Message message; public Task(Type t, Message m) { type = t; message = m; } public Message getMessage() { return message; } public void setMessage(Message message) { this.message = message; } public Type getType() { return type; } public void setType(Type type) { this.type = type; } }
true
3a62105a2f79e2fbba51fb2163dbdfe16f798899
Java
rsanttos/api
/src/main/java/br/com/ufrn/agendaaluno/api/model/calendar/DayWithoutWork.java
UTF-8
484
2.34375
2
[]
no_license
package br.com.ufrn.agendaaluno.api.model.calendar; public class DayWithoutWork extends Commitment { private String justificativa; public DayWithoutWork(String justificativa, long finalDate) { super(); this.justificativa = justificativa; this.finalDate = finalDate; } public DayWithoutWork() { super(); } public String getJustificativa() { return justificativa; } public void setJustificativa(String justificativa) { this.justificativa = justificativa; } }
true
8fd4ced6133cff3960d043cebab703ebd616085e
Java
wa000/analysisFramework
/analysisWeb/src/main/java/org/b3log/symphony/model/Liveness.java
UTF-8
4,825
2
2
[ "AGPL-3.0-only", "GPL-1.0-or-later", "MIT", "BSD-3-Clause", "CC-BY-NC-4.0", "Apache-2.0" ]
permissive
/* * Symphony - A modern community (forum/BBS/SNS/blog) platform written in Java. * Copyright (C) 2012-present, b3log.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package org.b3log.symphony.model; import org.b3log.symphony.util.Symphonys; import org.json.JSONObject; /** * This class defines all liveness model relevant keys. * * @author <a href="http://88250.b3log.org">Liang Ding</a> * @version 1.1.0.0, Jun 12, 2018 * @since 1.4.0 */ public final class Liveness { /** * Liveness. */ public static final String LIVENESS = "liveness"; /** * Key of user id. */ public static final String LIVENESS_USER_ID = "livenessUserId"; /** * Key of liveness date. */ public static final String LIVENESS_DATE = "livenessDate"; /** * Key of liveness point. */ public static final String LIVENESS_POINT = "livenessPoint"; /** * Key of liveness article. */ public static final String LIVENESS_ARTICLE = "livenessArticle"; /** * Key of liveness comment. */ public static final String LIVENESS_COMMENT = "livenessComment"; /** * Key of liveness activity. */ public static final String LIVENESS_ACTIVITY = "livenessActivity"; /** * Key of liveness thank. */ public static final String LIVENESS_THANK = "livenessThank"; /** * Key of liveness vote. */ public static final String LIVENESS_VOTE = "livenessVote"; /** * Key of liveness reward. */ public static final String LIVENESS_REWARD = "livenessReward"; /** * Key of liveness PV. */ public static final String LIVENESS_PV = "livenessPV"; /** * Key of liveness accept answer. */ public static final String LIVENESS_ACCEPT_ANSWER = "livenessAcceptAnswer"; /** * Calculates point of the specified liveness. * * @param liveness the specified liveness * @return point */ public static int calcPoint(final JSONObject liveness) { final float activityPer = Symphonys.ACTIVITY_YESTERDAY_REWARD_ACTIVITY_PER; final float articlePer = Symphonys.ACTIVITY_YESTERDAY_REWARD_ARTICLE_PER; final float commentPer = Symphonys.ACTIVITY_YESTERDAY_REWARD_COMMENT_PER; final float pvPer = Symphonys.ACTIVITY_YESTERDAY_REWARD_PV_PER; final float rewardPer = Symphonys.ACTIVITY_YESTERDAY_REWARD_REWARD_PER; final float thankPer = Symphonys.ACTIVITY_YESTERDAY_REWARD_THANK_PER; final float votePer = Symphonys.ACTIVITY_YESTERDAY_REWARD_VOTE_PER; final float acceptAnswerPer = Symphonys.ACTIVITY_YESTERDAY_REWARD_ACCEPT_ANSWER_PER; final int activity = liveness.optInt(Liveness.LIVENESS_ACTIVITY); final int article = liveness.optInt(Liveness.LIVENESS_ARTICLE); final int comment = liveness.optInt(Liveness.LIVENESS_COMMENT); int pv = liveness.optInt(Liveness.LIVENESS_PV); if (pv > 50) { pv = 50; } final int reward = liveness.optInt(Liveness.LIVENESS_REWARD); final int thank = liveness.optInt(Liveness.LIVENESS_THANK); int vote = liveness.optInt(Liveness.LIVENESS_VOTE); if (vote > 10) { vote = 10; } final int acceptAnswer = liveness.optInt(Liveness.LIVENESS_ACCEPT_ANSWER); final int activityPoint = (int) (activity * activityPer); final int articlePoint = (int) (article * articlePer); final int commentPoint = (int) (comment * commentPer); final int pvPoint = (int) (pv * pvPer); final int rewardPoint = (int) (reward * rewardPer); final int thankPoint = (int) (thank * thankPer); final int votePoint = (int) (vote * votePer); final int acceptAnswerPoint = (int) (acceptAnswer * acceptAnswerPer); int ret = activityPoint + articlePoint + commentPoint + pvPoint + rewardPoint + thankPoint + votePoint + acceptAnswerPoint; final int max = Symphonys.ACTIVITY_YESTERDAY_REWARD_MAX; if (ret > max) { ret = max; } return ret; } /** * Private constructor. */ private Liveness() { } }
true
6327fcf26610306868f0923df98b7c75773c5839
Java
sunliang123/zhongbei-zhonghang-zhongzi-yidian
/collector/src/main/java/com/waben/stock/collector/dao/impl/StrategyTypeDaoImpl.java
UTF-8
1,574
2.1875
2
[]
no_license
package com.waben.stock.collector.dao.impl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Repository; import com.waben.stock.collector.dao.StrategyTypeDao; import com.waben.stock.collector.dao.impl.jpa.StrategyTypeRepository; import com.waben.stock.collector.entity.StrategyType; /** * 策略类型 Dao实现 * * @author luomengan * */ @Repository public class StrategyTypeDaoImpl implements StrategyTypeDao { @Autowired private StrategyTypeRepository strategyTypeRepository; @Override public StrategyType createStrategyType(StrategyType strategyType) { return strategyTypeRepository.save(strategyType); } @Override public void deleteStrategyTypeById(Long id) { strategyTypeRepository.delete(id); } @Override public StrategyType updateStrategyType(StrategyType strategyType) { return strategyTypeRepository.save(strategyType); } @Override public StrategyType retrieveStrategyTypeById(Long id) { return strategyTypeRepository.findById(id); } @Override public Page<StrategyType> pageStrategyType(int page, int limit) { return strategyTypeRepository.findAll(new PageRequest(page, limit)); } @Override public List<StrategyType> listStrategyType() { return strategyTypeRepository.findAll(); } @Override public StrategyType getByDomainAndDataId(String domain, Long dataId) { return strategyTypeRepository.findByDomainAndDataId(domain, dataId); } }
true
b81ff959c25d440eabdd5e4bd9d54b0a1cab90f5
Java
TraxnetOrg/TraxnetSDK-AndroidSample
/app/src/main/java/ee/traxnet/sample/MainActivity.java
UTF-8
9,497
1.710938
2
[ "Apache-2.0" ]
permissive
package ee.traxnet.sample; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import ee.traxnet.sample.vast.VASTActivity; import ee.traxnet.sdk.Traxnet; import ee.traxnet.sdk.TraxnetAd; import ee.traxnet.sdk.TraxnetAdRequestListener; import ee.traxnet.sdk.TraxnetAdRequestOptions; import ee.traxnet.sdk.TraxnetAdShowListener; import ee.traxnet.sdk.TraxnetRewardListener; import ee.traxnet.sdk.TraxnetShowOptions; public class MainActivity extends AppCompatActivity { private Button showAddBtn; private TraxnetAd ad; private ProgressDialog progressDialog; private boolean showCompleteDialog = false; private boolean rewarded = false; private boolean completed = false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button requestCachedVideoAdBan = findViewById(R.id.btnRequestVideoAd); Button requestStreamVideoAdBtn = findViewById(R.id.btnRequestStreamVideoAd); Button requestInterstitialBannerAdBtn = findViewById(R.id.btnRequestInterstitialVideo); Button requestBannerAdButton = findViewById(R.id.btnRequestBannerAd); progressDialog = new ProgressDialog(this); requestCachedVideoAdBan.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadAd(BuildConfig.traxnetVideoZoneId, TraxnetAdRequestOptions.CACHE_TYPE_CACHED); } }); requestStreamVideoAdBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadAd(BuildConfig.traxnetVideoZoneId, TraxnetAdRequestOptions.CACHE_TYPE_STREAMED); } }); requestBannerAdButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadAd(BuildConfig.traxnetInterstitialBannerZoneId, TraxnetAdRequestOptions.CACHE_TYPE_STREAMED); } }); requestInterstitialBannerAdBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadAd(BuildConfig.traxnetInterstitialVideoZoneId, TraxnetAdRequestOptions.CACHE_TYPE_STREAMED); } }); Button vastActivityBtn = findViewById(R.id.btnSecondActivity); vastActivityBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, VASTActivity.class); startActivity(intent); } }); showAddBtn = findViewById(R.id.btnShowAd); showAddBtn.setEnabled(false); showAddBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (ad != null) { showAddBtn.setEnabled(false); TraxnetShowOptions showOptions = new TraxnetShowOptions(); ad.show(MainActivity.this, showOptions, new TraxnetAdShowListener() { @Override public void onOpened(TraxnetAd ad) { Log.e("MainActivity", "on ad opened"); } @Override public void onClosed(TraxnetAd ad) { Log.e("MainActivity", "on ad closed"); } }); MainActivity.this.ad = null; } } }); Button nativeBanner = findViewById(R.id.btnNativeBanner); nativeBanner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, NativeBannerActivity.class); startActivity(intent); } }); Button nativeBannerList = findViewById(R.id.btnNativeBannerInList); nativeBannerList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, NativeBannerInList.class); startActivity(intent); } }); Button nativeVideo = findViewById(R.id.btnNativeVideo); nativeVideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, NativeVideoActivity.class); startActivity(intent); } }); Button nativeVideoList = findViewById(R.id.btnNativeVideoInList); nativeVideoList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, NativeVideoInList.class); startActivity(intent); } }); Button nativeWebBanner = findViewById(R.id.btnWebBanner); nativeWebBanner.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, WebBannerActivity.class); startActivity(intent); } }); Traxnet.setRewardListener(new TraxnetRewardListener() { @Override public void onAdShowFinished(final TraxnetAd ad, final boolean completed) { Log.e("MainActivity", "isCompleted? " + completed + ", adId: " + (ad == null ? "NULL" : ad.getId()) + ", zoneId: " + (ad == null ? "NULL" : ad.getZoneId())); MainActivity.this.ad = null; showCompleteDialog = true; MainActivity.this.completed = completed; if (ad != null) { MainActivity.this.rewarded = ad.isRewardedAd(); } if (!completed) Toast.makeText(MainActivity.this, "Ad Closed or No Ad Available", Toast.LENGTH_SHORT).show(); } }); } private void loadAd(final String zoneId, final int catchType) { if (ad == null) { TraxnetAdRequestOptions options = new TraxnetAdRequestOptions(catchType); showProgressDialog(); Traxnet.requestAd(MainActivity.this, zoneId, options, new TraxnetAdRequestListener() { @Override public void onError(String error) { Toast.makeText(MainActivity.this, "ERROR:\n" + error, Toast.LENGTH_SHORT).show(); Log.e("Traxnet", "ERROR:" + error); progressDialog.dismiss(); } @Override public void onAdAvailable(TraxnetAd ad) { MainActivity.this.ad = ad; showAddBtn.setEnabled(true); Log.e("Traxnet", "adId: " + (ad == null ? "NULL" : ad.getId()) + " available, zoneId: " + (ad == null ? "NULL" : ad.getZoneId())); progressDialog.dismiss(); } @Override public void onNoAdAvailable() { Toast.makeText(MainActivity.this, "No Ad Available", Toast.LENGTH_LONG).show(); Log.e("Traxnet", "No Ad Available"); progressDialog.dismiss(); } @Override public void onNoNetwork() { Toast.makeText(MainActivity.this, "No Network", Toast.LENGTH_SHORT).show(); Log.e("Traxnet", "No Network Available"); progressDialog.dismiss(); } @Override public void onExpiring(TraxnetAd ad) { showAddBtn.setEnabled(false); MainActivity.this.ad = null; loadAd(zoneId, catchType); } }); } } private void showProgressDialog() { progressDialog.setCancelable(false); progressDialog.setMessage("Loading ..."); progressDialog.show(); } @Override protected void onResume() { super.onResume(); if (showCompleteDialog) { showCompleteDialog = false; new AlertDialog.Builder(MainActivity.this) .setTitle("View was...") .setMessage("DONE!, completed? " + completed + ", rewarded? " + rewarded) .setNeutralButton("Nothing", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .show(); } } }
true
e21095f9161cd39fa4e147104850ee39f25507e5
Java
prakyg/code
/Algorithms/src/programs/memoryAlloc/Basic.java
UTF-8
1,892
2.9375
3
[ "MIT" ]
permissive
package programs.memoryAlloc; import org.openjdk.jol.info.ClassLayout; import org.openjdk.jol.info.GraphLayout; import org.openjdk.jol.util.VMSupport; /* * This sample showcases the basic field layout. * You can see a few notable things here: * a) how much the object header consumes; * b) how fields are laid out; * c) how the external alignment beefs up the object size */ //For more examples: http://hg.openjdk.java.net/code-tools/jol/file/tip/jol-samples/src/main/java/org/openjdk/jol/samples/ public class Basic { boolean a; public Basic() { super(); } public static void main(String[] args) { // MemoryTest memoryTest = new MemoryTest(); System.out.println(System.getProperty("java.version")); System.out.println(VMSupport.vmDetails()); // Shallow space will be printed: This is only the space consumed by a // single instance of that class; // it does not include any other objects referenced by that class. // It does include VM overhead for the object header, field alignment // and padding. System.out.println(ClassLayout.parseClass(Basic.class).toPrintable()); System.out.println(ClassLayout.parseClass(A.class).toPrintable()); A obj = new A(); // Deep space // Of course, some objects in the footprint might be shared (also // referenced from other objects), // so it is an overapproximation of the space that could be reclaimed // when that object is garbage collected. System.out.println(GraphLayout.parseInstance(obj).toFootprint()); // If you instead use GraphLayout.parseInstance(obj).toPrintable(), // jol will tell you the address, size, type, value and path of field // dereferences to each referenced object, // though that's usually too much detail to be useful System.out.println(GraphLayout.parseInstance(obj).toPrintable()); } public static class A { Integer a; } }
true
838631d2c6da280a94d5e2e6f554aa6a04d24d78
Java
tripplerizz/HiddenTreasures
/app/src/main/java/com/example/hiddentreasure/ui/PirateCamera/PirateCamPreview.java
UTF-8
1,553
2.1875
2
[]
no_license
package com.example.hiddentreasure.ui.PirateCamera; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; public class PirateCamPreview extends SurfaceView implements SurfaceHolder { public PirateCamPreview(Context context) { super(context); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Paint paint = new Paint(); paint.setStyle(Paint.Style.FILL); paint.setColor(0xff101010); canvas.drawCircle(50,50, 100, paint); } @Override public void addCallback(Callback callback) { } @Override public void removeCallback(Callback callback) { } @Override public boolean isCreating() { return false; } @Override public void setType(int type) { } @Override public void setFixedSize(int width, int height) { } @Override public void setSizeFromLayout() { } @Override public void setFormat(int format) { } @Override public Canvas lockCanvas() { return null; } @Override public Canvas lockCanvas(Rect dirty) { return null; } @Override public void unlockCanvasAndPost(Canvas canvas) { } @Override public Rect getSurfaceFrame() { return null; } @Override public Surface getSurface() { return null; } }
true
c546184320483cdd20f979ed4d77d2555dbb610d
Java
sanfenzZ/src
/SocketServer.java
GB18030
1,155
3.21875
3
[]
no_license
package src; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; /** * @author me * @date 2018714 * @version 1.0.0 */ public class SocketServer { public static void main(String[] args) throws IOException { ServerSocket ss = new ServerSocket(8888); System.out.println(""); Socket s = ss.accept(); InputStream is = s.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); PrintWriter out = new PrintWriter(s.getOutputStream(),true); String temp = null; while((temp = br.readLine())!= null){ System.out.println("յϢ"); System.out.println("յϢΪ"+temp+"õϢIPַǣ"+ss.getInetAddress().getHostAddress()); out.flush(); } OutputStream os = s.getOutputStream(); PrintWriter pr = new PrintWriter(os); pr.print("յϢ"); pr.flush(); pr.close(); is.close(); os.close(); s.close(); } }
true
10ef9ea9d77b8d620ec513d4eb1f65ae8126d769
Java
ANWAIERJUMAI/Java-Eclipse
/Food/src/Dinner/Fnata.java
UTF-8
146
1.6875
2
[]
no_license
package Dinner; public class Fnata { public static void main(String[] args) { Noddles noddles=new Noddles(); noddles.home(); } }
true
3e8b0fdfb2b2d16e209b72ca9696e1cc5a9abc7e
Java
heduiandroid/HDLinLiC
/java/com/linli/consumer/bean/IdsBean.java
UTF-8
374
1.8125
2
[]
no_license
package com.linli.consumer.bean; import java.util.List; /** * Created by tomoyo on 2017/2/12. * 批量查询商品详情,上传参数 */ public class IdsBean { private List<Long> goodIds; //商品id集合 public List<Long> getGoodIds() { return goodIds; } public void setGoodIds(List<Long> goodIds) { this.goodIds = goodIds; } }
true
a06e5240da18243e411eb772d391847b823058f4
Java
jinde06/FlyButter
/flyButter/src/com/example/flybutter/MainActivitygame.java
UTF-8
8,013
2.203125
2
[]
no_license
package com.example.flybutter; import java.util.Random; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Align; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; @SuppressLint({ "DrawAllocation", "ClickableViewAccessibility" }) public class MainActivitygame extends Activity { Sexy sexy; private static int hscore; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); sexy = new Sexy(this); setContentView(sexy); } public static int getHS() { return hscore; } public class Sexy extends View { Paint paint = new Paint();; float x, y, web1, web2, web3, web4, x1, x2, x3, x4, game, flap; int height, width, start, score; Random random = new Random(); Bitmap bg, bfly, net1, net2; Paint txt = new Paint(); Collision obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9; public Sexy(Context context) { super(context); x1 = x2 = x3 = x4 = -1; bg = BitmapFactory.decodeResource(getResources(), R.drawable.bckgrnd); bfly = BitmapFactory .decodeResource(getResources(), R.drawable.fbaa); net2 = BitmapFactory .decodeResource(getResources(), R.drawable.weba); net1 = BitmapFactory .decodeResource(getResources(), R.drawable.webb); score = 0; } int init = 0; public void resize() { bg = Bitmap.createScaledBitmap(bg, width, height, false); net1 = Bitmap.createScaledBitmap(net1, 200, 800, false); net2 = Bitmap.createScaledBitmap(net2, 200, 800, false); init++; } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); height = canvas.getHeight(); width = canvas.getWidth(); if (init == 0) { resize(); } canvas.drawBitmap(bg, 0, 0, null); txt.setARGB(255, 255, 0, 0); txt.setTextAlign(Align.CENTER); txt.setTextSize(25); if (start == 0) { canvas.drawText("HS : " + hscore, canvas.getWidth() / 2, height / 8, txt); canvas.drawText("TAP TO START", canvas.getWidth() / 2, height / 4, txt); score = 0; game = 0; } else { if (score > hscore) { hscore = score; } canvas.drawText("Score : " + score, canvas.getWidth() / 2, height / 4, txt); if (flap > 0) { flap -= height * .02f; y -= height * .02f; } if (x1 < 0) { web1 = random.nextInt(height); if (web1 > height - (height * .4f)) { web1 -= height * .4f; } if (web1 < height * .1f) { web1 += height * .1f; } x1 = width * 2.4f; score++; } if (x2 < 0) { web2 = random.nextInt(height); if (web2 > height - (height * .4f)) { web2 -= height * .4f; } if (web2 < height * .1f) { web2 += height * .1f; } x2 = width * 2.4f; score++; } if (x3 < 0) { web3 = random.nextInt(height); if (web3 > height - (height * .4f)) { web3 -= height * .4f; } if (web3 < height * .1f) { web3 += height * .1f; } x3 = width * 2.4f; score++; } if (x4 < 0) { web4 = random.nextInt(height); if (web4 > height - (height * .4f)) { web4 -= height * .4f; } if (web4 < height * .1f) { web4 += height * .1f; } x4 = width * 2.4f; score++; } if (game == 0) { x1 = width * 1f; x2 = width * 1.6f; x3 = width * 2.2f; x4 = width * 2.8f; y = height * .25f; game = 1; score = 0; } paint.setColor(Color.GREEN); // canvas.drawRect(left, top, right, bottom, paint); // canvas.drawRect(x1--, 0, x1 + (width * .2f), web1, paint); // canvas.drawRect(x1, web1 + height * .3f, x1 + (width * .2f), // height, paint); canvas.drawBitmap(net1, x1 -= 3, web1 - 800, null); canvas.drawBitmap(net2, x1, web1 + height * .3f, null); // canvas.drawRect(x2--, 0, x2 + (width * .2f), web2, paint); // canvas.drawRect(x2, web2 + height * .3f, x2 + (width * .2f), // height, paint); canvas.drawBitmap(net1, x2 -= 3, web2 - 800, null); canvas.drawBitmap(net2, x2, web2 + height * .3f, null); // canvas.drawRect(x3--, 0, x3 + (width * .2f), web3, paint); // canvas.drawRect(x3, web3 + height * .3f, x3 + (width * .2f), // height, paint); canvas.drawBitmap(net1, x3 -= 3, web3 - 800, null); canvas.drawBitmap(net2, x3, web3 + height * .3f, null); // canvas.drawRect(x4--, 0, x4 + (width * .2f), web4, paint); // canvas.drawRect(x4, web4 + height * .3f, x4 + (width * .2f), // height, paint); canvas.drawBitmap(net1, x4 -= 3, web4 - 800, null); canvas.drawBitmap(net2, x4, web4 + height * .3f, null); paint.setARGB(255, 0, 0, 0); paint.setTextAlign(Align.CENTER); paint.setTextSize(25); canvas.drawText("Aina - Majo", width / 2, height * .1f, paint); canvas.drawText("Credit : RAC", width / 2, height * .75f, paint); if (y < 0) { y = width * .05f; } if (y > height) { game = 0; } paint.setColor(Color.RED); // canvas.drawCircle(width * .20f, y++, width * .05f, paint); canvas.drawBitmap(bfly, width * .20f, y += 5, null); obj1 = new Collision(width * .20f, y, bfly.getWidth(), bfly.getHeight()); obj2 = new Collision(x1, web1 - 800, 200, 800); obj3 = new Collision(x1, web1 + height * .3f, 200, 800); obj4 = new Collision(x2, web2 - 800, 200, 800); obj5 = new Collision(x2, web2 + height * .3f, 200, 800); obj6 = new Collision(x3, web3 - 800, 200, 800); obj7 = new Collision(x3, web3 + height * .3f, 200, 800); obj8 = new Collision(x4, web4 - 800, 200, 800); obj9 = new Collision(x4, web4 + height * .3f, 200, 800); if (obj1.Rec(obj2) | obj1.Rec(obj3) | obj1.Rec(obj4) | obj1.Rec(obj5) | obj1.Rec(obj6) | obj1.Rec(obj7) | obj1.Rec(obj8) | obj1.Rec(obj9)) { start = 0; } } invalidate(); } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: start++; flap = height * .15f; break; } invalidate(); return true; } } public class Collision { public float x; public float y; public float width; public float height; public float radius; public Collision() { } public Collision(float x, float y, float width, float height) { this.x = x; this.y = y; this.width = width; this.height = height; } public Collision(float x, float y, float radius) { this.x = x; this.y = y; this.radius = radius; } public Boolean Rec(Collision obj2) { if (this.x < obj2.x + obj2.width && this.x + this.width > obj2.x && this.y < obj2.y + obj2.height && this.y + this.height > obj2.y) return true; else return false; } public Boolean Cir(Collision obj2) { float distance = (this.x - obj2.x) * (this.x - obj2.x) + (this.y - obj2.y) * (this.y - obj2.y); float radiusSum = this.radius + obj2.radius; return distance <= radiusSum * radiusSum; } public Boolean RecCir(Collision obj2) { float closestX = obj2.x; float closestY = obj2.y; if (obj2.x < this.x) { closestX = this.x; } else if (obj2.x > this.x + this.width) { closestX = this.x + this.width; } if (obj2.y < this.y) { closestY = this.y; } else if (obj2.y > this.y + this.height) { closestY = this.y + this.height; } float distX = (closestX - obj2.x) * (closestX - obj2.x); float distY = (closestY - obj2.y) * (closestY - obj2.y); return distX + distY < obj2.radius * obj2.radius; } } }
true
de0a9ed6729ed04b63e3a176dfae75f64a8a51ff
Java
YuYing-Liang/JavaExamples
/Classes/src/car/Car.java
UTF-8
7,209
3.59375
4
[]
no_license
package car; import java.awt.Point; public class Car { /** * The number of tires for a {@code Car}. * * This field is static since all {@code Car} objects will have the same * number of tires. */ private static final int NUMBER_OF_TIRES = 4; /** * The company that makes {@code this Car}. */ private final String COMPANY; /** * The model of {@code this Car}. */ private final String MODEL; /** * The number of seats in {@code this Car}. */ private int seats; /** * The side which the steering wheel is on for {@code this Car}. */ private Side side; // engine /** * The fuel capacity of {@code this Car} in liters. */ private final double FUEL_CAPACITY; /** * The fuel efficiency of {@code this Car} in kilometers per liter. */ private final double FUEL_EFFICIENCY; /** * The amount of fuel currently in the tank of {@code this Car} in liters. */ private double fuel; // motion /** * The current position of {@code this Car} represented by a {@code Point}. */ private Point position; /** * The current velocity of {@code this Car} in kilometers per hour. The * position of the car will change by this amount each time {@code this Car} * is moved. */ private Point velocity; /** * The straight line distance, in kilometers, traveled per time, in hours, * based on the velocity. */ private double minimumDistance; /** * The maximum distance, in kilometers, that {@code this Car} can travel * before running out of fuel. */ private double maximumDistance; /** * Constructs a {@code new Car} using the specified paramters. * * @param company * the company that makes {@code this Car}. * @param model * the model of {@code this Car}. * @param seats * the number of seats in {@code this Car}. * @param fuelCapacity * the fuel capacity of {@code this Car} in liters. * @param fuelEfficiency * the fuel efficiency of {@code this Car} in kilometers per * liter. * @param fuelTankState * whether the tank is initially full or empty. * @param initialPosition * the initial position of {@code this Car}. */ public Car(String company, String model, int seats, Side side, double fuelCapacity, double fuelEfficiency, FuelTankState fuelTankState, Point initialPosition) { this.COMPANY = company; this.MODEL = model; this.seats = seats; this.side = side; this.FUEL_CAPACITY = fuelCapacity; FUEL_EFFICIENCY = fuelEfficiency; if (fuelTankState == FuelTankState.FULL) { this.fuel = FUEL_CAPACITY; } else { this.fuel = 0; } this.position = initialPosition; // the initial velocity of a car will always be 0. this.velocity = new Point(0, 0); this.minimumDistance = 0; /* * The fuel efficiency indicates the number of kilometers that can be * covered for each liter of fuel. * * The fuel indicates how many liters of fuel are currently in the tank * of this car. * * The maximum possible distance this car can travel is the product of * the fuel remaining and the fuel efficiency. */ this.maximumDistance = fuel * FUEL_EFFICIENCY; } /** * Changes the current position of the car based on the velocity, assuming * there is enough fuel to do so. */ public void move() { // If the velocity of the car is 0, do not move anywhere. if (getMinimumDistance() > 0) { /* * In order for the car to move, there must be enough fuel to move * the required distance. * * The fuel efficiency indicates the number of kilometers that can * be covered for each liter of fuel. * * The fuel indicates how many liters of fuel are currently in the * tank of this car. * * The maximum possible distance this car can travel is the product * of the fuel remaining and the fuel efficiency. */ maximumDistance = fuel * FUEL_EFFICIENCY; // the car should only move if the maximum possible distance is // greater // than or equal to the minimum distance the car can travel. if (maximumDistance >= getMinimumDistance()) { position.setLocation(position.getX() + velocity.getX(), position.getY() + velocity.getY()); /* * The minimum distance indicates the minimum number of * kilometers this car can travel based on the velocity. * * The fuel indicates how many liters of fuel are currently in * the tank of this car. * */ fuel -= getMinimumDistance() / FUEL_EFFICIENCY; } else { fuel = 0; } } } /** * Sets the velocity of {@code this Car} to the specified velocity. * * @param vel * the velocity set point. */ public void setVelocity(Point vel) { this.velocity = vel; // uses the Pythagorean theorem to determine the actual straight // distance traveled in kilometers per hour. this.minimumDistance = Math .sqrt(this.velocity.getX() * this.velocity.getX() + this.velocity.getY() * this.velocity.getY()); } /** * Gets the velocity of {@code this Car}. * * @return the velocity. */ public Point getVelocity() { return this.velocity; } /** * Gets the minimum straight line distance that {@code this Car} can travel * in kilometers per hour. * * @return the minimum distance that can be covered by {@code this Car}. */ public double getMinimumDistance() { return this.minimumDistance; } public String getCompany() { return COMPANY; } public String getModel() { return MODEL; } public int getSeats() { return seats; } public double getFuelCapacity() { return FUEL_CAPACITY; } public double getFuel() { return fuel; } public boolean isTankEmpty() { return fuel == 0; } public Side getSide() { return side; } public Point getPosition() { return position; } /** * Refuels {@code this Car} with the specified amount of fuel in liters. * Excess fuel is not added. * * @param fuel * the amount of fuel to add to the tank in liters. */ public void refuel(double fuel) { if (this.fuel + fuel > FUEL_CAPACITY) { this.fuel = FUEL_CAPACITY; } else { this.fuel += fuel; } } /** * Refuels {@code this Car} to until the tank is full. */ public void refuel() { this.fuel = FUEL_CAPACITY; } /** * Gets the number of tires on a {@code Car}. * * This method is static since all {@code Car} objects share this property. * * @return the number of tires. */ public static int getNumberOfTires() { return NUMBER_OF_TIRES; } /** * Outputs the company, mode, location, fuel and current position of * {@code this Car}. */ public void getStats() { System.out.println(COMPANY + " " + MODEL); System.out.println("Fuel Remaining: " + fuel + " L"); System.out.println("Position: (" + position.getX() + "," + position.getY() + ")"); System.out.println(); } }
true
a776110480720c834a70210700a4c41c148ae4bb
Java
griftoon227/FitnessFiend
/app/src/main/java/com/example/grift/fitnessfiend/RecipeActivity.java
UTF-8
5,915
2.140625
2
[]
no_license
package com.example.grift.fitnessfiend; import android.content.Intent; import android.os.Bundle; import android.text.Html; import android.text.util.Linkify; import android.widget.Button; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.firebase.FirebaseApp; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; public class RecipeActivity extends AppCompatActivity { private RecipeListItem r; private List<String> ingredientList = new ArrayList<>(); private List<RecipeListItem.Nutrient> nutrientList = new ArrayList<>(); private CheckBox cbLiked; private DatabaseReference likedReference; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recipe); FirebaseApp.initializeApp(this); //Controls TextView tvRecipeName = findViewById(R.id.tvRecipeName); TextView tvLink = findViewById(R.id.tvLinkDirection); Button goBackBtn = findViewById(R.id.go_back_btn); ImageView ivRecipe = findViewById(R.id.ivRecipe); RecyclerView rvIngredients = findViewById(R.id.rvIngredients); RecyclerView rvNutrients = findViewById(R.id.rvNutrients); cbLiked = findViewById(R.id.cbLiked); //onclick listener go back button goBackBtn.setOnClickListener(v -> startActivity(new Intent(RecipeActivity.this, recipes.class))); //Database Stuff if (FirebaseAuth.getInstance().getCurrentUser() != null){ likedReference = FirebaseDatabase.getInstance().getReference().child("users").child( FirebaseAuth.getInstance().getCurrentUser().getUid()).child("recipe_screen").child("recipeLiked"); } //getting recipe Intent i = getIntent(); r = i.getParcelableExtra("recipe"); //load food name and picture tvRecipeName.setText(r.getName()); Picasso.get().load(r.getPicture()).into(ivRecipe); //Link Stuff tvLink.setText(Html.fromHtml(String.format("<u>%s</u>", tvLink.getText().toString()))); Linkify.addLinks(tvLink,Pattern.compile(""),r.getSource()); //adapter stuff new IngredientAdapter(ingredientList); IngredientAdapter ingAdapter; //Ingredient RecyclerView for (int j = 0; j < r.getIngredientsList().size(); j++) ingredientList.add(r.getIngredient(j)); for(int j = 0; j < ingredientList.size(); j++) ingredientList.set(j, String.format("%s\n", ingredientList.get(j))); ingAdapter = new IngredientAdapter(ingredientList); RecyclerView.LayoutManager ingLayoutManager = new LinearLayoutManager(getApplicationContext()); rvIngredients.setLayoutManager(ingLayoutManager); rvIngredients.setItemAnimator(new DefaultItemAnimator()); rvIngredients.setAdapter(ingAdapter); ingAdapter.notifyDataSetChanged(); //Nutrient RecyclerView for (int j = 0; j<r.getNutrientsList().size(); j++){ nutrientList.add(r.getNutrient(j)); } NutrientAdapter nutAdapter = new NutrientAdapter(nutrientList); RecyclerView.LayoutManager nutLayoutManager = new LinearLayoutManager(getApplicationContext()); rvNutrients.setLayoutManager(nutLayoutManager); rvNutrients.setItemAnimator(new DefaultItemAnimator()); rvNutrients.setAdapter(nutAdapter); nutAdapter.notifyDataSetChanged(); //Checking if recipe is liked on opening screen likedReference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.hasChild(r.getName())) cbLiked.setChecked(true); } @Override public void onCancelled(@NonNull DatabaseError databaseError) {} }); //Adding a liked history cbLiked.setOnCheckedChangeListener((buttonView, isChecked) -> { if(isChecked){ likedReference.child(r.getName()).setValue(r); //put the rest of the data in for (int data = 0; data < r.getIngredientsList().size(); data++) likedReference.child(r.getName()).child("ingredientsList").child(String.valueOf(data)).setValue(r.getIngredientsList().get(data)); for (int data = 0; data < r.getNutrientsList().size(); data++) { likedReference.child(r.getName()).child("nutrientsList").child(String.valueOf(data)).child("name").setValue(r.getNutrientsList().get(data).getName()); likedReference.child(r.getName()).child("nutrientsList").child(String.valueOf(data)).child("quantity").setValue(r.getNutrientsList().get(data).getQuantity()); likedReference.child(r.getName()).child("nutrientsList").child(String.valueOf(data)).child("unit").setValue(r.getNutrientsList().get(data).getUnit()); } likedReference.child(r.getName()).child("picture").setValue(r.getPicture()); } else { likedReference.child(r.getName()).removeValue(); } }); } }
true
adb6990c3c19e8bf0f8420525ecac24ef0d2a8c3
Java
LNMHacks/LNMHacks-2.0-Submission
/Cosmo Coders/MyBusiness/app/src/main/java/com/example/android/mybusiness/sales.java
UTF-8
585
2.046875
2
[]
no_license
package com.example.android.mybusiness; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Toast; import static android.widget.Toast.LENGTH_SHORT; public class sales extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sales); setTitle("Sales"); } public void sub_sal(View view){ Toast.makeText(sales.this, "Data Saved", LENGTH_SHORT).show(); } }
true
09c23c8c4de14f64a4ec2ce0aa3f3b157ac07c8c
Java
Koallider/runner-game-template
/android/src/com/gamestudio24/martianrun/android/BannerActivity.java
UTF-8
1,519
2.046875
2
[ "Apache-2.0" ]
permissive
package com.gamestudio24.martianrun.android; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import com.appsgeyser.sdk.AppsgeyserSDK; import com.appsgeyser.sdk.ads.fastTrack.adapters.FastTrackBaseAdapter; import com.appsgeyser.sdk.configuration.Constants; /** * Created by roma on 20.02.2018. */ public class BannerActivity extends AppCompatActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); AppsgeyserSDK.getFastTrackAdsController().setFullscreenListener(new FastTrackBaseAdapter.FullscreenListener() { @Override public void onRequest() { //called after fullscreen banner request } @Override public void onShow() { //called after fullscreen banner has been shown } @Override public void onClose() { finish(); } @Override public void onFailedToShow() { finish(); } }); AppsgeyserSDK.getFastTrackAdsController() .showFullscreen(Constants.BannerLoadTags.ON_START, this); } @Override public void onResume() { super.onResume(); AppsgeyserSDK.onResume(this); } @Override public void onPause() { super.onPause(); AppsgeyserSDK.onPause(this); } }
true
719cdf19df079e9217b0da425c86a3b6bf19ff2e
Java
devaurelian/helloworldselfaware-android
/HelloWorldSelfAware/app/src/main/java/com/appliberated/helloworldselfaware/AndroidInfo.java
UTF-8
1,863
2.15625
2
[]
no_license
/* * Copyright (C) 2017 Appliberated * http://www.appliberated.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.appliberated.helloworldselfaware; import android.annotation.SuppressLint; import android.content.Context; import android.os.Build; import android.provider.Settings; /** * Information about the Android device and version. */ class AndroidInfo { /** * Return an AndroidInfo device hardware ID. */ @SuppressLint("HardwareIds") static String getId(Context context) { // For AndroidInfo O and above, use ANDROID_ID, because Build.SERIAL has been deprecated, and the replacement // getSerial() method requires the READ_PHONE_STATE permission. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); } else { //noinspection deprecation return Build.SERIAL; } } /** * Return the AndroidInfo user-visible version string. */ @SuppressWarnings("SameReturnValue") static String getVersion() { return Build.VERSION.RELEASE; } /** * Return the AndroidInfo API Level. */ @SuppressWarnings("SameReturnValue") static int getLevel() { return Build.VERSION.SDK_INT; } }
true
59a9e40f024b0e5b5c608f714d8ae0322e0400cf
Java
laurentiuspilca/java1p_martie_2018
/java1pcurs5/Exemplu8.java
UTF-8
348
3.34375
3
[]
no_license
import java.util.*; public class Exemplu8 { public static void main(String [] args) { List<String> list = Arrays.asList("aaa", "bb", "ccccc", "ddd", "eeee"); list.stream() .map(s -> s.length()) .parallel() .filter(x -> x % 2 == 0) .forEach(System.out::println); } }
true
dc002649e496694ffd657293db106f1643766a7f
Java
Amedos/drone.delevery
/src/main/java/leroy/merlin/reader/ProduitReader.java
ISO-8859-1
1,952
2.625
3
[]
no_license
/** * */ package leroy.merlin.reader; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import leroy.merlin.common.Constants; import leroy.merlin.domain.Produit; import leroy.merlin.domain.Stock; /** * @author ahsouri * */ public class ProduitReader implements Constants { /***/ private static List<Produit> produits = new ArrayList<Produit>(); /** * * @return */ public static List<Produit> getProduits() { String line = ""; int counter = 1; try (BufferedReader br = new BufferedReader(new FileReader(PRODUITS_CSV))) { while ((line = br.readLine()) != null) { if (counter > 1) { String[] csvLine = line.split(SEPARATEUR); /** On suppose qu'on a toujours store + quantit dans le fichier csv */ if ((csvLine.length - 2) % 2 == 0) { int nombreStock = (csvLine.length - 2) / 2; List<Stock> stocks = getStocks(csvLine, nombreStock); produits.add(new Produit(csvLine[0], csvLine[1], stocks)); } else try { throw new Exception("Erreur dans la ligne du produit " + csvLine[0]); } catch (Exception e) { e.printStackTrace(); } } counter++; } } catch (IOException e) { e.printStackTrace(); } return produits; } /** * * @param csvColonne * @param nombreStock * @return */ private static List<Stock> getStocks(String[] csvColonne, int nombreStock) { List<Stock> stocks = new ArrayList<Stock>(); for (int step = 1; step < nombreStock + 1; step++) { stocks.add(new Stock(StoreReader.getStoreById(csvColonne[step * 2]), Integer.valueOf(csvColonne[1 + step * 2]))); } return stocks; } /** * * @param produiId * @return */ public static Produit getProduitById(String produiId) { return produits.stream().filter(produit -> produit.getProductId().equalsIgnoreCase(produiId)).findFirst().get(); } }
true
1527bd2974990b084cd3ce8183ffb86d37c744ee
Java
JzHartmut/srcJava_vishiaGui
/java/vishiaGui/org/vishia/curves/WriteCurveCsv.java
UTF-8
4,961
2.359375
2
[]
no_license
package org.vishia.curves; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.text.SimpleDateFormat; import java.util.Date; import org.vishia.util.Timeshort; public class WriteCurveCsv implements WriteCurve_ifc{ /**Version, history and copyright/copyleft. * <ul> * <li>2012-10-12 created. Firstly used for {@link org.vishia.guiInspc.InspcCurveView} and {@link org.vishia.gral.base.GralCurveView}. * </ul> * * <b>Copyright/Copyleft</b>:<br> * For this source the LGPL Lesser General Public License, * published by the Free Software Foundation is valid. * It means: * <ol> * <li> You can use this source without any restriction for any desired purpose. * <li> You can redistribute copies of this source to everybody. * <li> Every user of this source, also the user of redistribute copies * with or without payment, must accept this license for further using. * <li> But the LPGL is not appropriate for a whole software product, * if this source is only a part of them. It means, the user * must publish this part of source, * but doesn't need to publish the whole source of the own product. * <li> You can study and modify (improve) this source * for own using or for redistribution, but you have to license the * modified sources likewise under this LGPL Lesser General Public License. * You mustn't delete this Copyright/Copyleft inscription in this source file. * </ol> * If you intent to use this source without publishing its usage, you can get * a second license subscribing a special contract with the author. * * @author Hartmut Schorrig = hartmut.schorrig@vishia.de */ public static final int version = 20121012; File fOut; Writer out; Timeshort timeshortabs; String[] sPathsColumn; String[] sNamesColumn; String[] sColorsColumn; float[] aScale7div, aMid, aLine0; SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS"); StringBuilder uLine = new StringBuilder(5000); @Override public void setFile(File fOut){ this.fOut = fOut; sPathsColumn = null; } @Override public void setTrackInfo(int nrofTracks, int ixTrack, String sPath, String sName , String sColor, float scale7div, float mid, float line0){ if(sPathsColumn == null || sPathsColumn.length != nrofTracks) { //only create new instances for arrays if necessary. sPathsColumn = new String[nrofTracks]; sNamesColumn = new String[nrofTracks]; sColorsColumn = new String[nrofTracks]; aScale7div = new float[nrofTracks]; aMid = new float[nrofTracks]; aLine0 = new float[nrofTracks]; } this.sPathsColumn[ixTrack] = sPath; this.sNamesColumn[ixTrack] = sName; this.sColorsColumn[ixTrack] = sColor; this.aScale7div[ixTrack] = scale7div; this.aMid[ixTrack] = mid; this.aLine0[ixTrack] = line0; } public WriteCurveCsv() { } @Override public void writeCurveError(String msg) throws IOException { if(out !=null){ out.close(); } System.err.println("WriteCurveCsv error -" + msg + ";"); } @Override public void writeCurveFinish() throws IOException { out.close(); } @Override public void writeCurveRecord(int timeshort, float[] values) throws IOException { long time = timeshortabs.absTimeshort(timeshort); Date date = new Date(time); uLine.setLength(0); String sDate = dateFormat.format(date); uLine.append(sDate).append("; "); for(int ix = 0; ix < values.length; ++ix){ uLine.append(values[ix]).append("; "); } uLine.append("\r\n"); out.append(uLine); } @Override public void writeCurveStart(int timeshort) throws IOException { if(out !=null){ out.close(); } out = new FileWriter(fOut); out.append("CurveView-CSV version 150120\n"); writeStringLine(out, "name", sNamesColumn); writeStringLine(out, "color", sColorsColumn); writeFloatLine(out, "scale/div", aScale7div); writeFloatLine(out, "midValue", aMid); writeFloatLine(out, "0-line", aLine0); writeStringLine(out, "time", sPathsColumn); } private void writeStringLine(Writer out, String col0, String[] inp) throws IOException { uLine.setLength(0); uLine.append(col0).append("; "); for(String sColumn1: inp){ if(sColumn1 == null){ sColumn1 = "?"; } uLine.append(sColumn1).append("; "); } out.append(uLine).append('\n'); } private void writeFloatLine(Writer out, String col0, float[] inp) throws IOException { uLine.setLength(0); uLine.append(col0).append("; "); for(float val: inp){ uLine.append(Float.toString(val)).append("; "); } out.append(uLine).append('\n'); } @Override public void writeCurveTimestamp(Timeshort timeshortabs) { this.timeshortabs = timeshortabs; } }
true
c5488214b8304c181ee5b94cac8bf3c490fe56e8
Java
exatip407/folitics
/Folitics/src/main/java/com/ohmuk/folitics/hibernate/repository/share/ISentimentShareRepository.java
UTF-8
332
1.625
2
[]
no_license
package com.ohmuk.folitics.hibernate.repository.share; import com.ohmuk.folitics.hibernate.entity.share.SentimentShare; /** * Hibernate repository interface for entity: {@link SentimentShare} * @author Abhishek * */ public interface ISentimentShareRepository extends IShareHibernateRepository<SentimentShare> { }
true
651b9e9d18a24447e2012e523ddd7fbb082ead6c
Java
treynolds/rlg
/src/rw/RwWritingSystemChooser.java
UTF-8
235,852
2.265625
2
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * RwWritingSystemChooser.java * * Created on Feb 5, 2011, 3:51:50 PM */ package rw; import java.awt.*; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; import javax.swing.table.*; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import org.xml.sax.helpers.AttributesImpl; import org.w3c.dom.NodeList; import org.xml.sax.*; import javax.xml.xpath.*; import org.xml.sax.helpers.DefaultHandler; /** * * @author Ted */ public class RwWritingSystemChooser extends javax.swing.JDialog { /** Creates new form RwWritingSystemChooser */ public RwWritingSystemChooser(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); setLocationRelativeTo(parent); } public RwWritingSystemChooser(java.awt.Frame parent, String title, boolean modal) { super(parent, title, modal); initComponents(); setLocationRelativeTo(parent); } public RwWritingSystemChooser(Frame parent, String title, boolean modal, Vector vowels, Vector consonants, HashMap writingSystem) { super(parent, title, modal); initComponents(); directionalityButton.setVisible(false); abjadDirectionalityButton.setVisible(false); abugidaDirectionalityButton.setVisible(false); syllabaryDirectionalityButton.setVisible(false); setLocationRelativeTo(parent); vows = vowels; cons = consonants; setupSystem(vowels, consonants, writingSystem); } public void setupSystem(Vector vowels, Vector consonants, HashMap writingSystem) { int pos = 1; Vector vowls = new Vector(); Vector consnts = new Vector(); for (int v = 0; v < vowels.size(); v++) { vowls.add(new String(vowels.elementAt(v) + "")); } for (int v = 0; v < consonants.size(); v++) { consnts.add(new String(consonants.elementAt(v) + "")); } String sound = vowels.elementAt(0) + ""; while (pos < vowls.size()) { if (vowls.elementAt(pos).equals(sound)) { vowls.remove(pos); } else { sound = vowls.elementAt(pos) + ""; pos++; } } pos = 1; sound = consnts.elementAt(0) + ""; while (pos < consnts.size()) { if (consnts.elementAt(pos).equals(sound)) { consnts.remove(pos); } else { sound = consnts.elementAt(pos) + ""; pos++; } } DefaultTableModel dtm4 = (DefaultTableModel) syllabaryTable.getModel(); String fontname = (String) writingSystem.get("Font"); Font defaultFont = new Font("LCS-ConstructorII", 0, 14); syllabaryTable.setFont(defaultFont); alphaTable.setFont(defaultFont); abjadTable.setFont(defaultFont); abugidaTable.setFont(defaultFont); dtm4.setColumnCount(0); dtm4.setRowCount(0); Vector sconsonants = new Vector(consnts); if (!sconsonants.contains("NC")) { sconsonants.add("NC"); } dtm4.addColumn(" ", sconsonants); vowelNumCombo.removeAllItems(); consonantNumCombo.removeAllItems(); for (int a = 0; a < vowls.size(); a++) { dtm4.addColumn(vowls.elementAt(a)); vowelNumCombo.addItem(vowls.elementAt(a)); } dtm4.addColumn("NV"); vowelNumCombo.addItem("NV"); for (int a = 0; a < consnts.size(); a++) { consonantNumCombo.addItem(consnts.elementAt(a)); } consonantNumCombo.addItem("NC"); DefaultTableModel dtm = (DefaultTableModel) alphaTable.getModel(); DefaultTableModel dtm1 = (DefaultTableModel) abjadTable.getModel(); DefaultTableModel dtm2 = (DefaultTableModel) abugidaTable.getModel(); DefaultTableModel dtm3 = (DefaultTableModel) multigraphicTable.getModel(); DefaultTableModel dtm5 = (DefaultTableModel) punctuationTable.getModel(); DefaultTableModel dtm6 = (DefaultTableModel) presetsTable.getModel(); dtm.setRowCount(0); dtm1.setRowCount(0); dtm2.setRowCount(0); dtm3.setRowCount(0); Vector ds = new Vector(); ds.addAll(vowls); ds.addAll(consnts); Object[] ob = ds.toArray(); Arrays.sort(ob); dtm.setRowCount(ob.length); dtm1.setRowCount(ob.length); dtm2.setRowCount(ob.length); dtm3.setRowCount(ob.length); HashMap phonemes = (HashMap) writingSystem.get("Phonemes"); System.out.println(phonemes + ""); for (int a = 0; a < ob.length; a++) { dtm.setValueAt(ob[a], a, 0); dtm1.setValueAt(ob[a], a, 0); dtm2.setValueAt(ob[a], a, 0); dtm3.setValueAt(ob[a], a, 0); } alphaTable.getColumnModel().getColumn(1).setCellRenderer(tcr2); abjadTable.getColumnModel().getColumn(1).setCellRenderer(tcr2); abugidaTable.getColumnModel().getColumn(1).setCellRenderer(tcr2); multigraphicTable.getColumnModel().getColumn(1).setCellRenderer(tcr2); multigraphicTable.getColumnModel().getColumn(2).setCellRenderer(tcr2); punctuationTable.getColumnModel().getColumn(1).setCellRenderer(tcr2); Vector tabs = new Vector(); tabs.add("Alphabet"); tabs.add("Abjad"); tabs.add("Abugida"); tabs.add("Syllabary"); tabs.add("Multigraphic"); writingSystemPane.setSelectedIndex(tabs.indexOf(writingSystem.get("System"))); if (writingSystemPane.getSelectedIndex() == 0) { // Alphabet consonants.remove("NV"); vowels.remove("NC"); phonemes.remove("NC"); phonemes.remove("NV"); fontField.setText(fontname); if (writingSystem.get("FontType").equals("borrowed")) { borrowedCharsRadio.setSelected(true); } else { customFontRadio.setSelected(true); fontField.setEnabled(true); fontField.setEditable(true); chooseAlphabetFontButton.setEnabled(true); } alphaGlyphsPerLetterSpinner.setValue(Integer.parseInt(writingSystem.get("GlyphsPerLetter") + "")); for (int a = 0; a < phonemes.size(); a++) { String[] z = (phonemes.get(ob[a]) + "").split(" "); for (int b = 0; b < z.length; b++) { dtm.setValueAt(z[b], a, b + 1); } } tcr2.setFontName(writingSystem.get("Font").toString()); HashMap gum = (HashMap) writingSystem.get("GlyphUseMap"); int ng = Integer.parseInt(writingSystem.get("GlyphsPerLetter") + ""); for (int nga = ng; nga > 0; nga--) { alphaLetterGlyphNumberCombo.setSelectedItem("Glyph_" + nga); alphaLetterUsedInCombo.setSelectedItem(gum.get("Glyph_" + nga)); } capitalizationCombo.setSelectedItem((String) writingSystem.get("CapRule")); characterLabel.setFont(new Font(writingSystem.get("Font") + "", Font.PLAIN, 30)); } else if (writingSystemPane.getSelectedIndex() == 1) { // Abjad abjadFontField.setText(fontname); if (writingSystem.get("FontType").equals("borrowed")) { borrowedAbjadFontRadio.setSelected(true); } else { customAbjadFontRadio.setSelected(true); abjadFontField.setEnabled(true); abjadFontField.setEditable(true); chooseAbjadFontButton.setEnabled(true); abjadCharLabel.setFont(new Font(writingSystem.get("Font") + "", Font.PLAIN, 30)); } abjadGlyphsPerConsonantSpinner.setValue(writingSystem.get("GlyphsPerLetter")); for (int a = 0; a < phonemes.size(); a++) { String[] z = (phonemes.get(ob[a]) + "").split(" "); for (int b = 0; b < z.length; b++) { dtm1.setValueAt(z[b], a, b + 1); } } tcr2.setFontName(writingSystem.get("Font").toString()); boolean b = true; //showVowelsCheck.setSelected(b); } else if (writingSystemPane.getSelectedIndex() == 2) { // Abugida abugidaFontField.setText(fontname); if (writingSystem.get("FontType").equals("borrowed")) { abugidaBorrowedFontRadio.setSelected(true); } else { abugidaCustomFontRadio.setSelected(true); abugidaFontField.setEnabled(true); abugidaFontField.setEditable(true); abugidaChooseFontButton.setEnabled(true); tcr2.setFontName(writingSystem.get("Font").toString()); abugidaCharLabel.setFont(new Font(writingSystem.get("Font") + "", Font.PLAIN, 30)); } int pns = phonemes.size(); if (phonemes.containsKey("VowelCarrier")) { vowelCarrierCheck.setSelected(true); dtm2.setRowCount(dtm2.getRowCount() + 1); dtm2.setValueAt("VowelCarrier", dtm2.getRowCount() - 1, 0); String vc = (phonemes.get("VowelCarrier") + ""); dtm2.setValueAt(vc, dtm2.getRowCount() - 1, 1); pns--; } if (phonemes.containsKey("NoVowel")) { noVowelCheckbox.setSelected(true); dtm2.setRowCount(dtm2.getRowCount() + 1); dtm2.setValueAt("NoVowel", dtm2.getRowCount() - 1, 0); String vc = (phonemes.get("NoVowel") + ""); dtm2.setValueAt(vc, dtm2.getRowCount() - 1, 1); pns--; } for (int a = 0; a < pns; a++) { String p = (phonemes.get(ob[a])).toString(); dtm2.setValueAt(p, a, 1); } tcr2.setFontName(writingSystem.get("Font").toString()); } else if (writingSystemPane.getSelectedIndex() == 3) { // syllabary syllabaryCustomFontField.setText(fontname); if (writingSystem.get("FontType").equals("borrowed")) { syllabaryCustomFontCheck.setSelected(false); } else { syllabaryCustomFontCheck.setSelected(true); tcr2.setFontName(writingSystem.get("Font").toString()); visibleCharLabel.setFont(new Font(writingSystem.get("Font").toString(), Font.PLAIN, 30)); } vowls.add("NV"); consnts.add("NC"); HashMap syllables = (HashMap) writingSystem.get("Syllables"); Object[] keys = syllables.keySet().toArray(); Arrays.sort(keys); Object[] vwls = vowls.toArray(); Object[] cnsnts = consnts.toArray(); Arrays.sort(vwls, new LengthReverseComparator()); Arrays.sort(cnsnts, new LengthReverseComparator()); for (int s = 0; s < keys.length; s++) { String sylb = syllables.get(keys[s]).toString(); String key = keys[s].toString(); int vl = -1; int cn = -1; for (int c = 0; c < cnsnts.length; c++) { if (key.indexOf(cnsnts[c].toString()) >= 0) { cn = consnts.indexOf(cnsnts[c].toString()); break; } } for (int v = 0; v < vwls.length; v++) { if (key.indexOf(vwls[v].toString()) >= 0) { vl = vowls.indexOf(vwls[v].toString()); break; } } dtm4.setValueAt(sylb, cn, vl + 1); } } else if (writingSystemPane.getSelectedIndex() == 4) { // multigraphic multiCustomFontField.setText(fontname); if (writingSystem.get("FontType").equals("borrowed")) { multiBorrowedRadio.setSelected(true); } else { multiCustomRadio.setSelected(true); multiCustomFontField.setEnabled(true); multiCustomFontField.setEditable(true); multiChooseCustomFontButton.setEnabled(true); tcr2.setFontName(writingSystem.get("Font") + ""); multiCharacterLabel.setFont(new Font(writingSystem.get("Font") + "", Font.PLAIN, 30)); } int pns = phonemes.size(); if (phonemes.containsKey("Enders")) { multiUseEndersCheckbox.setSelected(true); dtm3.setRowCount(dtm3.getRowCount() + 1); pns--; } graphemesPerGlyphSpinner.setValue(Integer.parseInt(writingSystem.get("GraphemesPerGlyph") + "")); for (int a = 0; a < pns; a++) { String[] z = (phonemes.get(ob[a]) + "").split(" "); for (int b = 0; b < z.length; b++) { dtm3.setValueAt(z[b], a, b + 1); } } dtm3.setValueAt("Enders", dtm3.getRowCount() - 1, 0); String[] ends = (phonemes.get("Enders") + "").split(" "); for (int a = 0; a < ends.length; a++) { dtm3.setValueAt(ends[a], dtm3.getRowCount() - 1, a + 1); } } HashMap punct = (HashMap) writingSystem.get("Punctuation"); Object[] punctKeys = punct.keySet().toArray(); Arrays.sort(punctKeys); for (int p = 0; p < punctKeys.length; p++) { punctuationTable.setValueAt(punct.get(punctKeys[p] + ""), p, 1); } punctCharacterLabel.setFont(new Font(writingSystem.get("Font") + "", 1, 20)); presets = new Vector(); RwCellRenderer2 tcr3 = new RwCellRenderer2(); tcr3.setFontName("LCS-ConstructorII"); presetsTable.getColumnModel().getColumn(3).setCellRenderer(tcr3); try { BufferedReader in = new BufferedReader(new FileReader("./lcs-ws-presets.csv")); String s = in.readLine(); dtm6.setRowCount(0); String[] ss = new String[4]; int b = 0; while (!(s = in.readLine()).equals("End,,,,,,,,,,,,")) { String[] sar = s.split(","); presets.add(sar); b++; ss[0] = b + ""; ss[1] = sar[0]; ss[2] = sar[1]; int base = Integer.parseInt(sar[2], 16); char q; int cvalue = base; ss[3] = rwHexStringConverter.convertFrom(sar[11]); dtm6.addRow(ss); } in.close(); } catch (FileNotFoundException ex) { JOptionPane.showMessageDialog(this, ex.getMessage(), "Oops!", JOptionPane.ERROR_MESSAGE); } catch (IOException ex) { JOptionPane.showMessageDialog(this, ex.getMessage(), "Oops!", JOptionPane.ERROR_MESSAGE); } } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; mainButtonGroup = new javax.swing.ButtonGroup(); alphabetButtonGroup = new javax.swing.ButtonGroup(); writingSystemLayout = new java.awt.CardLayout(); abjadFontButtonGroup = new javax.swing.ButtonGroup(); diacriticsButtonGroup = new javax.swing.ButtonGroup(); tcr2 = new rw.RwCellRenderer2(); abugidaFontButtonGroup = new javax.swing.ButtonGroup(); abugidaDiacriticsButtonGroup = new javax.swing.ButtonGroup(); alphaGlyphUseMap = new java.util.HashMap(); abjadGlyphUseMap = new java.util.HashMap(); writingSystem = new java.util.HashMap(); multigraphicFontGroup = new javax.swing.ButtonGroup(); presets = new java.util.Vector(); okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); writingSystemPane = new javax.swing.JTabbedPane(); alphabetCard = new javax.swing.JPanel(); fontLabel = new javax.swing.JLabel(); borrowedCharsRadio = new javax.swing.JRadioButton(); customFontRadio = new javax.swing.JRadioButton(); fontField = new javax.swing.JTextField(); chooseAlphabetFontButton = new javax.swing.JButton(); alphaGlyphsPerLetterLabel = new javax.swing.JLabel(); alphaGlyphsPerLetterSpinner = new javax.swing.JSpinner(); alphaLetterGlyphNumberCombo = new javax.swing.JComboBox(); alphaLetterUsedInLabel = new javax.swing.JLabel(); alphaLetterUsedInCombo = new javax.swing.JComboBox(); capitalizationLabel = new javax.swing.JLabel(); capitalizationCombo = new javax.swing.JComboBox(); alphaScroller = new javax.swing.JScrollPane(); alphaTable = new javax.swing.JTable(); upCharButton = new javax.swing.JButton(); alphaLeftColumnButton = new javax.swing.JButton(); setAlphaCharButton = new javax.swing.JButton(); alphaRightColumnButton = new javax.swing.JButton(); downCharButton = new javax.swing.JButton(); characterLabelPanel = new javax.swing.JPanel(); characterLabel = new javax.swing.JLabel(); downPageButton = new javax.swing.JButton(); downButton = new javax.swing.JButton(); upButton = new javax.swing.JButton(); upPageButton = new javax.swing.JButton(); alphaJumpToLabel = new javax.swing.JLabel(); alphaJumpToField = new javax.swing.JTextField(); alphaCurrentVLabel = new javax.swing.JLabel(); autofillAlphabetButton = new javax.swing.JButton(); directionalityButton = new javax.swing.JToggleButton(); abjadCard = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); borrowedAbjadFontRadio = new javax.swing.JRadioButton(); customAbjadFontRadio = new javax.swing.JRadioButton(); abjadFontField = new javax.swing.JTextField(); chooseAbjadFontButton = new javax.swing.JButton(); abjadGlyphsPerConsonantLabel = new javax.swing.JLabel(); abjadGlyphsPerConsonantSpinner = new javax.swing.JSpinner(); abjadConsonantGlyphNumberCombo = new javax.swing.JComboBox(); abjadConsonantUsedInLabel = new javax.swing.JLabel(); abjadConsonantUsedInCombo = new javax.swing.JComboBox(); abjadScroller = new javax.swing.JScrollPane(); abjadTable = new javax.swing.JTable(); upCharAbjadButton = new javax.swing.JButton(); abjadLeftColumnButton = new javax.swing.JButton(); setAbjadCharButton = new javax.swing.JButton(); abjadRightColumnButton = new javax.swing.JButton(); downCharAbjadButton = new javax.swing.JButton(); downPageAbjadButton = new javax.swing.JButton(); downAbjadCharButton = new javax.swing.JButton(); upAbjadCharButton = new javax.swing.JButton(); upAbjadPageButton = new javax.swing.JButton(); abjadCharLabelPanel = new javax.swing.JPanel(); abjadCharLabel = new javax.swing.JLabel(); abjadJumpToLabel = new javax.swing.JLabel(); abjadJumpToField = new javax.swing.JTextField(); abjadCurrentVLabel = new javax.swing.JLabel(); autofillAbjadButton = new javax.swing.JButton(); abjadVowelCarrierCheck = new javax.swing.JCheckBox(); abjadDirectionalityButton = new javax.swing.JToggleButton(); abugidaCard = new javax.swing.JPanel(); abugidaFontLabel = new javax.swing.JLabel(); abugidaBorrowedFontRadio = new javax.swing.JRadioButton(); abugidaCustomFontRadio = new javax.swing.JRadioButton(); abugidaFontField = new javax.swing.JTextField(); abugidaChooseFontButton = new javax.swing.JButton(); abugidaScroller = new javax.swing.JScrollPane(); abugidaTable = new javax.swing.JTable(); abugidaUpCharButton = new javax.swing.JButton(); setAbugidaCharButton = new javax.swing.JButton(); abugidaDownCharButton = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); abugidaCharLabel = new javax.swing.JLabel(); downPageAbugidaButton = new javax.swing.JButton(); downCharAbugidaButton = new javax.swing.JButton(); upCharAbugidaButton = new javax.swing.JButton(); upPageAbugidaButton = new javax.swing.JButton(); abugidaJumpToLabel = new javax.swing.JLabel(); abugidaJumpToField = new javax.swing.JTextField(); abugidaCurrentVLabel = new javax.swing.JLabel(); abugidaAutoFillButton = new javax.swing.JButton(); vowelCarrierCheck = new javax.swing.JCheckBox(); noVowelCheckbox = new javax.swing.JCheckBox(); abugidaDirectionalityButton = new javax.swing.JToggleButton(); syllabaryCard = new javax.swing.JPanel(); syllabaryScroller = new javax.swing.JScrollPane(); syllabaryTable = new javax.swing.JTable(); setSyllableButton = new javax.swing.JButton(); syllabaryDownPageButton = new javax.swing.JButton(); syllabaryDownCharButton = new javax.swing.JButton(); syllabaryUpCharButton = new javax.swing.JButton(); syllabaryUpPageButton = new javax.swing.JButton(); consonantNumCombo = new javax.swing.JComboBox(); vowelNumCombo = new javax.swing.JComboBox(); consonantNumLabel = new javax.swing.JLabel(); vowelNumLabel = new javax.swing.JLabel(); syllabaryChooseCustomFontButton = new javax.swing.JButton(); syllabaryCustomFontCheck = new javax.swing.JCheckBox(); syllabaryCustomFontField = new javax.swing.JTextField(); jumpToField = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); syllabaryCharValueLabel = new javax.swing.JLabel(); jumpToLabel = new javax.swing.JLabel(); autoFillSyllabaryButton = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); visibleCharLabel = new javax.swing.JLabel(); syllabaryDirectionalityButton = new javax.swing.JToggleButton(); multigraphicCard = new javax.swing.JPanel(); multigraphicFontLabel = new javax.swing.JLabel(); multiBorrowedRadio = new javax.swing.JRadioButton(); multiCustomRadio = new javax.swing.JRadioButton(); multiCustomFontField = new javax.swing.JTextField(); multiChooseCustomFontButton = new javax.swing.JButton(); graphemesPerGlyphLabel = new javax.swing.JLabel(); graphemesPerGlyphSpinner = new javax.swing.JSpinner(); multiUseEndersCheckbox = new javax.swing.JCheckBox(); multigraphicScroller = new javax.swing.JScrollPane(); multigraphicTable = new javax.swing.JTable(); multiUpGlyphButton = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); multiCharacterLabel = new javax.swing.JLabel(); multiLeftGlyphButton = new javax.swing.JButton(); multiSetGlyphButton = new javax.swing.JButton(); multiRightGlyphButton = new javax.swing.JButton(); multiDownPageButton = new javax.swing.JButton(); multiDownCharButton = new javax.swing.JButton(); multiUpCharButton = new javax.swing.JButton(); multiUpPageButton = new javax.swing.JButton(); multiDownButton = new javax.swing.JButton(); multiJumpToLabel = new javax.swing.JLabel(); multiJumpToField = new javax.swing.JTextField(); currentHexValueLabel = new javax.swing.JLabel(); multiAutoFillButton = new javax.swing.JButton(); punctuationCard = new javax.swing.JPanel(); punctUpGlyphButton = new javax.swing.JButton(); punctCharPanel = new javax.swing.JPanel(); punctCharacterLabel = new javax.swing.JLabel(); multiDownButton1 = new javax.swing.JButton(); punctSetGlyphButton = new javax.swing.JButton(); punctiDownPageButton = new javax.swing.JButton(); punctDownCharButton = new javax.swing.JButton(); punctUpCharButton = new javax.swing.JButton(); punctUpPageButton = new javax.swing.JButton(); punctAutoFillButton = new javax.swing.JButton(); punctCurrentHexValueLabel = new javax.swing.JLabel(); punctJumpToField = new javax.swing.JTextField(); punctJumpToLabel = new javax.swing.JLabel(); punctuationScroller = new javax.swing.JScrollPane(); punctuationTable = new javax.swing.JTable(); punctSpacerPanel = new javax.swing.JPanel(); punctSpacerPanel1 = new javax.swing.JPanel(); Presets = new javax.swing.JPanel(); PresetsScroller = new javax.swing.JScrollPane(); presetsTable = new javax.swing.JTable(); useSystemButton = new javax.swing.JButton(); userDefdCard = new javax.swing.JPanel(); userDefdScroller = new javax.swing.JScrollPane(); userDefdTable = new javax.swing.JTable(); browse4WsButton = new javax.swing.JButton(); loadWsButton = new javax.swing.JButton(); saveWsButton = new javax.swing.JButton(); tcr2.setText("rwCellRenderer21"); // NOI18N alphaGlyphUseMap.put("Glyph_1","Lower"); abjadGlyphUseMap.put("Glyph_1","Initial"); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); okButton.setText("Ok"); // NOI18N okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); cancelButton.setText("Cancel"); // NOI18N cancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelButtonActionPerformed(evt); } }); writingSystemPane.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { writingSystemPaneStateChanged(evt); } }); alphabetCard.setMaximumSize(new java.awt.Dimension(5000, 5000)); alphabetCard.setMinimumSize(new java.awt.Dimension(610, 484)); alphabetCard.setName("alphabetCard"); // NOI18N alphabetCard.setPreferredSize(new java.awt.Dimension(610, 484)); alphabetCard.setLayout(new java.awt.GridBagLayout()); fontLabel.setText("Font"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(fontLabel, gridBagConstraints); alphabetButtonGroup.add(borrowedCharsRadio); borrowedCharsRadio.setSelected(true); borrowedCharsRadio.setText("Borrowed"); // NOI18N borrowedCharsRadio.setMaximumSize(new java.awt.Dimension(80, 23)); borrowedCharsRadio.setMinimumSize(new java.awt.Dimension(80, 23)); borrowedCharsRadio.setPreferredSize(new java.awt.Dimension(80, 23)); borrowedCharsRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { borrowedCharsRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(borrowedCharsRadio, gridBagConstraints); alphabetButtonGroup.add(customFontRadio); customFontRadio.setText("Custom"); // NOI18N customFontRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { customFontRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(customFontRadio, gridBagConstraints); fontField.setEditable(false); fontField.setText("LCS-ConstructorII"); // NOI18N fontField.setEnabled(false); fontField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fontFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 30; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 30; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.4; gridBagConstraints.weighty = 0.1; alphabetCard.add(fontField, gridBagConstraints); chooseAlphabetFontButton.setText("Choose"); // NOI18N chooseAlphabetFontButton.setEnabled(false); chooseAlphabetFontButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chooseAlphabetFontButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 60; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(chooseAlphabetFontButton, gridBagConstraints); alphaGlyphsPerLetterLabel.setText("Glyphs/Letter"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaGlyphsPerLetterLabel, gridBagConstraints); alphaGlyphsPerLetterSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 4, 1)); alphaGlyphsPerLetterSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { alphaGlyphsPerLetterSpinnerStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaGlyphsPerLetterSpinner, gridBagConstraints); alphaLetterGlyphNumberCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Glyph_1", "Glyph_2", "Glyph_3", "Glyph_4" })); alphaLetterGlyphNumberCombo.setEnabled(false); alphaLetterGlyphNumberCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { alphaLetterGlyphNumberComboActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaLetterGlyphNumberCombo, gridBagConstraints); alphaLetterUsedInLabel.setText("Used in"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 30; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaLetterUsedInLabel, gridBagConstraints); alphaLetterUsedInCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Initial", "Medial", "Final", "Isolated", "Upper", "Lower" })); alphaLetterUsedInCombo.setEnabled(false); alphaLetterUsedInCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { alphaLetterUsedInComboActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaLetterUsedInCombo, gridBagConstraints); capitalizationLabel.setText("Capitalization Rule"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(capitalizationLabel, gridBagConstraints); capitalizationCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Nouns", "Sentence", "Word" })); capitalizationCombo.setEnabled(false); capitalizationCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { capitalizationComboActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 60; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 10; gridBagConstraints.ipadx = 5; gridBagConstraints.ipady = 2; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(capitalizationCombo, gridBagConstraints); alphaTable.setAutoCreateRowSorter(true); alphaTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String [] { "Pronunciation", "Glyph 1" } )); alphaTable.setRowHeight(24); alphaScroller.setViewportView(alphaTable); alphaTable.getColumnModel().getColumn(0).setCellRenderer(tcr2); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 20; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 30; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.5; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); alphabetCard.add(alphaScroller, gridBagConstraints); upCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upCharButton.setText("⬆"); // NOI18N upCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 60; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(upCharButton, gridBagConstraints); alphaLeftColumnButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); alphaLeftColumnButton.setText("⬅"); // NOI18N alphaLeftColumnButton.setEnabled(false); alphaLeftColumnButton.setMargin(new java.awt.Insets(0, 4, 0, 4)); alphaLeftColumnButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { alphaLeftColumnButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaLeftColumnButton, gridBagConstraints); setAlphaCharButton.setText("Set"); // NOI18N setAlphaCharButton.setMargin(new java.awt.Insets(6, 4, 6, 4)); setAlphaCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { setAlphaCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(setAlphaCharButton, gridBagConstraints); alphaRightColumnButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); alphaRightColumnButton.setText("➡"); // NOI18N alphaRightColumnButton.setEnabled(false); alphaRightColumnButton.setMargin(new java.awt.Insets(0, 4, 0, 4)); alphaRightColumnButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { alphaRightColumnButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaRightColumnButton, gridBagConstraints); downCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downCharButton.setText("⬇"); // NOI18N downCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(downCharButton, gridBagConstraints); characterLabelPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); characterLabelPanel.setMaximumSize(new java.awt.Dimension(94, 30)); characterLabelPanel.setMinimumSize(new java.awt.Dimension(94, 30)); characterLabelPanel.setPreferredSize(new java.awt.Dimension(94, 30)); characterLabelPanel.setLayout(new java.awt.GridBagLayout()); characterLabel.setFont(new java.awt.Font("LCS-ConstructorII", 0, 30)); characterLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); characterLabel.setText("XXAXX"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(98, 2, 99, 0); characterLabelPanel.add(characterLabel, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 60; gridBagConstraints.gridwidth = 20; gridBagConstraints.gridheight = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 20, 0, 3); alphabetCard.add(characterLabelPanel, gridBagConstraints); downPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downPageButton.setText("⬅"); // NOI18N downPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(downPageButton, gridBagConstraints); downButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downButton.setText("⇐"); // NOI18N downButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 45; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(downButton, gridBagConstraints); upButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upButton.setText("⇒"); // NOI18N upButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; alphabetCard.add(upButton, gridBagConstraints); upPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upPageButton.setText("➡"); // NOI18N upPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 55; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; alphabetCard.add(upPageButton, gridBagConstraints); alphaJumpToLabel.setText("Jump to"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaJumpToLabel, gridBagConstraints); alphaJumpToField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { alphaJumpToFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 45; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaJumpToField, gridBagConstraints); alphaCurrentVLabel.setText("41"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; alphabetCard.add(alphaCurrentVLabel, gridBagConstraints); autofillAlphabetButton.setText("Auto Fill"); // NOI18N autofillAlphabetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { autofillAlphabetButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 55; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; alphabetCard.add(autofillAlphabetButton, gridBagConstraints); directionalityButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 12)); directionalityButton.setText("L ➡ R"); directionalityButton.setMargin(new java.awt.Insets(0, 2, 0, 2)); directionalityButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { directionalityButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 60; gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0); alphabetCard.add(directionalityButton, gridBagConstraints); writingSystemPane.addTab("Alphabet", alphabetCard); abjadCard.setMinimumSize(new java.awt.Dimension(610, 484)); abjadCard.setName("abjadCard"); // NOI18N abjadCard.setPreferredSize(new java.awt.Dimension(610, 484)); abjadCard.setLayout(new java.awt.GridBagLayout()); jLabel2.setText("Font"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(jLabel2, gridBagConstraints); abjadFontButtonGroup.add(borrowedAbjadFontRadio); borrowedAbjadFontRadio.setSelected(true); borrowedAbjadFontRadio.setText("Borrowed"); // NOI18N borrowedAbjadFontRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { borrowedAbjadFontRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(borrowedAbjadFontRadio, gridBagConstraints); abjadFontButtonGroup.add(customAbjadFontRadio); customAbjadFontRadio.setText("Custom"); // NOI18N customAbjadFontRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { customAbjadFontRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(customAbjadFontRadio, gridBagConstraints); abjadFontField.setText("LCS-ConstructorII"); // NOI18N abjadFontField.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 30; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 30; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.4; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadFontField, gridBagConstraints); chooseAbjadFontButton.setText("Choose"); // NOI18N chooseAbjadFontButton.setEnabled(false); chooseAbjadFontButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { chooseAbjadFontButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 60; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 10; abjadCard.add(chooseAbjadFontButton, gridBagConstraints); abjadGlyphsPerConsonantLabel.setText("Glyphs/Letter"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadGlyphsPerConsonantLabel, gridBagConstraints); abjadGlyphsPerConsonantSpinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 4, 1)); abjadGlyphsPerConsonantSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { abjadGlyphsPerConsonantSpinnerStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadGlyphsPerConsonantSpinner, gridBagConstraints); abjadConsonantGlyphNumberCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Glyph_1", "Glyph_2", "Glyph_3", "Glyph_4" })); abjadConsonantGlyphNumberCombo.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; abjadCard.add(abjadConsonantGlyphNumberCombo, gridBagConstraints); abjadConsonantUsedInLabel.setText("Used in"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 30; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadConsonantUsedInLabel, gridBagConstraints); abjadConsonantUsedInCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Initial", "Ini/Med", "Medial", "Med/Fin", "Final", "Isolated", "Upper", "Lower" })); abjadConsonantUsedInCombo.setEnabled(false); abjadConsonantUsedInCombo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abjadConsonantUsedInComboActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; abjadCard.add(abjadConsonantUsedInCombo, gridBagConstraints); abjadTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String [] { "Pronunciation", "Glyph 1" } )); abjadTable.setRowHeight(24); abjadScroller.setViewportView(abjadTable); abjadTable.getColumnModel().getColumn(0).setCellRenderer(tcr2); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 20; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 40; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.4; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); abjadCard.add(abjadScroller, gridBagConstraints); upCharAbjadButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upCharAbjadButton.setText("⬆"); // NOI18N upCharAbjadButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upCharAbjadButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upCharAbjadButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 60; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(upCharAbjadButton, gridBagConstraints); abjadLeftColumnButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); abjadLeftColumnButton.setText("⬅"); // NOI18N abjadLeftColumnButton.setEnabled(false); abjadLeftColumnButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); abjadLeftColumnButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abjadLeftColumnButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; abjadCard.add(abjadLeftColumnButton, gridBagConstraints); setAbjadCharButton.setText("Set"); // NOI18N setAbjadCharButton.setMargin(new java.awt.Insets(6, 4, 6, 4)); setAbjadCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { setAbjadCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.05; abjadCard.add(setAbjadCharButton, gridBagConstraints); abjadRightColumnButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); abjadRightColumnButton.setText("➡"); // NOI18N abjadRightColumnButton.setEnabled(false); abjadRightColumnButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); abjadRightColumnButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abjadRightColumnButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.05; abjadCard.add(abjadRightColumnButton, gridBagConstraints); downCharAbjadButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downCharAbjadButton.setText("⬇"); // NOI18N downCharAbjadButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downCharAbjadButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downCharAbjadButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(downCharAbjadButton, gridBagConstraints); downPageAbjadButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downPageAbjadButton.setText("⬅"); // NOI18N downPageAbjadButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downPageAbjadButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downPageAbjadButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(downPageAbjadButton, gridBagConstraints); downAbjadCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downAbjadCharButton.setText("⇐"); // NOI18N downAbjadCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downAbjadCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downAbjadCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 45; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(downAbjadCharButton, gridBagConstraints); upAbjadCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upAbjadCharButton.setText("⇒"); // NOI18N upAbjadCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upAbjadCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upAbjadCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.01; abjadCard.add(upAbjadCharButton, gridBagConstraints); upAbjadPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upAbjadPageButton.setText("➡"); // NOI18N upAbjadPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upAbjadPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upAbjadPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 55; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; abjadCard.add(upAbjadPageButton, gridBagConstraints); abjadCharLabelPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); abjadCharLabelPanel.setMinimumSize(new java.awt.Dimension(94, 30)); abjadCharLabelPanel.setPreferredSize(new java.awt.Dimension(94, 30)); abjadCharLabel.setFont(new java.awt.Font("LCS-ConstructorII", 0, 30)); abjadCharLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); abjadCharLabel.setText("XXAXX"); // NOI18N javax.swing.GroupLayout abjadCharLabelPanelLayout = new javax.swing.GroupLayout(abjadCharLabelPanel); abjadCharLabelPanel.setLayout(abjadCharLabelPanelLayout); abjadCharLabelPanelLayout.setHorizontalGroup( abjadCharLabelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(abjadCharLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE) ); abjadCharLabelPanelLayout.setVerticalGroup( abjadCharLabelPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(abjadCharLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 60; gridBagConstraints.gridwidth = 20; gridBagConstraints.gridheight = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 20, 0, 3); abjadCard.add(abjadCharLabelPanel, gridBagConstraints); abjadJumpToLabel.setText("Jump to"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadJumpToLabel, gridBagConstraints); abjadJumpToField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abjadJumpToFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 45; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadJumpToField, gridBagConstraints); abjadCurrentVLabel.setText("41"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; abjadCard.add(abjadCurrentVLabel, gridBagConstraints); autofillAbjadButton.setText("Auto Fill"); // NOI18N autofillAbjadButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { autofillAbjadButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 55; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abjadCard.add(autofillAbjadButton, gridBagConstraints); abjadVowelCarrierCheck.setText("Vowel Carrier"); // NOI18N abjadVowelCarrierCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abjadVowelCarrierCheckActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; abjadCard.add(abjadVowelCarrierCheck, gridBagConstraints); abjadDirectionalityButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 14)); abjadDirectionalityButton.setText("L ➡ R"); abjadDirectionalityButton.setMargin(new java.awt.Insets(0, 2, 0, 2)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 60; gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0); abjadCard.add(abjadDirectionalityButton, gridBagConstraints); writingSystemPane.addTab("Abjad", abjadCard); abugidaCard.setMaximumSize(new java.awt.Dimension(610, 484)); abugidaCard.setMinimumSize(new java.awt.Dimension(610, 484)); abugidaCard.setName("abugidaCard"); // NOI18N abugidaCard.setPreferredSize(new java.awt.Dimension(610, 484)); abugidaCard.setLayout(new java.awt.GridBagLayout()); abugidaFontLabel.setText("Font"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaFontLabel, gridBagConstraints); abugidaFontButtonGroup.add(abugidaBorrowedFontRadio); abugidaBorrowedFontRadio.setSelected(true); abugidaBorrowedFontRadio.setText("Borrowed"); // NOI18N abugidaBorrowedFontRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaBorrowedFontRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaBorrowedFontRadio, gridBagConstraints); abugidaFontButtonGroup.add(abugidaCustomFontRadio); abugidaCustomFontRadio.setText("Custom"); // NOI18N abugidaCustomFontRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaCustomFontRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 20; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaCustomFontRadio, gridBagConstraints); abugidaFontField.setText("LCS-ConstructorII"); // NOI18N abugidaFontField.setEnabled(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 30; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 30; gridBagConstraints.gridheight = 10; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.4; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaFontField, gridBagConstraints); abugidaChooseFontButton.setText("Choose"); // NOI18N abugidaChooseFontButton.setEnabled(false); abugidaChooseFontButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaChooseFontButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 60; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 10; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaChooseFontButton, gridBagConstraints); abugidaTable.setAutoCreateRowSorter(true); abugidaTable.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); abugidaTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String [] { "Pronunciation", "Written" } ) { boolean[] canEdit = new boolean [] { false, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); abugidaTable.setRowHeight(24); abugidaScroller.setViewportView(abugidaTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 20; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 40; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.35; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); abugidaCard.add(abugidaScroller, gridBagConstraints); abugidaUpCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); abugidaUpCharButton.setText("⬆"); // NOI18N abugidaUpCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); abugidaUpCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaUpCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 60; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaUpCharButton, gridBagConstraints); setAbugidaCharButton.setText("Set"); // NOI18N setAbugidaCharButton.setMargin(new java.awt.Insets(6, 4, 6, 4)); setAbugidaCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { setAbugidaCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(setAbugidaCharButton, gridBagConstraints); abugidaDownCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); abugidaDownCharButton.setText("⬇"); // NOI18N abugidaDownCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); abugidaDownCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaDownCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; abugidaCard.add(abugidaDownCharButton, gridBagConstraints); jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); jPanel1.setMaximumSize(new java.awt.Dimension(94, 30)); jPanel1.setMinimumSize(new java.awt.Dimension(94, 30)); jPanel1.setPreferredSize(new java.awt.Dimension(94, 30)); abugidaCharLabel.setFont(new java.awt.Font("LCS-ConstructorII", 0, 30)); abugidaCharLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); abugidaCharLabel.setText("XXAXX"); // NOI18N javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(abugidaCharLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(abugidaCharLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 51, Short.MAX_VALUE) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 60; gridBagConstraints.gridwidth = 20; gridBagConstraints.gridheight = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 20, 0, 3); abugidaCard.add(jPanel1, gridBagConstraints); downPageAbugidaButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downPageAbugidaButton.setText("⬅"); // NOI18N downPageAbugidaButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downPageAbugidaButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downPageAbugidaButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(downPageAbugidaButton, gridBagConstraints); downCharAbugidaButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); downCharAbugidaButton.setText("⇐"); // NOI18N downCharAbugidaButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); downCharAbugidaButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { downCharAbugidaButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 45; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(downCharAbugidaButton, gridBagConstraints); upCharAbugidaButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upCharAbugidaButton.setText("⇒"); // NOI18N upCharAbugidaButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upCharAbugidaButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upCharAbugidaButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(upCharAbugidaButton, gridBagConstraints); upPageAbugidaButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); upPageAbugidaButton.setText("➡"); // NOI18N upPageAbugidaButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); upPageAbugidaButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { upPageAbugidaButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 55; gridBagConstraints.gridy = 70; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(upPageAbugidaButton, gridBagConstraints); abugidaJumpToLabel.setText("Jump to"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 40; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaJumpToLabel, gridBagConstraints); abugidaJumpToField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaJumpToFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 45; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaJumpToField, gridBagConstraints); abugidaCurrentVLabel.setText("41"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 50; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 5; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; abugidaCard.add(abugidaCurrentVLabel, gridBagConstraints); abugidaAutoFillButton.setText("Auto Fill"); // NOI18N abugidaAutoFillButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { abugidaAutoFillButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 55; gridBagConstraints.gridy = 80; gridBagConstraints.gridwidth = 10; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; abugidaCard.add(abugidaAutoFillButton, gridBagConstraints); vowelCarrierCheck.setText("Vowel Carrier"); // NOI18N vowelCarrierCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { vowelCarrierCheckActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 20; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.05; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); abugidaCard.add(vowelCarrierCheck, gridBagConstraints); noVowelCheckbox.setText("No Vowel"); // NOI18N noVowelCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { noVowelCheckboxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 10; gridBagConstraints.gridy = 10; gridBagConstraints.gridwidth = 20; gridBagConstraints.gridheight = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.05; abugidaCard.add(noVowelCheckbox, gridBagConstraints); abugidaDirectionalityButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 14)); abugidaDirectionalityButton.setText("L ➡ R"); abugidaDirectionalityButton.setMargin(new java.awt.Insets(0, 2, 0, 2)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 60; gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0); abugidaCard.add(abugidaDirectionalityButton, gridBagConstraints); writingSystemPane.addTab("Abugida", abugidaCard); syllabaryCard.setName("syllabaryCard"); // NOI18N syllabaryTable.setAutoCreateRowSorter(true); syllabaryTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null}, {null, null}, {null, null}, {null, null} }, new String [] { "Pronunciation", "Written" } )); syllabaryTable.setRowHeight(25); syllabaryScroller.setViewportView(syllabaryTable); syllabaryTable.getColumnModel().getColumn(0).setCellRenderer(tcr2); syllabaryTable.getColumnModel().getColumn(1).setCellRenderer(tcr2); setSyllableButton.setText("Set @"); // NOI18N setSyllableButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { setSyllableButtonActionPerformed(evt); } }); syllabaryDownPageButton.setText("<<"); // NOI18N syllabaryDownPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryDownPageButtonActionPerformed(evt); } }); syllabaryDownCharButton.setText("<"); // NOI18N syllabaryDownCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryDownCharButtonActionPerformed(evt); } }); syllabaryUpCharButton.setText(">"); // NOI18N syllabaryUpCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryUpCharButtonActionPerformed(evt); } }); syllabaryUpPageButton.setText(">>"); // NOI18N syllabaryUpPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryUpPageButtonActionPerformed(evt); } }); consonantNumCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", " " })); vowelNumCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" })); consonantNumLabel.setText("Consonant"); // NOI18N vowelNumLabel.setText("Vowel"); // NOI18N syllabaryChooseCustomFontButton.setText("Choose"); // NOI18N syllabaryChooseCustomFontButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryChooseCustomFontButtonActionPerformed(evt); } }); syllabaryCustomFontCheck.setText("Custom Font"); // NOI18N syllabaryCustomFontCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryCustomFontCheckActionPerformed(evt); } }); syllabaryCustomFontField.setText("LCS-ConstructorII"); // NOI18N syllabaryCustomFontField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { syllabaryCustomFontFieldActionPerformed(evt); } }); jumpToField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jumpToFieldActionPerformed(evt); } }); jLabel1.setText("Syllable Parts "); // NOI18N syllabaryCharValueLabel.setText("41"); // NOI18N jumpToLabel.setText("Jump To"); // NOI18N autoFillSyllabaryButton.setText("Auto Fill"); // NOI18N autoFillSyllabaryButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { autoFillSyllabaryButtonActionPerformed(evt); } }); jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); visibleCharLabel.setFont(new java.awt.Font("LCS-ConstructorII", 0, 30)); visibleCharLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); visibleCharLabel.setText("XXAXX"); // NOI18N javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(visibleCharLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(visibleCharLabel) ); syllabaryDirectionalityButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 14)); syllabaryDirectionalityButton.setText("L ➡ R"); syllabaryDirectionalityButton.setMargin(new java.awt.Insets(0, 2, 0, 2)); javax.swing.GroupLayout syllabaryCardLayout = new javax.swing.GroupLayout(syllabaryCard); syllabaryCard.setLayout(syllabaryCardLayout); syllabaryCardLayout.setHorizontalGroup( syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addContainerGap() .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(syllabaryScroller, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE) .addGroup(syllabaryCardLayout.createSequentialGroup() .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, syllabaryCardLayout.createSequentialGroup() .addGap(8, 8, 8) .addComponent(setSyllableButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(consonantNumLabel) .addComponent(consonantNumCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(vowelNumCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(vowelNumLabel)) .addGap(36, 36, 36)) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(syllabaryDirectionalityButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(18, 18, 18))) .addComponent(syllabaryCustomFontCheck)) .addComponent(autoFillSyllabaryButton, javax.swing.GroupLayout.Alignment.LEADING)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(syllabaryCustomFontField, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(syllabaryChooseCustomFontButton)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, syllabaryCardLayout.createSequentialGroup() .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(syllabaryDownPageButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(jumpToLabel) .addGap(18, 18, 18))) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(syllabaryDownCharButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(syllabaryUpCharButton)) .addComponent(jumpToField, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(syllabaryCharValueLabel) .addGap(27, 27, 27)) .addComponent(syllabaryUpPageButton)))))) .addContainerGap()) ); syllabaryCardLayout.setVerticalGroup( syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addContainerGap() .addComponent(syllabaryScroller, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(syllabaryCustomFontCheck) .addComponent(syllabaryCustomFontField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(syllabaryChooseCustomFontButton) .addComponent(syllabaryDirectionalityButton) .addComponent(jLabel1)) .addGap(6, 6, 6) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(syllabaryCardLayout.createSequentialGroup() .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(consonantNumLabel) .addComponent(vowelNumLabel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(consonantNumCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(setSyllableButton) .addComponent(vowelNumCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(autoFillSyllabaryButton)) .addGroup(syllabaryCardLayout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(17, 17, 17) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(syllabaryDownCharButton) .addComponent(syllabaryUpCharButton) .addComponent(syllabaryUpPageButton) .addComponent(syllabaryDownPageButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(syllabaryCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jumpToField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(syllabaryCharValueLabel) .addComponent(jumpToLabel)))) .addGap(139, 139, 139)) ); writingSystemPane.addTab("Syllabary", syllabaryCard); multigraphicCard.setLayout(new java.awt.GridBagLayout()); multigraphicFontLabel.setText("Font"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multigraphicFontLabel, gridBagConstraints); multigraphicFontGroup.add(multiBorrowedRadio); multiBorrowedRadio.setSelected(true); multiBorrowedRadio.setText("Borrowed"); // NOI18N multiBorrowedRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiBorrowedRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiBorrowedRadio, gridBagConstraints); multigraphicFontGroup.add(multiCustomRadio); multiCustomRadio.setText("Custom"); // NOI18N multiCustomRadio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiCustomRadioActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiCustomRadio, gridBagConstraints); multiCustomFontField.setText("LCS-ConstructorII"); // NOI18N multiCustomFontField.setEnabled(false); multiCustomFontField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiCustomFontFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 6; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.6; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiCustomFontField, gridBagConstraints); multiChooseCustomFontButton.setText("Choose ..."); // NOI18N multiChooseCustomFontButton.setEnabled(false); multiChooseCustomFontButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiChooseCustomFontButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiChooseCustomFontButton, gridBagConstraints); graphemesPerGlyphLabel.setText("Graphemes / Glyph"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(graphemesPerGlyphLabel, gridBagConstraints); graphemesPerGlyphSpinner.setModel(new javax.swing.SpinnerNumberModel(2, 2, 4, 1)); graphemesPerGlyphSpinner.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { graphemesPerGlyphSpinnerStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.8; gridBagConstraints.weighty = 0.1; multigraphicCard.add(graphemesPerGlyphSpinner, gridBagConstraints); multiUseEndersCheckbox.setText("Use Enders"); // NOI18N multiUseEndersCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiUseEndersCheckboxActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiUseEndersCheckbox, gridBagConstraints); multigraphicTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Sound", "Grapheme 1", "Grapheme 2" } )); multigraphicTable.setRowHeight(24); multigraphicScroller.setViewportView(multigraphicTable); multigraphicTable.getColumnModel().getColumn(2).setHeaderValue("Grapheme 2"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.4; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); multigraphicCard.add(multigraphicScroller, gridBagConstraints); multiUpGlyphButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiUpGlyphButton.setText("⬆"); // NOI18N multiUpGlyphButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiUpGlyphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiUpGlyphButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiUpGlyphButton, gridBagConstraints); jPanel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); jPanel3.setLayout(new java.awt.BorderLayout()); multiCharacterLabel.setFont(new java.awt.Font("LCS-ConstructorII", 0, 36)); multiCharacterLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); multiCharacterLabel.setText("XXAXX"); // NOI18N jPanel3.add(multiCharacterLabel, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.05; gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0); multigraphicCard.add(jPanel3, gridBagConstraints); multiLeftGlyphButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiLeftGlyphButton.setText("⬅"); // NOI18N multiLeftGlyphButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiLeftGlyphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiLeftGlyphButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiLeftGlyphButton, gridBagConstraints); multiSetGlyphButton.setText("Set"); // NOI18N multiSetGlyphButton.setMargin(new java.awt.Insets(2, 5, 2, 5)); multiSetGlyphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiSetGlyphButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiSetGlyphButton, gridBagConstraints); multiRightGlyphButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiRightGlyphButton.setText("➡"); // NOI18N multiRightGlyphButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiRightGlyphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiRightGlyphButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiRightGlyphButton, gridBagConstraints); multiDownPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiDownPageButton.setText("⬅"); // NOI18N multiDownPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiDownPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiDownPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiDownPageButton, gridBagConstraints); multiDownCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiDownCharButton.setText("⇐"); // NOI18N multiDownCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiDownCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiDownCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiDownCharButton, gridBagConstraints); multiUpCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiUpCharButton.setText("⇒"); // NOI18N multiUpCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiUpCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiUpCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiUpCharButton, gridBagConstraints); multiUpPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiUpPageButton.setText("➡"); // NOI18N multiUpPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiUpPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiUpPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiUpPageButton, gridBagConstraints); multiDownButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiDownButton.setText("⬇"); // NOI18N multiDownButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiDownButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiDownButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiDownButton, gridBagConstraints); multiJumpToLabel.setText("Jump To"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiJumpToLabel, gridBagConstraints); multiJumpToField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiJumpToFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 8; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiJumpToField, gridBagConstraints); currentHexValueLabel.setText("41"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 8; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(currentHexValueLabel, gridBagConstraints); multiAutoFillButton.setText("Auto Fill"); // NOI18N multiAutoFillButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiAutoFillButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiAutoFillButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; multigraphicCard.add(multiAutoFillButton, gridBagConstraints); writingSystemPane.addTab("Multigraphic", multigraphicCard); punctuationCard.setLayout(new java.awt.GridBagLayout()); punctUpGlyphButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); punctUpGlyphButton.setText("⬆"); // NOI18N punctUpGlyphButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); punctUpGlyphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctUpGlyphButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 6; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctUpGlyphButton, gridBagConstraints); punctCharPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); punctCharPanel.setLayout(new java.awt.BorderLayout()); punctCharacterLabel.setFont(new java.awt.Font("LCS-ConstructorII", 0, 36)); punctCharacterLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); punctCharacterLabel.setText("XXAXX"); // NOI18N punctCharPanel.add(punctCharacterLabel, java.awt.BorderLayout.CENTER); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 6; gridBagConstraints.gridwidth = 5; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.05; gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0); punctuationCard.add(punctCharPanel, gridBagConstraints); multiDownButton1.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); multiDownButton1.setText("⬇"); // NOI18N multiDownButton1.setMargin(new java.awt.Insets(0, 0, 0, 0)); multiDownButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiDownButton1ActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; punctuationCard.add(multiDownButton1, gridBagConstraints); punctSetGlyphButton.setText("Set"); // NOI18N punctSetGlyphButton.setMargin(new java.awt.Insets(2, 5, 2, 5)); punctSetGlyphButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctSetGlyphButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 7; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctSetGlyphButton, gridBagConstraints); punctiDownPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); punctiDownPageButton.setText("⬅"); // NOI18N punctiDownPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); punctiDownPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctiDownPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctiDownPageButton, gridBagConstraints); punctDownCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); punctDownCharButton.setText("⇐"); // NOI18N punctDownCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); punctDownCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctDownCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctDownCharButton, gridBagConstraints); punctUpCharButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); punctUpCharButton.setText("⇒"); // NOI18N punctUpCharButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); punctUpCharButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctUpCharButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctUpCharButton, gridBagConstraints); punctUpPageButton.setFont(new java.awt.Font("LCS-ConstructorII", 0, 18)); punctUpPageButton.setText("➡"); // NOI18N punctUpPageButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); punctUpPageButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctUpPageButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctUpPageButton, gridBagConstraints); punctAutoFillButton.setText("Auto Fill"); // NOI18N punctAutoFillButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); punctAutoFillButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctAutoFillButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctAutoFillButton, gridBagConstraints); punctCurrentHexValueLabel.setText("41"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 8; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctCurrentHexValueLabel, gridBagConstraints); punctJumpToField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { punctJumpToFieldActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 8; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctJumpToField, gridBagConstraints); punctJumpToLabel.setText("Jump To"); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 8; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weightx = 0.05; gridBagConstraints.weighty = 0.1; punctuationCard.add(punctJumpToLabel, gridBagConstraints); punctuationTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {" ", null}, {"!", null}, {"\"", null}, {"#", null}, {"$", null}, {"%", null}, {"&", null}, {"'", null}, {"(", null}, {")", null}, {"*", null}, {"+", null}, {",", null}, {"-", null}, {".", null}, {"/", null}, {"0", null}, {"1", null}, {"2", null}, {"3", null}, {"4", null}, {"5", null}, {"6", null}, {"7", null}, {"8", null}, {"9", null}, {":", null}, {";", null}, {"<", null}, {"=", null}, {">", null}, {"?", null}, {"@", null}, {"[", null}, {"\\", null}, {"]", null}, {"^", null}, {"_", null}, {"`", null}, {"{", null}, {"|", null}, {"}", null}, {"~", null} }, new String [] { "Latin8", "Glyph" } ) { boolean[] canEdit = new boolean [] { false, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); punctuationTable.setRowHeight(24); punctuationScroller.setViewportView(punctuationTable); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.gridheight = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.4; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 10); punctuationCard.add(punctuationScroller, gridBagConstraints); javax.swing.GroupLayout punctSpacerPanelLayout = new javax.swing.GroupLayout(punctSpacerPanel); punctSpacerPanel.setLayout(punctSpacerPanelLayout); punctSpacerPanelLayout.setHorizontalGroup( punctSpacerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); punctSpacerPanelLayout.setVerticalGroup( punctSpacerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.2; gridBagConstraints.weighty = 0.0010; punctuationCard.add(punctSpacerPanel, gridBagConstraints); javax.swing.GroupLayout punctSpacerPanel1Layout = new javax.swing.GroupLayout(punctSpacerPanel1); punctSpacerPanel1.setLayout(punctSpacerPanel1Layout); punctSpacerPanel1Layout.setHorizontalGroup( punctSpacerPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); punctSpacerPanel1Layout.setVerticalGroup( punctSpacerPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 4; gridBagConstraints.weightx = 0.4; gridBagConstraints.weighty = 0.0010; punctuationCard.add(punctSpacerPanel1, gridBagConstraints); writingSystemPane.addTab("Punctuation & Numerals", punctuationCard); Presets.setLayout(new java.awt.GridBagLayout()); presetsTable.setAutoCreateRowSorter(true); presetsTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "#", "Name", "Writing System Type", "Sample Text" } ) { Class[] types = new Class [] { java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { true, false, false, true }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); presetsTable.setRowHeight(30); presetsTable.getTableHeader().setReorderingAllowed(false); PresetsScroller.setViewportView(presetsTable); presetsTable.getColumnModel().getColumn(0).setMinWidth(30); presetsTable.getColumnModel().getColumn(0).setPreferredWidth(30); presetsTable.getColumnModel().getColumn(0).setMaxWidth(30); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.9; gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 10); Presets.add(PresetsScroller, gridBagConstraints); useSystemButton.setText("Use"); // NOI18N useSystemButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { useSystemButtonActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0); Presets.add(useSystemButton, gridBagConstraints); writingSystemPane.addTab("Presets", Presets); userDefdTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Name", "Type", "Sample Text" } )); userDefdTable.setRowHeight(30); userDefdScroller.setViewportView(userDefdTable); browse4WsButton.setText("Browse ..."); browse4WsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { browse4WsButtonActionPerformed(evt); } }); javax.swing.GroupLayout userDefdCardLayout = new javax.swing.GroupLayout(userDefdCard); userDefdCard.setLayout(userDefdCardLayout); userDefdCardLayout.setHorizontalGroup( userDefdCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(userDefdCardLayout.createSequentialGroup() .addGroup(userDefdCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(userDefdCardLayout.createSequentialGroup() .addContainerGap() .addComponent(userDefdScroller, javax.swing.GroupLayout.DEFAULT_SIZE, 578, Short.MAX_VALUE)) .addGroup(userDefdCardLayout.createSequentialGroup() .addGap(249, 249, 249) .addComponent(browse4WsButton))) .addContainerGap()) ); userDefdCardLayout.setVerticalGroup( userDefdCardLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(userDefdCardLayout.createSequentialGroup() .addContainerGap() .addComponent(userDefdScroller, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(browse4WsButton) .addContainerGap(42, Short.MAX_VALUE)) ); writingSystemPane.addTab("User Defined", userDefdCard); loadWsButton.setText("Load ..."); loadWsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadWsButtonActionPerformed(evt); } }); saveWsButton.setText("Save As ..."); saveWsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveWsButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(writingSystemPane, javax.swing.GroupLayout.PREFERRED_SIZE, 603, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addComponent(okButton) .addGap(67, 67, 67) .addComponent(loadWsButton) .addGap(34, 34, 34) .addComponent(saveWsButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cancelButton))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(writingSystemPane, javax.swing.GroupLayout.PREFERRED_SIZE, 409, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(okButton) .addComponent(cancelButton) .addComponent(loadWsButton) .addComponent(saveWsButton)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void borrowedCharsRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borrowedCharsRadioActionPerformed chooseAlphabetFontButton.setEnabled(false); fontField.setEnabled(false); }//GEN-LAST:event_borrowedCharsRadioActionPerformed private void syllabaryDownCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryDownCharButtonActionPerformed int c = visibleCharLabel.getText().codePointAt(2); --c; if (c < 32) { c = 32; } updateSyllabaryChar(c); }//GEN-LAST:event_syllabaryDownCharButtonActionPerformed private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed setVisible(false); chosenOption = CANCEL_OPTION; }//GEN-LAST:event_cancelButtonActionPerformed private void syllabaryCustomFontCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryCustomFontCheckActionPerformed // TODO add your handling code here: }//GEN-LAST:event_syllabaryCustomFontCheckActionPerformed private void customFontRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customFontRadioActionPerformed chooseAlphabetFontButton.setEnabled(true); fontField.setEnabled(true); }//GEN-LAST:event_customFontRadioActionPerformed private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed int cs = 0; boolean punctSet = true; if (punctuationTable.getValueAt(0, 1) == null) { JOptionPane jop = new JOptionPane(); cs = jop.showConfirmDialog(this, "Punctuation is not set.\nDo you wish to set it?", "Oops!", JOptionPane.INFORMATION_MESSAGE); punctSet = false; } if (punctSet == true) { this.setVisible(false); System.out.println(writingSystem); chosenOption = OK_OPTION; punctuationSet = true; } if (cs == JOptionPane.NO_OPTION && punctSet == false) { this.setVisible(false); chosenOption = OK_OPTION; } }//GEN-LAST:event_okButtonActionPerformed private void chooseAlphabetFontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseAlphabetFontButtonActionPerformed RwJFontChooser rwf = new RwJFontChooser(new JFrame()); rwf.setVisible(true); Font daFont = rwf.getSelectedFont(); if (daFont != null) { fontField.setText(daFont.getFontName()); tcr2.setFontName(daFont.getFontName()); for (int a = 0; a < alphaTable.getRowCount(); a++) { alphaTable.setValueAt(alphaTable.getValueAt(a, 0), a, 1); } characterLabel.setFont(daFont); punctCharacterLabel.setFont(daFont); } }//GEN-LAST:event_chooseAlphabetFontButtonActionPerformed private void syllabaryChooseCustomFontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryChooseCustomFontButtonActionPerformed RwJFontChooser rwf = new RwJFontChooser(new JFrame()); rwf.setVisible(true); Font daFont = rwf.getSelectedFont(); if (daFont != null) { syllabaryCustomFontField.setText(daFont.getFontName()); visibleCharLabel.setFont(daFont); punctCharacterLabel.setFont(daFont); RwCellRenderer2 rcr = new RwCellRenderer2(daFont); for (int a = 0; a < syllabaryTable.getColumnCount(); a++) { syllabaryTable.getColumnModel().getColumn(a).setCellRenderer(rcr); } } }//GEN-LAST:event_syllabaryChooseCustomFontButtonActionPerformed private void setSyllableButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setSyllableButtonActionPerformed int row = consonantNumCombo.getSelectedIndex(); int col = vowelNumCombo.getSelectedIndex(); syllabaryTable.setValueAt(new String(Character.toChars(visibleCharLabel.getText().codePointAt(2))), row, col + 1); }//GEN-LAST:event_setSyllableButtonActionPerformed private void syllabaryUpCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryUpCharButtonActionPerformed int c = visibleCharLabel.getText().codePointAt(2); ++c; updateSyllabaryChar(c); }//GEN-LAST:event_syllabaryUpCharButtonActionPerformed private void syllabaryDownPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryDownPageButtonActionPerformed int c = visibleCharLabel.getText().codePointAt(2); c = c - 256; if (c < 32) { c = 32; } updateSyllabaryChar(c); }//GEN-LAST:event_syllabaryDownPageButtonActionPerformed private void syllabaryUpPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryUpPageButtonActionPerformed int c = visibleCharLabel.getText().codePointAt(2); c = c + 256; updateSyllabaryChar(c); }//GEN-LAST:event_syllabaryUpPageButtonActionPerformed private void jumpToFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jumpToFieldActionPerformed String jumpTo = jumpToField.getText(); int loc = Integer.parseInt(jumpTo, 16); updateSyllabaryChar(loc); }//GEN-LAST:event_jumpToFieldActionPerformed private void autoFillSyllabaryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoFillSyllabaryButtonActionPerformed Object o = syllabaryTable.getValueAt(0, 1); if (o == null) { JOptionPane.showMessageDialog(this, "Cannot start with null!", "Oops!", JOptionPane.ERROR_MESSAGE); } else { String s = o + ""; int c = s.codePointAt(0); for (int row = 0; row < syllabaryTable.getRowCount(); row++) { for (int col = 1; col < syllabaryTable.getColumnCount(); col++) { syllabaryTable.setValueAt(new String(Character.toChars(c)), row, col); c++; } } } }//GEN-LAST:event_autoFillSyllabaryButtonActionPerformed private void upCharAbjadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upCharAbjadButtonActionPerformed int selRow = abjadTable.getSelectedRow(); if (selRow - 1 >= 0) { abjadTable.setRowSelectionInterval(selRow - 1, selRow - 1); abjadTable.scrollRectToVisible(abjadTable.getCellRect(selRow - 1, 0, true)); } else { selRow = abjadTable.getRowCount() - 1; abjadTable.setRowSelectionInterval(selRow, selRow); abjadTable.scrollRectToVisible(abjadTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_upCharAbjadButtonActionPerformed private void downCharAbjadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downCharAbjadButtonActionPerformed int selRow = abjadTable.getSelectedRow(); if (selRow + 1 < abjadTable.getRowCount()) { abjadTable.setRowSelectionInterval(selRow + 1, selRow + 1); abjadTable.scrollRectToVisible(abjadTable.getCellRect(selRow + 1, 0, true)); } else { selRow = 0; abjadTable.setRowSelectionInterval(selRow, selRow); abjadTable.scrollRectToVisible(abjadTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_downCharAbjadButtonActionPerformed private void downPageAbjadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downPageAbjadButtonActionPerformed int c = abjadCharLabel.getText().codePointAt(2); c -= 256; if (c < 20) { c = 20; } updateAbjadChar(c); }//GEN-LAST:event_downPageAbjadButtonActionPerformed private void downAbjadCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downAbjadCharButtonActionPerformed int c = abjadCharLabel.getText().codePointAt(2); c--; if (c < 32) { c = 32; } updateAbjadChar(c); }//GEN-LAST:event_downAbjadCharButtonActionPerformed private void upAbjadCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upAbjadCharButtonActionPerformed int c = abjadCharLabel.getText().codePointAt(2); c++; updateAbjadChar(c); }//GEN-LAST:event_upAbjadCharButtonActionPerformed private void upAbjadPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upAbjadPageButtonActionPerformed int c = abjadCharLabel.getText().codePointAt(2); c += 256; updateAbjadChar(c); }//GEN-LAST:event_upAbjadPageButtonActionPerformed private void abugidaCustomFontRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaCustomFontRadioActionPerformed abugidaChooseFontButton.setEnabled(true); abugidaFontField.setEnabled(true); }//GEN-LAST:event_abugidaCustomFontRadioActionPerformed private void upCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upCharButtonActionPerformed int selRow = alphaTable.getSelectedRow(); if (selRow - 1 >= 0) { alphaTable.setRowSelectionInterval(selRow - 1, selRow - 1); alphaTable.scrollRectToVisible(alphaTable.getCellRect(selRow - 1, 0, true)); } else { selRow = alphaTable.getRowCount() - 1; alphaTable.setRowSelectionInterval(selRow, selRow); alphaTable.scrollRectToVisible(alphaTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_upCharButtonActionPerformed private void downCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downCharButtonActionPerformed int selRow = alphaTable.getSelectedRow(); if (selRow + 1 < alphaTable.getRowCount()) { alphaTable.setRowSelectionInterval(selRow + 1, selRow + 1); alphaTable.scrollRectToVisible(alphaTable.getCellRect(selRow + 1, 0, true)); } else { selRow = 0; alphaTable.setRowSelectionInterval(selRow, selRow); alphaTable.scrollRectToVisible(alphaTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_downCharButtonActionPerformed private void downButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downButtonActionPerformed int c = characterLabel.getText().codePointAt(2); c--; if (c < 32) { c = 32; } updateAlphaChar(c); }//GEN-LAST:event_downButtonActionPerformed private void upButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upButtonActionPerformed int c = characterLabel.getText().codePointAt(2); c++; updateAlphaChar(c); }//GEN-LAST:event_upButtonActionPerformed private void downPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downPageButtonActionPerformed int c = characterLabel.getText().codePointAt(2); c -= 256; if (c < 32) { c = 32; } updateAlphaChar(c); }//GEN-LAST:event_downPageButtonActionPerformed private void upPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upPageButtonActionPerformed int c = characterLabel.getText().codePointAt(2); c += 256; updateAlphaChar(c); }//GEN-LAST:event_upPageButtonActionPerformed private void alphaJumpToFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alphaJumpToFieldActionPerformed int v = (int) Integer.parseInt(alphaJumpToField.getText(), 16); updateAlphaChar(v); }//GEN-LAST:event_alphaJumpToFieldActionPerformed private void setAlphaCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setAlphaCharButtonActionPerformed if (alphaTable.getSelectedColumn() < 1) { alphaTable.setColumnSelectionInterval(1, 1); } try { int v = characterLabel.getText().codePointAt(2); alphaTable.setValueAt(new String(Character.toChars(v)), alphaTable.getSelectedRow(), alphaTable.getSelectedColumn()); } catch (IndexOutOfBoundsException ex) { JOptionPane.showMessageDialog(this, "Please choose a place to set it!", null, JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_setAlphaCharButtonActionPerformed private void chooseAbjadFontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseAbjadFontButtonActionPerformed RwJFontChooser rwf = new RwJFontChooser(new JFrame()); rwf.setVisible(true); Font daFont = rwf.getSelectedFont(); if (daFont != null) { abjadFontField.setText(daFont.getFontName()); tcr2.setFontName(daFont.getFontName()); for (int a = 0; a < abjadTable.getRowCount(); a++) { abjadTable.setValueAt(abjadTable.getValueAt(a, 0), a, 1); } abjadCharLabel.setFont(daFont); punctCharacterLabel.setFont(daFont); } }//GEN-LAST:event_chooseAbjadFontButtonActionPerformed private void autofillAlphabetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autofillAlphabetButtonActionPerformed if (alphaTable.getSelectedColumn() < 1) { alphaTable.setColumnSelectionInterval(1, 1); } Object[] o = new Object[alphaTable.getColumnCount()]; for (int z = 0; z < alphaTable.getColumnCount(); z++) { o[z] = alphaTable.getValueAt(0, z); } if (o[0] == null) { JOptionPane.showMessageDialog(this, "Cannot start with null!", "Oops!", JOptionPane.ERROR_MESSAGE); } else { for (int z = 1; z < alphaTable.getColumnCount(); z++) { String s = o[z] + ""; int c = s.codePointAt(0); for (int row = 0; row < alphaTable.getRowCount(); row++) { alphaTable.setValueAt(new String(Character.toChars(c)), row, z); c++; } } } }//GEN-LAST:event_autofillAlphabetButtonActionPerformed private void autofillAbjadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autofillAbjadButtonActionPerformed if (abjadTable.getSelectedColumn() < 1) { abjadTable.setColumnSelectionInterval(1, 1); } Object[] o = new Object[abjadTable.getColumnCount()]; for (int z = 0; z < abjadTable.getColumnCount(); z++) { o[z] = abjadTable.getValueAt(0, z); } if (o[0] == null) { JOptionPane.showMessageDialog(this, "Cannot start with null!", "Oops!", JOptionPane.ERROR_MESSAGE); } else { for (int z = 1; z < abjadTable.getColumnCount(); z++) { String s = o[z] + ""; int c = s.codePointAt(0); for (int row = 0; row < abjadTable.getRowCount(); row++) { abjadTable.setValueAt(new String(Character.toChars(c)), row, z); c++; } } } }//GEN-LAST:event_autofillAbjadButtonActionPerformed private void setAbjadCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setAbjadCharButtonActionPerformed if (abjadTable.getSelectedColumn() < 1) { abjadTable.setColumnSelectionInterval(1, 1); } try { int v = abjadCharLabel.getText().codePointAt(2); abjadTable.setValueAt(new String(Character.toChars(v)), abjadTable.getSelectedRow(), abjadTable.getSelectedColumn()); } catch (IndexOutOfBoundsException ex) { JOptionPane.showMessageDialog(this, "Please choose a place to set it!", null, JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_setAbjadCharButtonActionPerformed private void abjadJumpToFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abjadJumpToFieldActionPerformed String jumpTo = abjadJumpToField.getText(); int loc = Integer.parseInt(jumpTo, 16); updateAbjadChar(loc); }//GEN-LAST:event_abjadJumpToFieldActionPerformed private void borrowedAbjadFontRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borrowedAbjadFontRadioActionPerformed chooseAbjadFontButton.setEnabled(false); abjadFontField.setEnabled(false); }//GEN-LAST:event_borrowedAbjadFontRadioActionPerformed private void customAbjadFontRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customAbjadFontRadioActionPerformed chooseAbjadFontButton.setEnabled(true); abjadFontField.setEnabled(true); }//GEN-LAST:event_customAbjadFontRadioActionPerformed private void abugidaChooseFontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaChooseFontButtonActionPerformed RwJFontChooser rwf = new RwJFontChooser(new JFrame()); rwf.setVisible(true); Font daFont = rwf.getSelectedFont(); if (daFont != null) { abugidaFontField.setText(daFont.getFontName()); tcr2.setFontName(daFont.getFontName()); for (int a = 0; a < abugidaTable.getRowCount(); a++) { if (abugidaTable.getValueAt(a, 1) == null) { abugidaTable.setValueAt(abugidaTable.getValueAt(a, 0), a, 1); } } abugidaCharLabel.setFont(daFont); punctCharacterLabel.setFont(daFont); } }//GEN-LAST:event_abugidaChooseFontButtonActionPerformed private void abugidaUpCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaUpCharButtonActionPerformed int selRow = abugidaTable.getSelectedRow(); if (selRow - 1 >= 0) { abugidaTable.setRowSelectionInterval(selRow - 1, selRow - 1); abugidaTable.scrollRectToVisible(abugidaTable.getCellRect(selRow - 1, 0, true)); } else { selRow = abugidaTable.getRowCount() - 1; abugidaTable.setRowSelectionInterval(selRow, selRow); abugidaTable.scrollRectToVisible(abugidaTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_abugidaUpCharButtonActionPerformed private void abugidaDownCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaDownCharButtonActionPerformed int selRow = abugidaTable.getSelectedRow(); if (selRow + 1 < abugidaTable.getRowCount()) { abugidaTable.setRowSelectionInterval(selRow + 1, selRow + 1); abugidaTable.scrollRectToVisible(abugidaTable.getCellRect(selRow + 1, 0, true)); } else { selRow = 0; abugidaTable.setRowSelectionInterval(selRow, selRow); abugidaTable.scrollRectToVisible(abugidaTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_abugidaDownCharButtonActionPerformed private void setAbugidaCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_setAbugidaCharButtonActionPerformed try { int v = abugidaCharLabel.getText().codePointAt(2); abugidaTable.setValueAt(new String(Character.toChars(v)), abugidaTable.getSelectedRow(), 1); } catch (IndexOutOfBoundsException ex) { JOptionPane.showMessageDialog(this, "Please choose a place to set it!", null, JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_setAbugidaCharButtonActionPerformed private void downPageAbugidaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downPageAbugidaButtonActionPerformed int c = abugidaCharLabel.getText().codePointAt(2); c -= 256; if (c < 32) { c = 32; } updateAbugidaChar(c); }//GEN-LAST:event_downPageAbugidaButtonActionPerformed private void downCharAbugidaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downCharAbugidaButtonActionPerformed int c = abugidaCharLabel.getText().codePointAt(2); c--; if (c < 32) { c = 32; } updateAbugidaChar(c); }//GEN-LAST:event_downCharAbugidaButtonActionPerformed private void upCharAbugidaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upCharAbugidaButtonActionPerformed int c = abugidaCharLabel.getText().codePointAt(2); c++; updateAbugidaChar(c); }//GEN-LAST:event_upCharAbugidaButtonActionPerformed private void upPageAbugidaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_upPageAbugidaButtonActionPerformed int c = abugidaCharLabel.getText().codePointAt(2); c += 256; updateAbugidaChar(c); }//GEN-LAST:event_upPageAbugidaButtonActionPerformed private void abugidaAutoFillButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaAutoFillButtonActionPerformed Object o = abugidaTable.getValueAt(0, 1); if (o == null) { JOptionPane.showMessageDialog(this, "Cannot start with null!", "Oops!", JOptionPane.ERROR_MESSAGE); } else { String s = o + ""; int c = s.codePointAt(0); for (int row = 0; row < abugidaTable.getRowCount(); row++) { abugidaTable.setValueAt(new String(Character.toChars(c)), row, 1); c++; } } }//GEN-LAST:event_abugidaAutoFillButtonActionPerformed private void abugidaJumpToFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaJumpToFieldActionPerformed int v = Integer.parseInt(abugidaJumpToField.getText(), 16); updateAbugidaChar(v); }//GEN-LAST:event_abugidaJumpToFieldActionPerformed private void abugidaBorrowedFontRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abugidaBorrowedFontRadioActionPerformed abugidaChooseFontButton.setEnabled(false); abugidaFontField.setEnabled(false); }//GEN-LAST:event_abugidaBorrowedFontRadioActionPerformed private void alphaGlyphsPerLetterSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_alphaGlyphsPerLetterSpinnerStateChanged int numberOfGlyphs = ((Integer) alphaGlyphsPerLetterSpinner.getValue()).intValue(); if (numberOfGlyphs > 1) { alphaLetterGlyphNumberCombo.setEnabled(true); alphaLetterUsedInCombo.setEnabled(true); alphaLeftColumnButton.setEnabled(true); alphaRightColumnButton.setEnabled(true); } else { alphaLetterGlyphNumberCombo.setEnabled(false); alphaLetterUsedInCombo.setEnabled(false); alphaLeftColumnButton.setEnabled(false); alphaRightColumnButton.setEnabled(false); } if (alphaTable.getColumnCount() != numberOfGlyphs + 1) { DefaultTableModel defMod = (DefaultTableModel) alphaTable.getModel(); defMod.setColumnCount(2); for (int a = 1; a < numberOfGlyphs; a++) { defMod.addColumn("Glyph " + (a + 1)); } for (int a = 0; a <= numberOfGlyphs; a++) { alphaTable.getColumnModel().getColumn(a).setCellRenderer(tcr2); } } }//GEN-LAST:event_alphaGlyphsPerLetterSpinnerStateChanged private void alphaLeftColumnButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alphaLeftColumnButtonActionPerformed if (alphaTable.getSelectedColumn() < 1) { alphaTable.setColumnSelectionInterval(1, 1); } System.out.println(alphaTable.getSelectedColumn()); if (alphaTable.getSelectedColumn() > 1) { alphaTable.setColumnSelectionInterval(alphaTable.getSelectedColumn() - 1, alphaTable.getSelectedColumn() - 1); } }//GEN-LAST:event_alphaLeftColumnButtonActionPerformed private void alphaRightColumnButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alphaRightColumnButtonActionPerformed if (alphaTable.getSelectedColumn() < 1) { alphaTable.setColumnSelectionInterval(1, 1); } System.out.println(alphaTable.getSelectedColumn()); if (alphaTable.getSelectedColumn() < alphaTable.getColumnCount() - 1) { alphaTable.setColumnSelectionInterval(alphaTable.getSelectedColumn() + 1, alphaTable.getSelectedColumn() + 1); } }//GEN-LAST:event_alphaRightColumnButtonActionPerformed private void alphaLetterGlyphNumberComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alphaLetterGlyphNumberComboActionPerformed // TODO add your handling code here: }//GEN-LAST:event_alphaLetterGlyphNumberComboActionPerformed private void alphaLetterUsedInComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alphaLetterUsedInComboActionPerformed String g1 = (String) alphaLetterGlyphNumberCombo.getSelectedItem(); String use = (String) alphaLetterUsedInCombo.getSelectedItem(); alphaGlyphUseMap.put(g1, use); if (alphaGlyphUseMap.containsValue("Upper")) { capitalizationCombo.setEnabled(true); } else { capitalizationCombo.setEnabled(false); } //System.out.println(alphaGlyphUseMap); }//GEN-LAST:event_alphaLetterUsedInComboActionPerformed private void abjadLeftColumnButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abjadLeftColumnButtonActionPerformed if (abjadTable.getSelectedColumn() < 1) { abjadTable.setColumnSelectionInterval(1, 1); } if (abjadTable.getSelectedColumn() > 1) { abjadTable.setColumnSelectionInterval(abjadTable.getSelectedColumn() - 1, abjadTable.getSelectedColumn() - 1); } }//GEN-LAST:event_abjadLeftColumnButtonActionPerformed private void abjadRightColumnButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abjadRightColumnButtonActionPerformed if (abjadTable.getSelectedColumn() < 1) { abjadTable.setColumnSelectionInterval(1, 1); } if (abjadTable.getSelectedColumn() < abjadTable.getColumnCount() - 1) { abjadTable.setColumnSelectionInterval(abjadTable.getSelectedColumn() + 1, abjadTable.getSelectedColumn() + 1); } }//GEN-LAST:event_abjadRightColumnButtonActionPerformed private void abjadGlyphsPerConsonantSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_abjadGlyphsPerConsonantSpinnerStateChanged int numberOfGlyphs = ((Integer) abjadGlyphsPerConsonantSpinner.getValue()).intValue(); if (numberOfGlyphs > 1) { abjadConsonantGlyphNumberCombo.setEnabled(true); abjadConsonantUsedInCombo.setEnabled(true); abjadLeftColumnButton.setEnabled(true); abjadRightColumnButton.setEnabled(true); } else { abjadConsonantGlyphNumberCombo.setEnabled(false); abjadConsonantUsedInCombo.setEnabled(false); abjadLeftColumnButton.setEnabled(false); abjadRightColumnButton.setEnabled(false); } if (abjadTable.getColumnCount() != numberOfGlyphs + 1) { DefaultTableModel defMod = (DefaultTableModel) abjadTable.getModel(); defMod.setColumnCount(2); for (int a = 1; a < numberOfGlyphs; a++) { defMod.addColumn("Glyph " + (a + 1)); } for (int a = 0; a <= numberOfGlyphs; a++) { abjadTable.getColumnModel().getColumn(a).setCellRenderer(tcr2); } } }//GEN-LAST:event_abjadGlyphsPerConsonantSpinnerStateChanged private void abjadConsonantUsedInComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abjadConsonantUsedInComboActionPerformed String g1 = (String) abjadConsonantGlyphNumberCombo.getSelectedItem(); String use = (String) abjadConsonantUsedInCombo.getSelectedItem(); abjadGlyphUseMap.put(g1, use); System.out.println(abjadGlyphUseMap); }//GEN-LAST:event_abjadConsonantUsedInComboActionPerformed private void capitalizationComboActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_capitalizationComboActionPerformed // TODO add your handling code here: }//GEN-LAST:event_capitalizationComboActionPerformed private void multiCustomFontFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiCustomFontFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_multiCustomFontFieldActionPerformed private void multiUpGlyphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiUpGlyphButtonActionPerformed int selRow = multigraphicTable.getSelectedRow(); if (selRow - 1 >= 0) { multigraphicTable.setRowSelectionInterval(selRow - 1, selRow - 1); multigraphicTable.scrollRectToVisible(multigraphicTable.getCellRect(selRow - 1, 0, true)); } else { selRow = multigraphicTable.getRowCount() - 1; multigraphicTable.setRowSelectionInterval(selRow, selRow); multigraphicTable.scrollRectToVisible(multigraphicTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_multiUpGlyphButtonActionPerformed private void multiDownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiDownButtonActionPerformed int selRow = multigraphicTable.getSelectedRow(); if (selRow + 1 < multigraphicTable.getRowCount()) { multigraphicTable.setRowSelectionInterval(selRow + 1, selRow + 1); multigraphicTable.scrollRectToVisible(multigraphicTable.getCellRect(selRow + 1, 0, true)); } else { selRow = 0; multigraphicTable.setRowSelectionInterval(selRow, selRow); multigraphicTable.scrollRectToVisible(multigraphicTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_multiDownButtonActionPerformed private void multiBorrowedRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiBorrowedRadioActionPerformed multiCustomFontField.setEnabled(false); multiChooseCustomFontButton.setEnabled(false); }//GEN-LAST:event_multiBorrowedRadioActionPerformed private void multiDownPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiDownPageButtonActionPerformed int c = multiCharacterLabel.getText().codePointAt(2); c -= 256; if (c < 32) { c = 32; } updateMultiChar(c); }//GEN-LAST:event_multiDownPageButtonActionPerformed private void multiCustomRadioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiCustomRadioActionPerformed multiCustomFontField.setEnabled(true); multiChooseCustomFontButton.setEnabled(true); }//GEN-LAST:event_multiCustomRadioActionPerformed private void multiChooseCustomFontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiChooseCustomFontButtonActionPerformed RwJFontChooser rwf = new RwJFontChooser(new JFrame()); rwf.setVisible(true); Font daFont = rwf.getSelectedFont(); if (daFont != null) { multiCustomFontField.setText(daFont.getFontName()); tcr2.setFontName(daFont.getFontName()); for (int b = 1; b < multigraphicTable.getColumnCount(); b++) { char q = (multigraphicTable.getValueAt(0, b) + "").charAt(0); for (int a = 0; a < multigraphicTable.getRowCount(); a++) { multigraphicTable.setValueAt(((char) (q + a)) + "", a, b); } } multiCharacterLabel.setFont(daFont); punctCharacterLabel.setFont(daFont); } }//GEN-LAST:event_multiChooseCustomFontButtonActionPerformed private void multiUpCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiUpCharButtonActionPerformed int c = multiCharacterLabel.getText().codePointAt(2); c++; updateMultiChar(c); }//GEN-LAST:event_multiUpCharButtonActionPerformed private void graphemesPerGlyphSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_graphemesPerGlyphSpinnerStateChanged int numberOfGlyphs = ((Integer) graphemesPerGlyphSpinner.getValue()).intValue(); if (multigraphicTable.getColumnCount() != numberOfGlyphs + 1) { DefaultTableModel defMod = (DefaultTableModel) multigraphicTable.getModel(); defMod.setColumnCount(3); for (int a = 2; a < numberOfGlyphs; a++) { defMod.addColumn("Grapheme " + (a + 1)); } for (int a = 0; a <= numberOfGlyphs; a++) { multigraphicTable.getColumnModel().getColumn(a).setCellRenderer(tcr2); } } }//GEN-LAST:event_graphemesPerGlyphSpinnerStateChanged private void multiDownCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiDownCharButtonActionPerformed int c = multiCharacterLabel.getText().codePointAt(2); c--; if (c < 32) { c = 32; } updateMultiChar(c); }//GEN-LAST:event_multiDownCharButtonActionPerformed private void multiUpPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiUpPageButtonActionPerformed int c = multiCharacterLabel.getText().codePointAt(2); c += 256; updateMultiChar(c); }//GEN-LAST:event_multiUpPageButtonActionPerformed private void multiLeftGlyphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiLeftGlyphButtonActionPerformed if (multigraphicTable.getSelectedColumn() < 1) { multigraphicTable.setColumnSelectionInterval(1, 1); } System.out.println(multigraphicTable.getSelectedColumn()); if (multigraphicTable.getSelectedColumn() > 1) { multigraphicTable.setColumnSelectionInterval(multigraphicTable.getSelectedColumn() - 1, multigraphicTable.getSelectedColumn() - 1); } }//GEN-LAST:event_multiLeftGlyphButtonActionPerformed private void multiRightGlyphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiRightGlyphButtonActionPerformed if (multigraphicTable.getSelectedColumn() < 1) { multigraphicTable.setColumnSelectionInterval(1, 1); } System.out.println(multigraphicTable.getSelectedColumn()); if (multigraphicTable.getSelectedColumn() < multigraphicTable.getColumnCount() - 1) { multigraphicTable.setColumnSelectionInterval(multigraphicTable.getSelectedColumn() + 1, multigraphicTable.getSelectedColumn() + 1); } }//GEN-LAST:event_multiRightGlyphButtonActionPerformed private void multiSetGlyphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiSetGlyphButtonActionPerformed if (multigraphicTable.getSelectedColumn() < 1) { multigraphicTable.setColumnSelectionInterval(1, 1); } try { int v = multiCharacterLabel.getText().codePointAt(2); multigraphicTable.setValueAt(new String(Character.toChars(v)), multigraphicTable.getSelectedRow(), multigraphicTable.getSelectedColumn()); } catch (IndexOutOfBoundsException ex) { JOptionPane.showMessageDialog(this, "Please choose a place to set it!", null, JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_multiSetGlyphButtonActionPerformed private void multiAutoFillButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiAutoFillButtonActionPerformed if (multigraphicTable.getSelectedColumn() < 1) { multigraphicTable.setColumnSelectionInterval(1, 1); } Object[] o = new Object[multigraphicTable.getColumnCount()]; for (int z = 0; z < multigraphicTable.getColumnCount(); z++) { o[z] = multigraphicTable.getValueAt(0, z); } if (o[0] == null) { JOptionPane.showMessageDialog(this, "Cannot start with null!", "Oops!", JOptionPane.ERROR_MESSAGE); } else { for (int z = 1; z < multigraphicTable.getColumnCount(); z++) { String s = o[z] + ""; int c = s.codePointAt(0); for (int row = 0; row < multigraphicTable.getRowCount(); row++) { multigraphicTable.setValueAt(new String(Character.toChars(c)), row, z); c++; } } } }//GEN-LAST:event_multiAutoFillButtonActionPerformed private void multiUseEndersCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiUseEndersCheckboxActionPerformed if (multiUseEndersCheckbox.isSelected()) { DefaultTableModel model = (DefaultTableModel) multigraphicTable.getModel(); HashMap ws = getWritingSystem(); System.out.println(ws); HashMap phs = (HashMap) ws.get("Phonemes"); if (!phs.containsKey("Phonemes")) { model.addRow(new String[]{"Enders", "", ""}); } } if (!multiUseEndersCheckbox.isSelected()) { DefaultTableModel model = (DefaultTableModel) multigraphicTable.getModel(); int rc = model.getRowCount(); model.setRowCount(--rc); } }//GEN-LAST:event_multiUseEndersCheckboxActionPerformed private void multiJumpToFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiJumpToFieldActionPerformed int v = Integer.parseInt(multiJumpToField.getText(), 16); updateMultiChar(v); }//GEN-LAST:event_multiJumpToFieldActionPerformed private void fontFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_fontFieldActionPerformed private void punctUpGlyphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctUpGlyphButtonActionPerformed int selRow = punctuationTable.getSelectedRow(); if (selRow - 1 >= 0) { punctuationTable.setRowSelectionInterval(selRow - 1, selRow - 1); punctuationTable.scrollRectToVisible(punctuationTable.getCellRect(selRow - 1, 0, true)); } else { selRow = punctuationTable.getRowCount() - 1; punctuationTable.setRowSelectionInterval(selRow, selRow); punctuationTable.scrollRectToVisible(punctuationTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_punctUpGlyphButtonActionPerformed private void multiDownButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiDownButton1ActionPerformed int selRow = punctuationTable.getSelectedRow(); if (selRow + 1 < punctuationTable.getRowCount()) { punctuationTable.setRowSelectionInterval(selRow + 1, selRow + 1); punctuationTable.scrollRectToVisible(punctuationTable.getCellRect(selRow + 1, 0, true)); } else { selRow = 0; punctuationTable.setRowSelectionInterval(selRow, selRow); punctuationTable.scrollRectToVisible(punctuationTable.getCellRect(selRow, 0, true)); } }//GEN-LAST:event_multiDownButton1ActionPerformed private void punctSetGlyphButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctSetGlyphButtonActionPerformed if (punctuationTable.getSelectedColumn() < 1) { punctuationTable.setColumnSelectionInterval(1, 1); } try { int v = punctCharacterLabel.getText().codePointAt(2); punctuationTable.setValueAt(new String(Character.toChars(v)) + "", punctuationTable.getSelectedRow(), punctuationTable.getSelectedColumn()); } catch (IndexOutOfBoundsException ex) { JOptionPane.showMessageDialog(this, "Please choose a place to set it!", null, JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_punctSetGlyphButtonActionPerformed private void punctiDownPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctiDownPageButtonActionPerformed int c = punctCharacterLabel.getText().codePointAt(2); c -= 256; if (c < 32) { c = 32; } updatePunctChar(c); }//GEN-LAST:event_punctiDownPageButtonActionPerformed private void punctDownCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctDownCharButtonActionPerformed int c = punctCharacterLabel.getText().codePointAt(2); c--; if (c < 32) { c = 32; } updatePunctChar(c); }//GEN-LAST:event_punctDownCharButtonActionPerformed private void punctUpCharButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctUpCharButtonActionPerformed int c = punctCharacterLabel.getText().codePointAt(2); c++; updatePunctChar(c); }//GEN-LAST:event_punctUpCharButtonActionPerformed private void punctUpPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctUpPageButtonActionPerformed int c = punctCharacterLabel.getText().codePointAt(2); c += 256; updatePunctChar(c); }//GEN-LAST:event_punctUpPageButtonActionPerformed private void punctAutoFillButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctAutoFillButtonActionPerformed Object o = punctuationTable.getValueAt(0, 1); if (o == null) { JOptionPane.showMessageDialog(this, "Can not start with null!", "Oops!", JOptionPane.ERROR_MESSAGE); } else { String s = o + ""; int q = ((String) punctuationTable.getValueAt(0, 1)).codePointAt(0); for (int row = 0; row < punctuationTable.getRowCount(); row++) { int c = ((String) punctuationTable.getValueAt(row, 0)).codePointAt(0) - 32; punctuationTable.setValueAt(new String(Character.toChars(c + q)), row, 1); } } }//GEN-LAST:event_punctAutoFillButtonActionPerformed private void punctJumpToFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_punctJumpToFieldActionPerformed int v = Integer.parseInt(punctJumpToField.getText(), 16); updatePunctChar(v); }//GEN-LAST:event_punctJumpToFieldActionPerformed @SuppressWarnings("CallToThreadDumpStack") private void writingSystemPaneStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_writingSystemPaneStateChanged if (writingSystemPane.getSelectedIndex() < 5) { writingSystem.put("System", writingSystemPane.getTitleAt(writingSystemPane.getSelectedIndex())); } System.out.println(writingSystem.get("System")); if (writingSystemPane.getSelectedIndex() == 7) { File here = new File("."); File[] wsList = here.listFiles(new rwWsFileFilter()); DefaultTableModel dtm = (DefaultTableModel) userDefdTable.getModel(); //userDefdTable.removeColumn(userDefdTable.getColumn("Sample Text")); dtm.setRowCount(0); for (int a = 0; a < wsList.length; a++) { try { InputSource ins = new InputSource(wsList[a].getPath()); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList list = (NodeList) xpath.evaluate("//System/text()", ins, XPathConstants.NODESET); dtm.addRow(new String[]{wsList[a].getName().substring(0, wsList[a].getName().length() - 4), list.item(0).getNodeValue(), wsList[a].getCanonicalPath()}); } catch (Exception ex) { ex.printStackTrace(); } } } }//GEN-LAST:event_writingSystemPaneStateChanged private void syllabaryCustomFontFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_syllabaryCustomFontFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_syllabaryCustomFontFieldActionPerformed private void vowelCarrierCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vowelCarrierCheckActionPerformed if (vowelCarrierCheck.isSelected()) { DefaultTableModel model = (DefaultTableModel) abugidaTable.getModel(); model.addRow(new String[]{"VowelCarrier", "", ""}); } if (!vowelCarrierCheck.isSelected()) { DefaultTableModel model = (DefaultTableModel) abugidaTable.getModel(); int rc = model.getRowCount(); model.setRowCount(--rc); } }//GEN-LAST:event_vowelCarrierCheckActionPerformed private void noVowelCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noVowelCheckboxActionPerformed if (noVowelCheckbox.isSelected()) { DefaultTableModel model = (DefaultTableModel) abugidaTable.getModel(); model.addRow(new String[]{"NoVowel", "", ""}); } if (!noVowelCheckbox.isSelected()) { DefaultTableModel model = (DefaultTableModel) abugidaTable.getModel(); int rc = model.getRowCount(); model.setRowCount(--rc); } }//GEN-LAST:event_noVowelCheckboxActionPerformed private void abjadVowelCarrierCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abjadVowelCarrierCheckActionPerformed if (abjadVowelCarrierCheck.isSelected()) { DefaultTableModel model = (DefaultTableModel) abjadTable.getModel(); model.addRow(new String[]{"VowelCarrier", "", ""}); } if (!abjadVowelCarrierCheck.isSelected()) { DefaultTableModel model = (DefaultTableModel) abjadTable.getModel(); int rc = model.getRowCount(); model.setRowCount(--rc); } }//GEN-LAST:event_abjadVowelCarrierCheckActionPerformed private void useSystemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_useSystemButtonActionPerformed String tabs = "Alphabet Abjad Abugida Syllabary Multigraphic"; String[] writeSyst = (String[]) presets.elementAt(presetsTable.getSelectedRow()); for (int a = 0; a < writeSyst.length; a++) { System.out.println(writeSyst[a]); } if (writeSyst[1].equals("Alphabet")) { String glyphuses = "IMFSUL"; alphaGlyphsPerLetterSpinner.setValue(writeSyst[10].length()); for (int a = 1; a < writeSyst[10].length() + 1; a++) { alphaTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3 + a], 16))), 0, a); alphaLetterGlyphNumberCombo.setSelectedIndex(a - 1); alphaLetterUsedInCombo.setSelectedIndex(glyphuses.indexOf(writeSyst[10].charAt(a - 1))); } if (alphaGlyphUseMap.containsValue("Upper")) { capitalizationCombo.setSelectedIndex(2); } borrowedCharsRadio.setSelected(true); punctuationTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3], 16))), 0, 1); punctAutoFillButtonActionPerformed(evt); autofillAlphabetButtonActionPerformed(evt); if (writeSyst[writeSyst.length - 1].equals("rtl")) { directionalityButton.setSelected(true); } } if (writeSyst[1].equals("Abjad")) { String glyphuses = "IiMmFSUL"; abjadGlyphsPerConsonantSpinner.setValue(writeSyst[10].length()); for (int a = 1; a < writeSyst[10].length() + 1; a++) { abjadTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3 + a], 16))), 0, a); abjadConsonantGlyphNumberCombo.setSelectedIndex(a - 1); abjadConsonantUsedInCombo.setSelectedIndex(glyphuses.indexOf(writeSyst[10].charAt(a - 1))); } borrowedAbjadFontRadio.setSelected(true); punctuationTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3], 16))), 0, 1); punctAutoFillButtonActionPerformed(evt); autofillAbjadButtonActionPerformed(evt); } if (writeSyst[1].equals("Abugida")) { abugidaTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[4], 16))), 0, 1); punctuationTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3], 16))), 0, 1); punctAutoFillButtonActionPerformed(evt); abugidaAutoFillButtonActionPerformed(evt); } if (writeSyst[1].equals("Syllabary")) { syllabaryTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[2], 16))), 0, 1); syllabaryCustomFontCheck.setSelected(false); autoFillSyllabaryButtonActionPerformed(evt); } if (writeSyst[1].equals("Multigraphic")) { graphemesPerGlyphSpinner.setValue(writeSyst[10].length()); for (int a = 1; a < writeSyst[10].length() + 1; a++) { multigraphicTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3 + a], 16))), 0, a); } multiUseEndersCheckbox.setSelected(true); punctuationTable.setValueAt(new String(Character.toChars(Integer.parseInt(writeSyst[3], 16))), 0, 1); punctAutoFillButtonActionPerformed(evt); multiUseEndersCheckboxActionPerformed(evt); multiAutoFillButtonActionPerformed(evt); } writingSystemPane.setSelectedIndex(tabs.indexOf(writeSyst[1]) / 12); }//GEN-LAST:event_useSystemButtonActionPerformed private void directionalityButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_directionalityButtonActionPerformed if (directionalityButton.isSelected()) { directionalityButton.setText("L ⬅ R"); writingSystem.put("Directionality", "rtl"); } else { directionalityButton.setText("L ➡ R"); writingSystem.put("Directionality", "ltr"); } }//GEN-LAST:event_directionalityButtonActionPerformed @SuppressWarnings("CallToThreadDumpStack") private void loadWsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadWsButtonActionPerformed if (wsFile == null) { wsFile = new File("."); } if (writingSystemPane.getSelectedIndex() != 7) { writingSystemPane.setSelectedIndex(7); File here = new File("."); File[] wsList = here.listFiles(new rwWsFileFilter()); DefaultTableModel dtm = (DefaultTableModel) userDefdTable.getModel(); //removeColumn(userDefdTable.getColumn("Sample Text")); dtm.setRowCount(0); for (int a = 0; a < wsList.length; a++) { try { InputSource ins = new InputSource(wsList[a].getPath()); XPath xpath = XPathFactory.newInstance().newXPath(); NodeList list = (NodeList) xpath.evaluate("//System/text()", ins, XPathConstants.NODESET); dtm.addRow(new String[]{wsList[a].getName().substring(0, wsList[a].getName().length() - 4), list.item(0).getNodeValue(), wsList[a].getCanonicalPath()}); } catch (Exception ex) { ex.printStackTrace(); } } } else { //userDefdTable.addColumn(userDefdTable.getColumn("Sample Text")); if (wsFile.getPath() == ".") { wsFile = new File(userDefdTable.getValueAt(userDefdTable.getSelectedRow(), 2) + ""); } SAXParserFactory factory = SAXParserFactory.newInstance(); try { SAXParser saxParser = factory.newSAXParser(); DefaultHandler handler = new DefaultHandler() { boolean numberOfLettersTag = false; boolean capRuleTag = false; boolean phonemeTag = false; boolean phonemesTag = false; boolean fontTag = false; boolean fontTypeTag = false; boolean glyphUseTag = false; boolean numberGlyphsTag = false; boolean vowelsShownTag = false; boolean systemTag = false; boolean pkey = false; boolean pvalue = false; boolean numberGraphemesTag = false; boolean punctTag = false; boolean glyph1Tag = false; boolean glyph2Tag = false; boolean glyph3Tag = false; boolean glyph4Tag = false; boolean syllablesTag = false; boolean syllableTag = false; boolean skeyTag = false; boolean svalueTag = false; boolean vowelsTag = false; boolean consonantsTag = false; HashMap phnms = new HashMap(); HashMap sylbs = new HashMap(); String key = ""; String value = ""; String skey = ""; String svalue = ""; public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equalsIgnoreCase("NumberOfLetters")) { numberOfLettersTag = true; } if (qName.equalsIgnoreCase("CapRule")) { capRuleTag = true; } if (qName.equalsIgnoreCase("Phonemes")) { phonemeTag = true; } if (qName.equalsIgnoreCase("pkey")) { pkey = true; } if (qName.equalsIgnoreCase("Font")) { fontTag = true; } if (qName.equalsIgnoreCase("FontType")) { fontTypeTag = true; } if (qName.equalsIgnoreCase("GlyphUseMap")) { glyphUseTag = true; } if (qName.equalsIgnoreCase("Glyph_1")) { glyph1Tag = true; } if (qName.equalsIgnoreCase("Glyph_2")) { glyph2Tag = true; } if (qName.equalsIgnoreCase("Glyph_3")) { glyph3Tag = true; } if (qName.equalsIgnoreCase("Glyph_4")) { glyph4Tag = true; } if (qName.equalsIgnoreCase("GlyphsPerLetter")) { numberGlyphsTag = true; } if (qName.equalsIgnoreCase("System")) { systemTag = true; } if (qName.equalsIgnoreCase("pvalue")) { pvalue = true; } if (qName.equalsIgnoreCase("phonemes")) { phonemesTag = true; } if (qName.equalsIgnoreCase("graphemesperglyph")) { numberGraphemesTag = true; } if (qName.equalsIgnoreCase("Punctuation")) { punctTag = true; } if (qName.equalsIgnoreCase("Syllables")) { syllablesTag = true; } if (qName.equalsIgnoreCase("skey")) { skeyTag = true; } if (qName.equalsIgnoreCase("svalue")) { svalueTag = true; } if (qName.equalsIgnoreCase("Vowels")) { vowelsTag = true; } if (qName.equalsIgnoreCase("Consonants")) { consonantsTag = true; } } public void endElement(String uri, String localName, String qName) throws SAXException { //System.out.print("E:"); } public void characters(char ch[], int start, int length) throws SAXException { if (numberOfLettersTag) { writingSystem.put("NumberOfLetters", new String(ch, start, length)); numberOfLettersTag = false; } if (capRuleTag) { writingSystem.put("CapRule", new String(ch, start, length)); capRuleTag = false; } if (phonemesTag) { writingSystem.put("Phonemes", phnms); phonemesTag = false; } if (pkey) { String coded = new String(ch, start, length); //key = ((char)Integer.parseInt(coded,16))+""; key = rwStringConverter.convertFrom64(coded); pkey = false; } if (pvalue) { String coded = new String(ch, start, length); value = rwStringConverter.convertFromHex(coded); //System.out.println(value + " for " + key); phnms.put(key, value); pvalue = false; } if (fontTag) { String f = new String(ch, start, length); writingSystem.put("Font", f); fontTag = false; } if (fontTypeTag) { String f = new String(ch, start, length); writingSystem.put("FontType", f); fontTypeTag = false; } if (systemTag) { String syst = new String(ch, start, length); writingSystem.put("System", syst); systemTag = false; } if (numberGlyphsTag) { writingSystem.put("GlyphsPerLetter", new String(ch, start, length)); numberGlyphsTag = false; } if (numberGraphemesTag) { writingSystem.put("GraphemesPerGlyph", new String(ch, start, length)); numberGraphemesTag = false; } if (punctTag) { String punct = new String(ch, start, length); HashMap punctHash = new HashMap(); for (String keyValue : punct.split(" *, *")) { String[] pairs = keyValue.split(" *e *", 2); punctHash.put(rwStringConverter.convertFromHex(pairs[0]), pairs.length == 1 ? "" : rwStringConverter.convertFromHex(pairs[1])); } writingSystem.put("Punctuation", punctHash); punctTag = false; } if (glyph1Tag) { HashMap gum = ((HashMap) writingSystem.get("GlyphUseMap")); System.out.println(gum); gum.put("Glyph_1", new String(ch, start, length)); writingSystem.put("GlyphUseMap", gum); glyph1Tag = false; } if (glyph2Tag) { HashMap gum = ((HashMap) writingSystem.get("GlyphUseMap")); gum.put("Glyph_2", new String(ch, start, length)); writingSystem.put("GlyphUseMap", gum); glyph2Tag = false; } if (glyph3Tag) { HashMap gum = ((HashMap) writingSystem.get("GlyphUseMap")); gum.put("Glyph_3", new String(ch, start, length)); writingSystem.put("GlyphUseMap", gum); glyph3Tag = false; } if (glyph4Tag) { HashMap gum = ((HashMap) writingSystem.get("GlyphUseMap")); gum.put("Glyph_4", new String(ch, start, length)); writingSystem.put("GlyphUseMap", gum); glyph4Tag = false; } if (glyphUseTag) { HashMap gum = new HashMap(); writingSystem.put("GlyphUseMap", gum); glyphUseTag = false; } if (syllablesTag) { writingSystem.put("Syllables", sylbs); System.out.println(sylbs); syllablesTag = false; } if (skeyTag) { skey = new String(ch, start, length); skeyTag = false; } if (svalueTag) { String coded = new String(ch, start, length); svalue = rwStringConverter.convertFromHex(coded); sylbs.put(skey, svalue); svalueTag = false; } if (vowelsTag) { vows.clear(); String v = new String(ch, start, length); String[] va = v.split(","); for (int a = 0; a < va.length; a++) { if (va[a].contains(" ")) { String[] vb = va[a].split(" "); String vc = ""; for (int b = 0; b < vb.length; b++) { vc += (char) Integer.parseInt(vb[b], 16); } } else { vows.add(((char) Integer.parseInt(va[a], 16)) + ""); } } vowelsTag = false; } if (consonantsTag) { cons.clear(); String v = new String(ch, start, length); String[] va = v.split(","); for (int a = 0; a < va.length; a++) { if (va[a].contains(" ")) { String[] vb = va[a].split(" "); String vc = ""; for (int b = 0; b < vb.length; b++) { vc += (char) Integer.parseInt(vb[b], 16); } cons.add(vc); } else { cons.add(((char) Integer.parseInt(va[a], 16)) + ""); } } consonantsTag = false; } } public void endDocument() { wsLoaded = true; } }; saxParser.parse(wsFile, handler); } catch (Exception ex) { ex.printStackTrace(); } setupSystem(vows, cons, writingSystem); } }//GEN-LAST:event_loadWsButtonActionPerformed private void saveWsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveWsButtonActionPerformed writingSystem = getWritingSystem(); JFileChooser jfc = new JFileChooser("."); String wsName = ""; int chosenOption = jfc.showSaveDialog(this); if (chosenOption != JFileChooser.CANCEL_OPTION) { wsName = jfc.getSelectedFile().getPath(); if (wsName.endsWith(".rws")) { wsName = wsName.substring(0, wsName.length() - 4); setTitle("Random Language Generator " + jfc.getSelectedFile().getName()); } } try { String fileName = wsName; if (!fileName.endsWith(".rws")) { fileName += ".rws"; } PrintWriter out = new PrintWriter(new File(fileName)); StreamResult streamResult = new StreamResult(out); SAXTransformerFactory tf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler hd = tf.newTransformerHandler(); Transformer serializer = hd.getTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); serializer.setOutputProperty(OutputKeys.INDENT, "Yes"); serializer.setOutputProperty(OutputKeys.STANDALONE, "Yes"); hd.setResult(streamResult); hd.startDocument(); AttributesImpl atts = new AttributesImpl(); hd.startElement("", "", "WritingSystem", atts); hd.startElement("", "", "System", atts); String s = (String) writingSystem.get("System"); hd.characters(s.toCharArray(), 0, s.length()); hd.endElement("", "", "System"); hd.startElement("", "", "FontType", atts); String ft = (String) writingSystem.get("FontType"); hd.characters(ft.toCharArray(), 0, ft.length()); hd.endElement("", "", "FontType"); hd.startElement("", "", "Font", atts); ft = (String) writingSystem.get("Font"); hd.characters(ft.toCharArray(), 0, ft.length()); hd.endElement("", "", "Font"); hd.startElement("", "", "Vowels", atts); String daVowels = ""; for (int a = 0; a < vows.size(); a++) { String uc = ""; String ub = ""; for (int b = 0; b < ((String) vows.elementAt(a)).length(); b++) { uc = Integer.toHexString((int) Character.codePointAt((CharSequence) vows.elementAt(a), b)); if (ub.length() > 0) { ub += " "; } ub += uc; } daVowels += ub; if (a < vows.size() - 1) { daVowels += ","; } } hd.startCDATA(); hd.characters(daVowels.toCharArray(), 0, daVowels.length()); hd.endCDATA(); hd.endElement("", "", "Vowels"); hd.startElement("", "", "Consonants", atts); String cnsnts = ""; for (int a = 0; a < cons.size(); a++) { String uc = ""; String ub = ""; for (int b = 0; b < ((String) cons.elementAt(a)).length(); b++) { uc = Integer.toHexString((int) Character.codePointAt((CharSequence) cons.elementAt(a), b)); if (ub.length() > 0) { ub += " "; } ub += uc; } cnsnts += ub; if (a < cons.size() - 1) { cnsnts += ","; } } hd.startCDATA(); hd.characters(cnsnts.toCharArray(), 0, cnsnts.length()); hd.endCDATA(); hd.endElement("", "", "Consonants"); if (!s.equals("System")) { hd.startElement("", "", "NumberOfLetters", atts); String nl = writingSystem.get("NumberOfLetters") + ""; hd.characters(nl.toCharArray(), 0, nl.length()); hd.endElement("", "", "NumberOfLetters"); String nc = "0"; String sq = (String) writingSystem.get("System"); if (sq.equals("Alphabet") || sq.equals("Abjad")) { hd.startElement("", "", "GlyphsPerLetter", atts); nc = writingSystem.get("GlyphsPerLetter") + ""; hd.characters(nc.toCharArray(), 0, nc.length()); hd.endElement("", "", "GlyphsPerLetter"); } if (sq.equals("Multigraphic")) { hd.startElement("", "", "GraphemesPerGlyph", atts); nc = writingSystem.get("GraphemesPerGlyph") + ""; hd.characters(nc.toCharArray(), 0, nc.length()); hd.endElement("", "", "GraphemesPerGlyph"); } if (((HashMap) writingSystem).containsKey("GlyphUseMap")) { hd.startElement("", "", "GlyphUseMap", atts); HashMap gum = (HashMap) writingSystem.get("GlyphUseMap"); for (int numGlyphs = 0; numGlyphs < Integer.parseInt(nc); numGlyphs++) { hd.startElement("", "", "Glyph_" + (numGlyphs + 1), atts); String gp = (String) gum.get("Glyph_" + (numGlyphs + 1)); hd.characters(gp.toCharArray(), 0, gp.length()); hd.endElement("", "", "Glyph_" + (numGlyphs + 1)); } hd.endElement("", "", "GlyphUseMap"); } if (s.equals("Alphabet")) { hd.startElement("", "", "CapRule", atts); String cr = writingSystem.get("CapRule") + ""; hd.characters(cr.toCharArray(), 0, cr.length()); hd.endElement("", "", "CapRule"); } if (((HashMap) writingSystem).containsKey("Phonemes")) { HashMap phns = (HashMap) writingSystem.get("Phonemes"); hd.startElement("", "", "Phonemes", atts); Object[] keys = phns.keySet().toArray(); for (int phn = 0; phn < keys.length; phn++) { hd.startElement("", "", "Phoneme", atts); hd.startElement("", "", "pkey", atts); String hky = rwStringConverter.convertTo64(keys[phn] + ""); hd.startCDATA(); hd.characters(hky.toCharArray(), 0, hky.length()); hd.endCDATA(); hd.endElement("", "", "pkey"); hd.startElement("", "", "pvalue", atts); String phone = phns.get(keys[phn]).toString(); byte[] bs = phone.getBytes("UTF-8"); String hexes = "0123456789ABCDEF"; StringBuilder sb = new StringBuilder(2 * bs.length); for (byte b : bs) { sb.append(hexes.charAt((b & 0xF0) >> 4)).append(hexes.charAt((b & 0x0F))); } hd.startCDATA(); hd.characters(sb.toString().toCharArray(), 0, sb.toString().length()); hd.endCDATA(); hd.endElement("", "", "pvalue"); hd.endElement("", "", "Phoneme"); } hd.endElement("", "", "Phonemes"); } } if (s.equals("Abjad")) { hd.startElement("", "", "VowelsShown", atts); String vs = writingSystem.get("VowelsShown") + ""; hd.characters(vs.toCharArray(), 0, vs.length()); hd.endElement("", "", "VowelsShown"); } if (s.equals("Abugida")) { } if (s.equals("Syllabary")) { hd.startElement("", "", "NumberOfSyllables", atts); String ns = writingSystem.get("NumberOfSyllables") + ""; hd.characters(ns.toCharArray(), 0, ns.length()); hd.endElement("", "", "NumberOfSyllables"); hd.startElement("", "", "Syllables", atts); HashMap sylbls = (HashMap) writingSystem.get("Syllables"); Object[] keys = sylbls.keySet().toArray(); for (int sc = 0; sc < (Integer.parseInt(ns)); sc++) { hd.startElement("", "", "Syllable", atts); hd.startElement("", "", "skey", atts); String ky = keys[sc].toString(); System.out.println(ky + " " + sc); hd.characters(ky.toCharArray(), 0, ky.length()); hd.endElement("", "", "skey"); hd.startElement("", "", "svalue", atts); String syllable = sylbls.get(ky).toString(); byte[] bs = syllable.getBytes("UTF-8"); String hexes = "0123456789ABCDEF"; StringBuilder sb = new StringBuilder(2 * bs.length); for (byte b : bs) { sb.append(hexes.charAt((b & 0xF0) >> 4)).append(hexes.charAt((b & 0x0F))); } //String vl = sylbls.get(ky).toString(); hd.characters(sb.toString().toCharArray(), 0, sb.toString().length()); hd.endElement("", "", "svalue"); hd.endElement("", "", "Syllable"); } hd.endElement("", "", "Syllables"); } if (s.equals("Multigraphic")) { } hd.startElement("", "", "Punctuation", atts); HashMap punct = (HashMap) writingSystem.get("Punctuation"); System.out.println(writingSystem); String pm = ""; for (Object key : punct.keySet()) { pm += rwStringConverter.convertToHex(key + "") + "e" + rwStringConverter.convertToHex(punct.get(key) + "") + ", "; } pm = pm.substring(0, pm.length() - 2); //pm = rwStringConverter.convertTo64(pm); hd.startCDATA(); hd.characters(pm.toCharArray(), 0, pm.length()); hd.endCDATA(); hd.endElement("", "", "Punctuation"); hd.endElement("", "", "WritingSystem"); hd.endDocument(); out.close(); } catch (Exception ex) { System.out.println(ex); ex.printStackTrace(); } }//GEN-LAST:event_saveWsButtonActionPerformed private void browse4WsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browse4WsButtonActionPerformed JFileChooser jfc = new JFileChooser("."); FileNameExtensionFilter fnef = new FileNameExtensionFilter("Random Languange Generator Writing System files", "rws"); jfc.addChoosableFileFilter(fnef); int chosenOption = jfc.showOpenDialog(this); if (chosenOption != JFileChooser.CANCEL_OPTION) { wsFile = jfc.getSelectedFile(); loadWsButtonActionPerformed(evt); } }//GEN-LAST:event_browse4WsButtonActionPerformed public void updateAlphaChar(int s) { String ss = new String(Character.toChars(s)); characterLabel.setText("XX" + ss + "XX"); alphaCurrentVLabel.setText(Integer.toHexString((int) s)); } public void updateSyllabaryChar(int s) { String ss = new String(Character.toChars(s)); visibleCharLabel.setText("XX" + ss + "XX"); syllabaryCharValueLabel.setText(Integer.toHexString((int) s)); } public void updateAbjadChar(int s) { String ss = new String(Character.toChars(s)); abjadCharLabel.setText("XX" + ss + "XX"); abjadCurrentVLabel.setText(Integer.toHexString((int) s)); } public void updateAbugidaChar(int s) { String ss = new String(Character.toChars(s)); abugidaCharLabel.setText("XX" + ss + "XX"); abugidaCurrentVLabel.setText(Integer.toHexString((int) s)); } public void updateMultiChar(int s) { String ss = new String(Character.toChars(s)); multiCharacterLabel.setText("XX" + ss + "XX"); currentHexValueLabel.setText(Integer.toHexString((int) s)); } public void updatePunctChar(int s) { String ss = new String(Character.toChars(s)); punctCharacterLabel.setText("XX" + ss + "XX"); punctCurrentHexValueLabel.setText(Integer.toHexString((int) s)); } public HashMap getWritingSystem() { if (wsLoaded) { return writingSystem; } else { HashMap ws = new HashMap(); HashMap phonemes = new HashMap(); String writeSyst = (String) writingSystem.get("System"); if (directionalityButton.isSelected()) { ws.put("Directionality", "rtl"); } else { ws.put("Directionality", "ltr"); } if (writeSyst.equals("Alphabet")) { ws.put("System", "Alphabet"); ws.put("GlyphsPerLetter", alphaGlyphsPerLetterSpinner.getValue()); ws.put("GlyphUseMap", alphaGlyphUseMap); ws.put("NumberOfLetters", alphaTable.getRowCount()); for (int a = 0; a < alphaTable.getRowCount(); a++) { StringBuilder z = new StringBuilder(""); for (int b = 1; b < alphaTable.getColumnCount(); b++) { String q = alphaTable.getValueAt(a, b) + " "; z.append(q); } phonemes.put(alphaTable.getValueAt(a, 0), z); } ws.put("Phonemes", phonemes); if (!fontField.getText().contains("LCS-ConstructorII")) { ws.put("Font", fontField.getText()); ws.put("FontType", "custom"); } else { ws.put("Font", "LCS-ConstructorII"); ws.put("FontType", "borrowed"); } ws.put("CapRule", capitalizationCombo.getSelectedItem()); } else if (writeSyst.equals("Abjad")) { ws.put("System", "Abjad"); ws.put("GlyphsPerLetter", abjadGlyphsPerConsonantSpinner.getValue()); ws.put("GlyphUseMap", abjadGlyphUseMap); ws.put("NumberOfLetters", abjadTable.getRowCount()); for (int a = 0; a < abjadTable.getRowCount(); a++) { StringBuilder z = new StringBuilder(""); for (int b = 1; b < abjadTable.getColumnCount(); b++) { String q = (abjadTable.getValueAt(a, b) + "").trim() + " "; z.append(q); } phonemes.put(abjadTable.getValueAt(a, 0), z); } ws.put("Phonemes", phonemes); if (!abjadFontField.getText().contains("LCS-ConstructorII")) { ws.put("Font", abjadFontField.getText()); ws.put("FontType", "custom"); } else { ws.put("Font", "LCS-ConstructorII"); ws.put("FontType", "borrowed"); } ws.put("VowelsShown", true); } else if (writeSyst.equals("Abugida")) { ws.put("System", "Abugida"); ws.put("GlyphsPerLetter", 1); ws.put("NumberOfLetters", abugidaTable.getRowCount()); for (int a = 0; a < abugidaTable.getRowCount(); a++) { StringBuilder z = new StringBuilder(""); for (int b = 1; b < abugidaTable.getColumnCount(); b++) { String q = abugidaTable.getValueAt(a, b) + ""; z.append(q); } phonemes.put(abugidaTable.getValueAt(a, 0), z); } ws.put("Phonemes", phonemes); if (!abugidaFontField.getText().contains("LCS-ConstructorII")) { ws.put("Font", abugidaFontField.getText()); ws.put("FontType", "custom"); } else { ws.put("Font", "LCS-ConstructorII"); ws.put("FontType", "borrowed"); } } else if (writeSyst.equals("Syllabary")) { if (syllabaryCustomFontCheck.isSelected()) { ws.put("Font", syllabaryCustomFontField.getText()); } else { ws.put("Font", "LCS-ConstructorII"); } ws.put("System", "Syllabary"); ws.put("NumberOfSyllables", syllabaryTable.getRowCount() * (syllabaryTable.getColumnCount() - 1)); HashMap syllables = new HashMap(); for (int a = 0; a < syllabaryTable.getRowCount(); a++) { for (int b = 1; b < syllabaryTable.getColumnCount(); b++) { String syllable = syllabaryTable.getValueAt(a, 0) + "" + syllabaryTable.getColumnName(b); syllables.put(syllable, syllabaryTable.getValueAt(a, b)); } } ws.put("Syllables", syllables); if (syllabaryCustomFontCheck.isSelected()) { ws.put("FontType", "custom"); ws.put("Font", syllabaryCustomFontField.getText()); } else { ws.put("FontType", "borrowed"); } } else if (writeSyst.equals("Multigraphic")) { ws.put("System", "Multigraphic"); ws.put("GraphemesPerGlyph", graphemesPerGlyphSpinner.getValue()); ws.put("Font", multiCustomFontField.getText()); if (multiBorrowedRadio.isSelected()) { ws.put("FontType", "Borrowed"); } else { ws.put("FontType", "Custom"); } ws.put("NumberOfLetters", multigraphicTable.getRowCount()); for (int a = 0; a < multigraphicTable.getRowCount(); a++) { StringBuilder z = new StringBuilder(""); for (int b = 1; b < multigraphicTable.getColumnCount(); b++) { String q = multigraphicTable.getValueAt(a, b) + " "; z.append(q); } phonemes.put(multigraphicTable.getValueAt(a, 0), z); } ws.put("Phonemes", phonemes); } //if (punctuationSet){ HashMap punct = new HashMap(); for (int p = 0; p < punctuationTable.getRowCount(); p++) { punct.put(punctuationTable.getValueAt(p, 0) + "", punctuationTable.getValueAt(p, 1) + ""); // } ws.put("Punctuation", punct); } return ws; } } public void setWritingSystem(java.util.HashMap ws) { writingSystem = ws; } public int getChosenOption() { return chosenOption; } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { RwWritingSystemChooser dialog = new RwWritingSystemChooser(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { System.exit(0); } }); dialog.setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel Presets; private javax.swing.JScrollPane PresetsScroller; private javax.swing.JPanel abjadCard; private javax.swing.JLabel abjadCharLabel; private javax.swing.JPanel abjadCharLabelPanel; private javax.swing.JComboBox abjadConsonantGlyphNumberCombo; private javax.swing.JComboBox abjadConsonantUsedInCombo; private javax.swing.JLabel abjadConsonantUsedInLabel; private javax.swing.JLabel abjadCurrentVLabel; private javax.swing.JToggleButton abjadDirectionalityButton; private javax.swing.ButtonGroup abjadFontButtonGroup; private javax.swing.JTextField abjadFontField; private java.util.HashMap abjadGlyphUseMap; private javax.swing.JLabel abjadGlyphsPerConsonantLabel; private javax.swing.JSpinner abjadGlyphsPerConsonantSpinner; private javax.swing.JTextField abjadJumpToField; private javax.swing.JLabel abjadJumpToLabel; private javax.swing.JButton abjadLeftColumnButton; private javax.swing.JButton abjadRightColumnButton; private javax.swing.JScrollPane abjadScroller; private javax.swing.JTable abjadTable; private javax.swing.JCheckBox abjadVowelCarrierCheck; private javax.swing.JButton abugidaAutoFillButton; private javax.swing.JRadioButton abugidaBorrowedFontRadio; private javax.swing.JPanel abugidaCard; private javax.swing.JLabel abugidaCharLabel; private javax.swing.JButton abugidaChooseFontButton; private javax.swing.JLabel abugidaCurrentVLabel; private javax.swing.JRadioButton abugidaCustomFontRadio; private javax.swing.ButtonGroup abugidaDiacriticsButtonGroup; private javax.swing.JToggleButton abugidaDirectionalityButton; private javax.swing.JButton abugidaDownCharButton; private javax.swing.ButtonGroup abugidaFontButtonGroup; private javax.swing.JTextField abugidaFontField; private javax.swing.JLabel abugidaFontLabel; private javax.swing.JTextField abugidaJumpToField; private javax.swing.JLabel abugidaJumpToLabel; private javax.swing.JScrollPane abugidaScroller; private javax.swing.JTable abugidaTable; private javax.swing.JButton abugidaUpCharButton; private javax.swing.JLabel alphaCurrentVLabel; private java.util.HashMap alphaGlyphUseMap; private javax.swing.JLabel alphaGlyphsPerLetterLabel; private javax.swing.JSpinner alphaGlyphsPerLetterSpinner; private javax.swing.JTextField alphaJumpToField; private javax.swing.JLabel alphaJumpToLabel; private javax.swing.JButton alphaLeftColumnButton; private javax.swing.JComboBox alphaLetterGlyphNumberCombo; private javax.swing.JComboBox alphaLetterUsedInCombo; private javax.swing.JLabel alphaLetterUsedInLabel; private javax.swing.JButton alphaRightColumnButton; private javax.swing.JScrollPane alphaScroller; private javax.swing.JTable alphaTable; private javax.swing.ButtonGroup alphabetButtonGroup; private javax.swing.JPanel alphabetCard; private javax.swing.JButton autoFillSyllabaryButton; private javax.swing.JButton autofillAbjadButton; private javax.swing.JButton autofillAlphabetButton; private javax.swing.JRadioButton borrowedAbjadFontRadio; private javax.swing.JRadioButton borrowedCharsRadio; private javax.swing.JButton browse4WsButton; private javax.swing.JButton cancelButton; private javax.swing.JComboBox capitalizationCombo; private javax.swing.JLabel capitalizationLabel; private javax.swing.JLabel characterLabel; private javax.swing.JPanel characterLabelPanel; private javax.swing.JButton chooseAbjadFontButton; private javax.swing.JButton chooseAlphabetFontButton; private javax.swing.JComboBox consonantNumCombo; private javax.swing.JLabel consonantNumLabel; private javax.swing.JLabel currentHexValueLabel; private javax.swing.JRadioButton customAbjadFontRadio; private javax.swing.JRadioButton customFontRadio; private javax.swing.ButtonGroup diacriticsButtonGroup; private javax.swing.JToggleButton directionalityButton; private javax.swing.JButton downAbjadCharButton; private javax.swing.JButton downButton; private javax.swing.JButton downCharAbjadButton; private javax.swing.JButton downCharAbugidaButton; private javax.swing.JButton downCharButton; private javax.swing.JButton downPageAbjadButton; private javax.swing.JButton downPageAbugidaButton; private javax.swing.JButton downPageButton; private javax.swing.JTextField fontField; private javax.swing.JLabel fontLabel; private javax.swing.JLabel graphemesPerGlyphLabel; private javax.swing.JSpinner graphemesPerGlyphSpinner; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JTextField jumpToField; private javax.swing.JLabel jumpToLabel; private javax.swing.JButton loadWsButton; private javax.swing.ButtonGroup mainButtonGroup; private javax.swing.JButton multiAutoFillButton; private javax.swing.JRadioButton multiBorrowedRadio; private javax.swing.JLabel multiCharacterLabel; private javax.swing.JButton multiChooseCustomFontButton; private javax.swing.JTextField multiCustomFontField; private javax.swing.JRadioButton multiCustomRadio; private javax.swing.JButton multiDownButton; private javax.swing.JButton multiDownButton1; private javax.swing.JButton multiDownCharButton; private javax.swing.JButton multiDownPageButton; private javax.swing.JTextField multiJumpToField; private javax.swing.JLabel multiJumpToLabel; private javax.swing.JButton multiLeftGlyphButton; private javax.swing.JButton multiRightGlyphButton; private javax.swing.JButton multiSetGlyphButton; private javax.swing.JButton multiUpCharButton; private javax.swing.JButton multiUpGlyphButton; private javax.swing.JButton multiUpPageButton; private javax.swing.JCheckBox multiUseEndersCheckbox; private javax.swing.JPanel multigraphicCard; private javax.swing.ButtonGroup multigraphicFontGroup; private javax.swing.JLabel multigraphicFontLabel; private javax.swing.JScrollPane multigraphicScroller; private javax.swing.JTable multigraphicTable; private javax.swing.JCheckBox noVowelCheckbox; private javax.swing.JButton okButton; private java.util.Vector presets; private javax.swing.JTable presetsTable; private javax.swing.JButton punctAutoFillButton; private javax.swing.JPanel punctCharPanel; private javax.swing.JLabel punctCharacterLabel; private javax.swing.JLabel punctCurrentHexValueLabel; private javax.swing.JButton punctDownCharButton; private javax.swing.JTextField punctJumpToField; private javax.swing.JLabel punctJumpToLabel; private javax.swing.JButton punctSetGlyphButton; private javax.swing.JPanel punctSpacerPanel; private javax.swing.JPanel punctSpacerPanel1; private javax.swing.JButton punctUpCharButton; private javax.swing.JButton punctUpGlyphButton; private javax.swing.JButton punctUpPageButton; private javax.swing.JButton punctiDownPageButton; private javax.swing.JPanel punctuationCard; private javax.swing.JScrollPane punctuationScroller; private javax.swing.JTable punctuationTable; private javax.swing.JButton saveWsButton; private javax.swing.JButton setAbjadCharButton; private javax.swing.JButton setAbugidaCharButton; private javax.swing.JButton setAlphaCharButton; private javax.swing.JButton setSyllableButton; private javax.swing.JPanel syllabaryCard; private javax.swing.JLabel syllabaryCharValueLabel; private javax.swing.JButton syllabaryChooseCustomFontButton; private javax.swing.JCheckBox syllabaryCustomFontCheck; private javax.swing.JTextField syllabaryCustomFontField; private javax.swing.JToggleButton syllabaryDirectionalityButton; private javax.swing.JButton syllabaryDownCharButton; private javax.swing.JButton syllabaryDownPageButton; private javax.swing.JScrollPane syllabaryScroller; private javax.swing.JTable syllabaryTable; private javax.swing.JButton syllabaryUpCharButton; private javax.swing.JButton syllabaryUpPageButton; private rw.RwCellRenderer2 tcr2; private javax.swing.JButton upAbjadCharButton; private javax.swing.JButton upAbjadPageButton; private javax.swing.JButton upButton; private javax.swing.JButton upCharAbjadButton; private javax.swing.JButton upCharAbugidaButton; private javax.swing.JButton upCharButton; private javax.swing.JButton upPageAbugidaButton; private javax.swing.JButton upPageButton; private javax.swing.JButton useSystemButton; private javax.swing.JPanel userDefdCard; private javax.swing.JScrollPane userDefdScroller; private javax.swing.JTable userDefdTable; private javax.swing.JLabel visibleCharLabel; private javax.swing.JCheckBox vowelCarrierCheck; private javax.swing.JComboBox vowelNumCombo; private javax.swing.JLabel vowelNumLabel; private java.util.HashMap writingSystem; private java.awt.CardLayout writingSystemLayout; private javax.swing.JTabbedPane writingSystemPane; // End of variables declaration//GEN-END:variables private int chosenOption; public int OK_OPTION = 1; public int CANCEL_OPTION = 0; public boolean punctuationSet = false; public boolean wsLoaded = false; private Vector vows; private Vector cons; private File wsFile; }
true
ade7a75068c1eaaa3a29ec3855ad1832258aa3cd
Java
mino98/stix
/StixAgent/src/uk/ac/ed/inf/wimo/stix/agent/task/OSPF.java
UTF-8
1,027
2.1875
2
[ "MIT" ]
permissive
package uk.ac.ed.inf.wimo.stix.agent.task; import java.util.Hashtable; import java.util.Map; import org.apache.log4j.Logger; import uk.ac.ed.inf.wimo.stix.agent.device.Device; import uk.ac.ed.inf.wimo.stix.agent.device.drivers.GenericDeviceDriver; import uk.ac.ed.inf.wimo.stix.agent.device.operations.Routable; import uk.ac.ed.inf.wimo.stix.agent.engine.TaskException; import uk.ac.ed.inf.wimo.stix.agent.model.TaskInterface; public class OSPF implements TaskInterface { private static Logger log = Logger.getLogger(OSPF.class); public Map<String, String> runTask(Device device, Map<String, String> parameters) throws TaskException { GenericDeviceDriver driver = device.getDeviceDriver(); if (driver instanceof Routable) { ((Routable) driver).setOspf(parameters.get("IN")); } else { log.error("Cannot set OSPF to device " + device); throw new TaskException("Cannot set OSPF to device " + device); } Hashtable<String, String> returnMap = new Hashtable<String, String>(); return returnMap; } }
true
536c7a8790b0d2ce275a5827e78c07ad6c12fd40
Java
cloudsoft/brooklyn-tosca
/a4c-brooklyn-plugin/src/test/java/alien4cloud/brooklyn/util/ApplicationUtil.java
UTF-8
1,524
2.28125
2
[]
no_license
package alien4cloud.brooklyn.util; import java.io.IOException; import java.nio.file.Paths; import java.util.UUID; import javax.annotation.Resource; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import alien4cloud.application.ApplicationService; import alien4cloud.dao.ElasticSearchDAO; import alien4cloud.model.application.Application; import alien4cloud.model.topology.Topology; import alien4cloud.utils.YamlParserUtil; @Component @Slf4j public class ApplicationUtil { private static final String TOPOLOGIES_PATH = "src/test/resources/topologies/"; @Resource private ApplicationService applicationService; @Resource protected ElasticSearchDAO alienDAO; @SneakyThrows public Topology createAlienApplication(String applicationName, String topologyFileName) { Topology topology = parseYamlTopology(topologyFileName); String applicationId = applicationService.create("alien", applicationName, null, null); topology.setDelegateId(applicationId); topology.setDelegateType(Application.class.getSimpleName().toLowerCase()); alienDAO.save(topology); return topology; } private Topology parseYamlTopology(String topologyFileName) throws IOException { Topology topology = YamlParserUtil.parseFromUTF8File(Paths.get(TOPOLOGIES_PATH + topologyFileName + ".yaml"), Topology.class); topology.setId(UUID.randomUUID().toString()); return topology; } }
true
130013a34c6bf8892bba0ea3e17a8ad9a51f3823
Java
fcr/morphadorner-opensource
/src/edu/northwestern/at/utils/corpuslinguistics/postagger/regexp/RegexpTagger.java
UTF-8
5,045
3
3
[]
no_license
package edu.northwestern.at.utils.corpuslinguistics.postagger.regexp; /* Please see the license information at the end of this file. */ import java.util.*; import java.util.regex.*; import edu.northwestern.at.utils.corpuslinguistics.adornedword.*; import edu.northwestern.at.utils.corpuslinguistics.postagger.*; import edu.northwestern.at.utils.corpuslinguistics.postagger.unigram.*; import edu.northwestern.at.utils.corpuslinguistics.tokenizer.*; /** Regular Expression Part of Speech tagger. * * <p> * The regular expression part of speech tagger uses a * regular expressions to assign a part of speech tag to a spelling. * </p> */ public class RegexpTagger extends UnigramTagger implements PartOfSpeechTagger, CanTagOneWord { /** Parts of speech for each lexical rule. */ protected Pattern[] regexpPatterns; protected Matcher[] regexpMatchers; protected String[] regexpTags; /** Create a suffix tagger. */ public RegexpTagger() { } /** See if tagger uses lexical rules. * * @return True since this tagger uses regular expression based * lexical rules. */ public boolean usesLexicalRules() { return true; } /** Set lexical rules for tagging. * * @param lexicalRules String array of lexical rules. * * @throws InvalidRuleException if a rule is bad. * * <p> * For the regular expression tagger, each rule takes the form: * </p> * * <blockquote> * <p> * <code> * regular-expression \t part-of-speech-tag * </code> * </p> * </blockquote> * * <p> * where "regular expression" is the regular expression * and "part-of-speech-tag" is the part of speech tag to * assign to a spelling matched by the regular expression. * An ascii tab character (\t) separates the pattern from * the tag. * </p> */ public void setLexicalRules( String[] lexicalRules ) throws InvalidRuleException { this.regexpPatterns = new Pattern[ lexicalRules.length ]; this.regexpMatchers = new Matcher[ lexicalRules.length ]; this.regexpTags = new String[ lexicalRules.length ]; for ( int i = 0 ; i < lexicalRules.length ; i++ ) { String[] tokens = lexicalRules[ i ].split( "\t" ); this.regexpPatterns[ i ] = Pattern.compile( tokens[ 0 ] ); this.regexpMatchers[ i ] = this.regexpPatterns[ i ].matcher( "" ); this.regexpTags[ i ] = tokens[ 1 ]; } } /** Tag a single word. * * @param word The word. * * @return The part of speech for the word. * * <p> * Applies each of the regular expressions stored in the lexical * rules lexicon and returns the tag of associated with the first * matching regular expression. * </p> */ public String tagWord( String word ) { String result = ""; // Try each regular expression in turn. for ( int i = 0 ; i < regexpMatchers.length ; i++ ) { regexpMatchers[ i ].reset( word ); if ( regexpMatchers[ i ].find() ) { result = regexpTags[ i ]; break; } } return result; } /** Return tagger description. * * @return Tagger description. */ public String toString() { return "Regular expression tagger"; } } /* Copyright (c) 2008, 2009 by Northwestern University. All rights reserved. Developed by: Academic and Research Technologies Northwestern University http://www.it.northwestern.edu/about/departments/at/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with 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 following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * Neither the names of Academic and Research Technologies, Northwestern University, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. 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 CONTRIBUTORS 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 WITH THE SOFTWARE. */
true