Skip to content

Instantly share code, notes, and snippets.

View ajfmo's full-sized avatar
🎯
Focusing

Adrian Flores ajfmo

🎯
Focusing
View GitHub Profile
@ajfmo
ajfmo / Dao.java
Created March 12, 2018 12:33 — forked from james-d/Dao.java
Business model and data integration tier for the laboratory information management system. See also https://gist.github.com/james-d/e485ac525c71e20bb453
package edu.marshall.genomics.lims.data;
import java.util.List;
import edu.marshall.genomics.lims.entities.Investigator;
import edu.marshall.genomics.lims.entities.Project;
import edu.marshall.genomics.lims.entities.Sample;
public interface Dao {
public List<Investigator> getAllInvestigators() throws DaoException ;
@ajfmo
ajfmo / EditCell.java
Created February 20, 2018 12:14 — forked from james-d/EditCell.java
(Fairly) reusable edit cell that commits on loss of focus on the text field. Overriding the commitEdit(...) method is difficult to do without relying on knowing the default implementation, which I had to do here. The test code includes a key handler on the table that initiates editing on a key press.
import javafx.event.Event;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TablePosition;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
@ajfmo
ajfmo / .gitignore
Created February 16, 2018 15:16 — forked from chhh/.gitignore
.gitignore file for IDEA, Eclipse, NetBeans
#
# Project specific excludes
#
tomcat
#
# Default excludes
#
import java.util.List;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.hibernate.Session;
import org.hibernate.Transaction;
import ajfmo.inventario.entities.Deposito;
@ajfmo
ajfmo / HibernateUtil.java
Created February 16, 2018 12:56
Hibernate singleton class
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
public class HibernateUtil {
private static SessionFactory factory;
private static StandardServiceRegistry registry;
@ajfmo
ajfmo / Productos.java
Last active February 16, 2018 00:34
Entity with annotations and JavaFX Properties
package ajfmo.inventario.entities;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@ajfmo
ajfmo / Deposito.java
Last active February 16, 2018 00:32
Entity bean with JavaFX properties
package ajfmo.inventario.entities;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@ajfmo
ajfmo / Investigator.java
Created February 15, 2018 18:11 — forked from james-d/Investigator.java
Example of JPA entities that use JavaFX properties. These use a "super-lazy" idiom for instantiating the properties, and implement Externalizable to work around the lack of Serialization support in the FX property classes.
package edu.marshall.genomics.lims.entities;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.DatePicker?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
-- phpMyAdmin SQL Dump
-- version 4.7.5
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 15-02-2018 a las 16:14:41
-- Versión del servidor: 5.7.17-log
-- Versión de PHP: 5.6.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";