Commit c75e3f4a by Jessica Hawkwell

Merge branch 'ipahelper' into 'master'

Ipahelper

See merge request !5
2 parents 63c12f4a 68ee2262
Pipeline #198 passed
in 3 minutes 34 seconds
Showing with 1177 additions and 49 deletions
......@@ -402,7 +402,7 @@ public class BootstrapClassLoader extends ClassLoader
}
log.info("Added Jar ".concat(pt));
}
catch ( IOException x ) {}
catch ( IOException | NullPointerException x ) {}
}
}
}
......
......@@ -12,18 +12,21 @@ import java.net.URL;
import java.util.HashMap;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JToolBar;
import javax.swing.JTree;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import me.felinewith.lang_toolkit.apps.langbuilder.util.UIHelper;
import me.felinewith.lang_toolkit.apps.langbuilder.window.WindowUnifiedListener;
import me.felinewith.lang_toolkit.library.IStrappedApp;
import me.felinewith.lang_toolkit.library.IStrappedPlugin;
import me.felinewith.lang_toolkit.library.actions.ActionHandle;
import me.felinewith.lang_toolkit.library.actions.ListenAttach;
import me.felinewith.lang_toolkit.library.actions.UnifiedListener;
import me.felinewith.lang_toolkit.library.helpers.ConfigHelper;
import me.felinewith.lang_toolkit.library.helpers.DesktopMenu;
import org.apache.commons.configuration2.Configuration;
......@@ -62,38 +65,25 @@ public final class LangBuilder implements IStrappedApp {
log = LogManager.getLogger();
boolean usingNimbus = false;
try {
for ( UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) {
if ( info.getName().equals("Nimbus") ) {
UIManager.setLookAndFeel(info.getClassName());
usingNimbus = true;
}
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
}
UIHelper.init();
if ( !usingNimbus ) {
try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
}
}
//StringBuilder sb = new StringBuilder();
if ( log.isDebugEnabled() ) {
UIManager.getDefaults().entrySet().spliterator().forEachRemaining((t) -> {
StringBuilder sb;
sb = new StringBuilder();
sb.append(t.getKey());
/*if ( log.isDebugEnabled() ) {
UIManager.getDefaults().entrySet().forEach((t) -> {
StringBuilder sb = new StringBuilder("UID\t");
sb.append(t.getKey().toString());
sb.append("\t");
sb.append(t.getValue());
sb.append(t.getValue().toString());
log.debug(sb.toString());
});
}
log.debug(UIManager.getLookAndFeel().getName());
UIManager.getLookAndFeelDefaults().entrySet().forEach((t) -> {
StringBuilder sb = new StringBuilder("LAF\t");
sb.append(t.getKey().toString());
sb.append("\t");
sb.append(t.getValue().toString());
log.debug(sb.toString());
});
} // */
// configuration!
log.info("[Desktop] Setting up configuration...");
StringBuilder sb = new StringBuilder(System.getProperty("user.home"));
......@@ -224,35 +214,70 @@ public final class LangBuilder implements IStrappedApp {
@Override public Configuration getConfig() { return config; }
@Override public void registerPlugin(IStrappedPlugin plugin) {
@Override public void registerPlugin(final IStrappedPlugin plugin) {
plugin.init();
plugins.put(plugin.getName(), plugin);
StringBuilder sb = new StringBuilder(plugin.getName());
sb.append("\t");
sb.append(plugin.hasButton());
sb.append("\t");
sb.append(plugin.hasToolBar());
sb.append("\t");
sb.append(plugin.hasWindow());
log.debug(sb.toString());
}
@Override public void start() {
plugins.forEach((name, plugin) -> {
final String t = "plugin.".concat(name);
boolean needShowWindow = true;
if ( plugin.hasButton() ) {
desktopMenu.addButton(plugin.getButton());
JButton button = plugin.getButton();
button.addActionListener(new UnifiedListener() {
@Override public void handleEvent(ActionHandle action) {
int a = 0;
String t = "plugin.".concat(plugin.getName());
Component c;
JPanel jp;
for ( a = 0; a < desktop.getTabCount(); a++ ) {
log.debug("Tab Index: ".concat(String.valueOf(a)));
c = desktop.getComponentAt(a);
if ( c == null ) {
log.error("Component at ".concat(String.valueOf(a)).concat(" does not exist!"));
}
else if (c instanceof JPanel) {
jp = (JPanel) c;
log.debug(jp.getName());
if ( t.equals(jp.getName()) ) {
desktop.setSelectedIndex(a);
return;
}
}
}
if ( plugin.hasWindow() ) {
jp = plugin.getPanel();
jp.setName(t);
desktop.addTab(plugin.getDisplayName(), jp);
}
}
});
desktopMenu.addButton(button);
needShowWindow = false;
}
if ( plugin.hasToolBar() ) {
jTabbedPane.addTab(plugin.getDisplayName(), plugin.getToolBar());
JToolBar jt = plugin.getToolBar();
jt.setName(t);
jTabbedPane.addTab(plugin.getDisplayName(), jt);
needShowWindow = false;
}
if ( needShowWindow && plugin.hasWindow() ) { desktop.addTab(plugin.getDisplayName(), plugin.getPanel()); }
if ( needShowWindow && plugin.hasWindow() ) {
JPanel jp = plugin.getPanel();
jp.setName(t);
desktop.addTab(plugin.getDisplayName(), jp);
}
});
@Override public void start() {
jFrame.pack();
jFrame.setVisible(true);
}
}
......@@ -15,8 +15,7 @@ public class WelcomeWindow extends IStrappedPlugin {
private JEditorPane viewer;
@Override public void init() {
jPanel = new JPanel();
jPanel.setLayout(new BorderLayout());
jPanel = new JPanel(new BorderLayout(5, 5));
viewer = new JEditorPane();
jPanel.add(viewer);
......@@ -32,6 +31,6 @@ public class WelcomeWindow extends IStrappedPlugin {
viewer.setText(vh.generate(null, hm));
}
@Override public String getName() { return "WelconeWindow"; }
@Override public String getName() { return "WelcomeWindow"; }
@Override public String getDisplayName() { return "Welcome!"; }
}
package me.felinewith.lang_toolkit.apps.langbuilder.util;
import java.util.Map.Entry;
import java.util.function.Consumer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.InsetsUIResource;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author jlhawkwell
*/
public class UIHelper {
private static Logger log;
public static void init() {
if ( log == null ) { log = LogManager.getLogger(); }
boolean usingNimbus = false;
try {
for ( UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) {
if ( info.getName().equals("Nimbus") ) {
UIManager.setLookAndFeel(info.getClassName());
usingNimbus = true;
}
}
}
catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
}
if ( !usingNimbus ) {
try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
UnsupportedLookAndFeelException ex) {
}
}
//FontUIResource font = new FontUIResource("Allerta Regular", 0, 14);
setUIDefaults();
}
public static void runHelper(Consumer<? super Entry<Object, Object>> action) {
if ( log == null ) { log = LogManager.getLogger(); }
UIManager.getDefaults().entrySet().forEach(action);
UIManager.getLookAndFeelDefaults().entrySet().forEach(action);
}
private static void setUIDefaults() {
runHelper((t) -> {
if ( t.getValue() instanceof FontUIResource ) {
FontUIResource value = (FontUIResource) t.getValue();
FontUIResource font = new FontUIResource(value.getFontName(), value.getStyle(), value.getSize() + 2);
t.setValue(font);
if ( log.isDebugEnabled() ) { log.debug("Setting default font on ".concat(t.getKey().toString())); }
}
else if ( t.getKey().toString().startsWith("Label") && (t.getValue() instanceof InsetsUIResource) ) {
InsetsUIResource inset = (InsetsUIResource) t.getValue();
int i = 2;
inset.set(i, i, i, i);
t.setValue(inset);
}
});
}
private UIHelper() { log = LogManager.getLogger(); }
}
......@@ -95,4 +95,9 @@ public abstract class IStrappedPlugin {
* @return The stored or created (if overridden) {@link JPanel}
*/
public JPanel getPanel() { return jPanel; }
/**
* Allows you to receive events from your JButton.
*/
public void getActionCommand(String command) {}
}
package me.felinewith.lang_toolkit.library;
import org.apache.commons.configuration2.Configuration;
/**
*
* @author jlhawkwell
*/
public abstract class ILangPlugin {
protected Configuration project;
public abstract int hasFile();
public abstract String getFileName();
}
......@@ -78,7 +78,7 @@ public class DesktopMenu {
public void addComponent(Component component) {
if ( component.getName() == null ) { return; }
addComponent(component.getName(), component, false);
addComponent(component.getName(), component, true);
}
public void addComponent(String name, Component component) { addComponent(name, component, false); }
private void addComponent(String name, Component component, boolean addListens) {
......
<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
The configuration is intended to be shared among all the users of project and
therefore it is assumed to be part of version control checkout.
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
-->
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
<!--
Properties that influence various parts of the IDE, especially code formatting and the like.
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
That way multiple projects can share the same settings (useful for formatting rules for example).
Any value defined here will override the pom.xml file value but is only applicable to the current project.
-->
<netbeans.compile.on.save>none</netbeans.compile.on.save>
</properties>
</project-shared-configuration>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.felinewith.lang-toolkit.library</groupId>
<artifactId>libservices</artifactId>
<packaging>jar</packaging>
<name>LangBuilder Services</name>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2017</inceptionYear>
<description>Services for the LangBuilder Desktop.</description>
<parent>
<groupId>me.felinewith</groupId>
<artifactId>lang-toolkit</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>me.felinewith.lang-toolkit.library</groupId>
<artifactId>libbootstrap</artifactId>
</dependency>
</dependencies>
</project>
package me.felinewith.lang_toolkit.library;
import javax.swing.JComponent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author jlhawkwell
*/
public abstract class ILangService<T> {
protected Logger log;
public void serviceInit() { log = LogManager.getLogger(); }
public abstract void serviceInit(T t);
public abstract boolean canAttach();
public abstract void attachComponent(JComponent component);
}
package me.felinewith.lang_toolkit.library;
/**
*
* @author jlhawkwell
*/
public class LangServices {
}
<html>
<head>
<title>${page_title}</title>
</head>
<body>
<h2>${page_title}</h2>
<hr>
#include(${main_template})
</body>
</html>
No preview for this file type
No preview for this file type
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.Border;
import me.felinewith.lang_toolkit.library.IStrappedPlugin;
import me.felinewith.lang_toolkit.plugins.ipa_helper.util.IPAHelperListener;
import org.apache.commons.lang.WordUtils;
/**
*
* @author jlhawkwell
*/
public class IPAHelper extends IStrappedPlugin {
private IPAHelperListener ipahl;
@Override public void init() {
URL location = IPAHelper.class.getResource("/org/freedesktop/tango/22x22/apps/internet-group-chat.png");
ImageIcon icon = new ImageIcon(location);
jButton = new JButton(icon);
jButton.setName(getName());
jButton.setToolTipText(getDisplayName());
ipahl = new IPAHelperListener();
jButton.setActionCommand("IPAHelper");
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(charter(
new String[]{"BILABIAL", "LABIODENTAL", "DENTAL", "ALVEOLAR", "POSTALVEOLAR", "RETROFLEX",
"LABIALPALATAL", "ALVEOLOPALATAL", "LABIALVELAR", "VELAR", "UVULAR", "PHARYNGEAL",
"EPIGLOTTAL", "GLOTTAL"},
new String[]{"PLOSIVE", "IMPLOSIVE", "EJECTIVE", "NASAL", "TRILL", "TAPFLAP", "LATERAL_FLAP",
"FRICATIVE", "LATERAL_FRICATIVE", "EJECTIVE_FRICATIVE", "EJECTIVE_LATERAL_FRICATIVE",
"PERCUSSIVE", "APPROXIMANT", "LATERAL_APPROXIMANT", "CLICK", "LATERAL_CLICK"},
true
));
panel.add(charter(
new String[]{"FRONT", "NEAR_FRONT", "CENTRAL", "NEAR_BACK", "BACK"},
new String[]{"CLOSE", "NEAR_CLOSE", "CLOSE_MID", "MID", "OPEN_MID", "NEAR_OPEN", "OPEN"},
false
));
JScrollPane jsp = new JScrollPane(panel,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jPanel = new JPanel(new BorderLayout(5, 5));
jPanel.add(jsp);
}
@Override public String getName() { return "IPAHelper"; }
@Override public String getDisplayName() { return "IPA Helper"; }
@Override public void getActionCommand(String command) {
}
private JPanel textWrapper(String text) { return textWrapper(text, false); }
private JPanel textWrapper(String text, boolean boxLayout) {
JPanel panel = new JPanel();
panel.add(new JLabel(text));
if ( boxLayout ) { panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); }
return panel;
}
private JPanel charter(String[] cols, String[] rows, boolean voice) {
GridLayout gl = new GridLayout(rows.length + 1, cols.length + 1);
JPanel panel = new JPanel(gl);
panel.setBorder(BorderFactory.createEtchedBorder());
panel.add(textWrapper(""));
IPANames n;
for ( String c : cols ) { panel.add(textWrapper(wordFix(c), true)); }
for ( String r : rows ) {
for ( String c : cols ) {
if ( cols[0].equals(c) ) { panel.add(textWrapper(wordFix(r), true)); }
n = null;
try { n = IPANames.valueOf(c.concat("_").concat(r)); }
catch ( IllegalArgumentException ex ) {}
if ( n == null ) { panel.add(textWrapper("")); }
else { panel.add(makeLetterPanel(n, voice)); }
}
}
JPanel outer = new JPanel();
outer.setLayout(new BoxLayout(outer, BoxLayout.X_AXIS));
outer.add(panel);
JPanel right = new JPanel();
right.setLayout(new BorderLayout());
outer.add(right);
return outer;
}
private JPanel makeLetterPanel(IPANames name, boolean voice) { return makeLetterPanel(name, voice, null); }
private JPanel makeLetterPanel(IPANames name, boolean voice, Color background) {
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
if ( !name.isBoth() ) { panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); }
if ( background == null ) { panel.setBackground(Color.WHITE); }
else { panel.setBackground(background); }
JLabel left = new JLabel(" ");
JLabel right = new JLabel(" ");
JPanel pleft = new JPanel();
JPanel pright = new JPanel();
pleft.add(left);
pright.add(right);
pleft.setBackground(panel.getBackground());
pright.setBackground(panel.getBackground());
if ( name.hasLeft()) { left.setText(name.getLeft()); }
if ( name.hasRight()) { right.setText(name.getRight()); }
StringBuilder leftTip = new StringBuilder();
StringBuilder rightTip = new StringBuilder();
if ( name.isBoth() ) {}
else if ( voice ) {
leftTip.append("Voiced ");
rightTip.append("Unvoiced ");
}
else {
leftTip.append("Unrounded ");
rightTip.append("Rounded ");
}
String pt = wordFix(name.toString());
leftTip.append(pt);
rightTip.append(pt);
if ( name.hasLeft()) {
nameHelper(name, left, pleft);
if ( name.getLeft().equals("\u2297") ) { leftTip.append("\n(\u2297 = No known Unicode symbol)"); }
toolTipHelper(leftTip.toString(), left, pleft);
pleft.setBorder(BorderFactory.createLineBorder(panel.getBackground(), 2));
}
if ( name.hasRight()) {
nameHelper(name, right, pright);
if ( name.getRight().equals("\u2297") ) { rightTip.append("\n(\u2297 = No known Unicode symbol)"); }
toolTipHelper(rightTip.toString(), right, pright);
pright.setBorder(BorderFactory.createLineBorder(panel.getBackground(), 2));
}
if ( name.isBoth() ) {
panel.add(left);
panel.setToolTipText(left.getToolTipText());
panel.setName(name.toString());
borderHelper(left, panel);
}
else {
if ( name.hasLeft() ) { borderHelper(left, pleft); }
if ( name.hasRight() ) { borderHelper(right, pright); }
panel.add(pleft);
panel.add(pright);
}
return panel;
}
private String wordFix(String input) { return WordUtils.capitalize(input.replaceAll("_", " ").toLowerCase()); }
private void borderHelper(JLabel label, JPanel panel) {
if ( panel.getBorder() == null ) {
panel.setBorder(BorderFactory.createLineBorder(panel.getBackground()));
}
Borderer b = new Borderer(panel);
label.addMouseListener(b);
panel.addMouseListener(b);
}
private void nameHelper(IPANames name, JComponent... comps) {
for ( JComponent comp : comps ) { comp.setName(name.toString()); }
}
private void toolTipHelper(String toolTip, JComponent... comps) {
for ( JComponent comp : comps ) { comp.setToolTipText(toolTip); }
}
private class Borderer implements MouseListener {
private final JPanel p;
private Border b;
Borderer(JPanel panel) {
p = panel;
b = panel.getBorder();
}
@Override public void mouseClicked(MouseEvent e) {}
@Override public void mousePressed(MouseEvent e) {}
@Override public void mouseReleased(MouseEvent e) {}
@Override public void mouseEntered(MouseEvent e) {
if ( b.equals(p.getBorder()) ) {
b = p.getBorder();
p.setBorder(BorderFactory.createLineBorder(Color.ORANGE, 2));
}
}
@Override public void mouseExited(MouseEvent e) {
if ( e.getComponent() instanceof JLabel ) { return; }
p.setBorder(b);
}
}
}
package me.felinewith.lang_toolkit.plugins.ipa_helper;
/**
*
* @author jlhawkwell
*/
public enum IPANameParts {
VOICED,
UNVOICED,
BILABIAL,
DENTAL,
ALVEOLAR,
POSTALVEOLAR,
RETROFLEX,
PALATAL,
LABIAL,
VELAR,
UVULAR,
PHARYNGEAL,
GLOTTAL,
PLOSIVE,
IMPLOSIVE,
EJECTIVE,
NASAL,
TRILL,
TAPFLAP,
FLAP,
FRICATIVE,
LATERAL,
PERCUSSIVE,
APPROXIMANT,
CLICK,
EPIGLOTTAL,
FRONT,
NEAR,
CENTRAL,
BACK,
CLOSE,
OPEN,
ROUNDED,
PRIMARYSTRESS,
SECONDARYSTRESS,
LONG,
HALF_LONG,
EXTRA_SHORT,
MINOR,
MAJOR,
SYLLABLEBREAK,
LINKING,
ASPIRATED,
MORE,
LESS,
ADVANCED,
RETRACTED,
CENTRALIZED,
SYLLABIC,
NON,
RHOTICITY,
BREATHY,
CREAKY,
LINGUOLABIAL,
LABIALIZED,
PALATALIZED,
VELARIZED,
PHARYNGEALIZED,
RAISED,
LOWERED,
TONGUEROOT,
APICAL,
LAMINAL,
NASALIZED,
RELEASE,
NOAUDIBLERELEASE,
EXTRA,
HIGH,
MID,
LOW,
DOWNSTEP,
UPSTEP,
RISING,
FALLING,
GLOBAL,
;
}
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.util.ArrayList;
/**
*
* @author jlhawkwell
*/
public enum IPANames {
// <editor-fold desc="Consonants">
// plosive
BILABIAL_PLOSIVE("\u0070", "\u0062"),
LABIODENTAL_PLOSIVE("\u0070\u032a", "\u0062\u032a"),
DENTAL_PLOSIVE("\u0074\u032a", "\u0064\u032a"),
ALVEOLAR_PLOSIVE("\u0074", "\u0064"),
RETROFLEX_PLOSIVE("\u0288", "\u0256"),
ALVEOLOPALATAL_PLOSIVE("\u0236", "\u0221"),
PALATAL_PLOSIVE("\u0063", "\u025f"),
LABIALVELAR_PLOSIVE("\u006b\u0361\u0070", "\u0261\u0361\u0062"),
VELAR_PLOSIVE("\u006b", "\u0261"),
UVULAR_PLOSIVE("\u0071", "\u0262"),
EPIGLOTTAL_PLOSIVE("\u02a1"),
GLOTTAL_PLOSIVE("\u0294"),
// implosive
BILABIAL_IMPLOSIVE("\u0253\u0325", "\u0253"),
DENTAL_IMPLOSIVE(null, "\u0257\u032a"),
ALVEOLAR_IMPLOSIVE(null, "\u0257"),
RETROFLEX_IMPLOSIVE(null, "\u1d91"),
PALATAL_IMPLOSIVE(null, "\u0284"),
VELAR_IMPLOSIVE(null, "\u0260"),
UVULAR_IMPLOSIVE(null, "\u029b"),
// ejective
BILABIAL_EJECTIVE("\u0070\u02bc"),
DENTAL_EJECTIVE("\u0074\u032a\u02bc"),
ALVEOLAR_EJECTIVE("\u0074\u02bc"),
RETROFLEX_EJECTIVE("\u0288\u02bc"),
PALATAL_EJECTIVE("\u0063\u02bc"),
VELAR_EJECTIVE("\u006b\u02bc"),
UVULAR_EJECTIVE("\u0071\u02bc"),
// nasal
BILABIAL_NASAL("\u006d\u0325", "\u006d"),
LABIODENTAL_NASAL("\u0271\u030a", "\u0271"),
DENTAL_NASAL("\u006e\u032a\u030a", "\u006e\u032a"),
ALVEOLAR_NASAL("\u006e\u0325", "\u006e"),
RETROFLEX_NASAL("\u0273\u030a", "\u0273"),
ALVEOLOPALATAL_NASAL(null, "\u0235"),
PALATAL_NASAL(null, "\u0272"),
LABIALVELAR_NASAL(null, "\u014b\u0361\u006d"),
VELAR_NASAL(null, "\u014b"),
UVULAR_NASAL(null, "\u0274"),
// trill
BILABIAL_TRILL(null, "\u0299"),
ALVEOLAR_TRILL("\u0072\u0325", "\u0072"),
RETROFLEX_TRILL(null, "\u027d\u0361\u0072"),
UVULAR_TRILL(null, "\u0280"),
EPIGLOTTAL_TRILL(null, "!?"),
// tap or flap
BILABIAL_TAPFLAP(null, "\u2c71\u031f"),
LABIODENTAL_TAPFLAP(null, "\u2c71"),
ALVEOLAR_TAPFLAP(null, "\u027e"),
RETROFLEX_TAPFLAP(null, "\u027d"),
EPIGLOTTAL_TAPFLAP(null, "!?"),
// lateral flap
ALVEOLAR_LATERAL_FLAP(null, "\u027a"),
RETROFLEX_LATERAL_FLAP(null, "!?"),
PALATAL_LATERAL_FLAP(null, "!?"),
VELAR_LATERAL_FLAP(null, "!?"),
// fricative
BILABIAL_FRICATIVE("\u0278", "\u03b2"),
LABIODENTAL_FRICATIVE("\u0066", "\u0076"),
DENTAL_FRICATIVE("\u03b8", "\u00f0"),
ALVEOLAR_FRICATIVE("\u0073", "\u007a"),
POSTALVEOLAR_FRICATIVE("\u0283", "\u0392"),
RETROFLEX_FRICATIVE("\u0282", "\u0290"),
ALVEOLOPALATAL_FRICATIVE("\u0255", "\u0291"),
PALATAL_FRICATIVE("\u0063\u0327", "\u029d"),
VELAR_FRICATIVE("\u0078", "\u0263"),
UVULAR_FRICATIVE("\u03c7", "\u0281"),
PHARYNGEAL_FRICATIVE("\u0127", "\u0295"),
EPIGLOTTAL_FRICATIVE("\u029c", "\u02a2"),
GLOTTAL_FRICATIVE("\u0068", "\u0266"),
// lateral fricative
ALVEOLAR_LATERAL_FRICATIVE("\u026c", "\u026e"),
RETROFLEX_LATERAL_FRICATIVE(null, "\ua78e"),
// ejective fricative
ALVEOLAR_EJECTIVE_FRICATIVE("\u0073\u02bc"),
POSTALVEOLAR_EJECTIVE_FRICATIVE("\u0283\u02bc"),
// ejective lateral fricative
ALVEOLAR_EJECTIVE_LATERAL_FRICATIVE("\u026c\u02bc"),
// percussive
BILABIAL_PERCUSSIVE("\u02ac", "\u02ac"),
DENTAL_PERCUSSIVE("\u02ad", "\u02ad"),
// approximant
BILABIAL_APPROXIMANT("\u03b2\u031e\u030a", "\u03b2\u031e"),
LABIODENTAL_APPROXIMANT("\u028b\u0325", "\u028b"),
DENTAL_APPROXIMANT(null, "\u00f0\u031e"),
ALVEOLAR_APPROXIMANT("\u0279\u0325", "\u0279"),
RETROFLEX_APPROXIMANT("\u027b\u030a", "\u027b"),
LABIALPALATAL_APPROXIMANT("\u0265\u030a", "\u0265"),
PALATAL_APPROXIMANT(null, "\u006a"),
LABIALVELAR_APPROXIMANT("\u028d", "\u0077"),
VELAR_APPROXIMANT(null, "\u0270"),
// lateral approximant
ALVEOLAR_LATERAL_APPROXIMANT("\u006c\u0325", "\u006c"),
RETROFLEX_LATERAL_APPROXIMANT(null, "\u026d"),
ALVEOLOPALATAL_LATERAL_APPROXIMANT(null, "\u0234"),
PALATAL_LATERAL_APPROXIMANT(null, "\u028e"),
VELAR_LATERAL_APPROXIMANT(null, "\u029f"),
// click consonant
BILABIAL_CLICK("\u0298", "\u0298"),
DENTAL_CLICK("\u01c0", "\u01c0"),
ALVEOLAR_CLICK("\u01c3", "\u01c3"),
POSTALVEOLAR_CLICK("\u01c3 / \u01c2", "\u01c3 / \u01c2"),
// lateral click
DENTAL_LATERAL_CLICK("\u01c1\u0296", "\u01c1\u0296"),
ALVEOLAR_LATERAL_CLICK("\u01c1", "\u01c1"),
// </editor-fold>
// <editor-fold desc="Vowels">
// close
FRONT_CLOSE("\u0069", "\u0079"),
CENTRAL_CLOSE("\u0268", "\u0289"),
BACK_CLOSE("\u026f", "\u0075"),
// near close
NEAR_FRONT_NEAR_CLOSE("\u026a", "\u028f"),
CENTRAL_NEAR_CLOSE("\u026a\u0308", "\u028a\u0308"),
NEAR_BACK_NEAR_CLOSE(null, "\u028a"),
// close mid
FRONT_CLOSE_MID("\u0065", "\u00f8"),
CENTRAL_CLOSE_MID("\u0258", "\u0275"),
BACK_CLOSE_MID("\u0264", "\u006f"),
// mid
CENTRAL_MID("\u0259", "\u0259"),
// open mid
FRONT_OPEN_MID("\u025b", "\u0153"),
CENTRAL_OPEN_MID("\u025c", "\u025e"),
BACK_OPEN_MID("\u028c", "\u0254"),
// near open
FRONT_NEAR_OPEN("\u00e6", "\u02e6"),
CENTRAL_NEAR_OPEN("\u0250", "\u0250"),
// open
FRONT_OPEN("\u0061", "\u0276"),
BACK_OPEN("\u0251", "\u0252"),
VOWEL_LENGTH_MARKER("\u02d0", "\u02d0"),
// </editor-fold>
;
private String v;
private String uv;
private IPANameParts[] parts;
private IPANames(String symbol, IPANameParts... ipaparts) {
v = symbol;
uv = null;
parts = ipaparts;
}
private IPANames(String voiced, String unvoiced, IPANameParts... ipaparts) {
v = voiced;
uv = unvoiced;
if ( (v != null) && v.equals("!?") ) { v = "\u2297"; }
if ( (uv != null) && uv.equals("!?") ) { uv = "\u2297"; }
if ( parts == null ) {
ArrayList<IPANameParts> list = new ArrayList<>();
IPANameParts ip;
String[] pt = toString().split("_");
for ( String s : pt ) {
switch ( s ) {
case "LABIODENTAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.DENTAL);
break;
case "LABIALPALATAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.PALATAL);
break;
case "ALVEOLOPALATAL":
list.add(IPANameParts.ALVEOLAR);
list.add(IPANameParts.PALATAL);
break;
case "LABIALVELAR":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.VELAR);
break;
default:
try {
ip = IPANameParts.valueOf(s);
if ( ip != null ) { list.add(ip); }
}
catch ( IllegalArgumentException ex ) {}
}
}
if ( !list.isEmpty() ) { parts = list.toArray(new IPANameParts[list.size()]); }
}
else { parts = ipaparts; }
}
public boolean hasLeft() { return (v != null); }
public boolean hasRight() { return (uv != null); }
public boolean hasVoiced() { return hasLeft(); }
public boolean hasUnvoiced() { return hasRight(); }
public boolean hasUnrounded() { return hasLeft(); }
public boolean hasRounded() { return hasRight(); }
public boolean hasBoth() {
if ( hasLeft() != hasRight() ) { return false; }
if ( hasLeft() && hasRight() ) { return true; }
return false;
}
public boolean isBoth() {
if ( hasLeft() != hasRight() ) { return false; }
if ( hasLeft() && hasRight() ) {
if ( v.equals(uv) ) { return true; }
}
return false;
}
public String getLeft() { return v; }
public String getRight() { return uv; }
public String getVoiced() { return v; }
public String getUnvoiced() { return uv; }
public String getUnrounded() { return v; }
public String getRounded() { return uv; }
public IPANameParts[] getNameParts() { return parts; }
}
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="178" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="256" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel1"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel2"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel3"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel4"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel5"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel6"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel7"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel8"/>
</Properties>
</Component>
</SubComponents>
</Form>
/*
* 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 me.felinewith.lang_toolkit.plugins.ipa_helper;
/**
*
* @author jlhawkwell
*/
public class NewJPanel extends javax.swing.JPanel {
/**
* Creates new form NewJPanel
*/
public NewJPanel() {
initComponents();
}
/**
* 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() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel1.setText("jLabel1");
jLabel2.setText("jLabel2");
jLabel3.setText("jLabel3");
jLabel4.setText("jLabel4");
jLabel5.setText("jLabel5");
jLabel6.setText("jLabel6");
jLabel7.setText("jLabel7");
jLabel8.setText("jLabel8");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel8)))
.addContainerGap(178, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8))
.addContainerGap(256, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
// End of variables declaration//GEN-END:variables
}
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.util.ArrayList;
import org.apache.logging.log4j.LogManager;
/**
*
* @author jlhawkwell
*/
public enum UnicodeNames {
// <editor-fold desc="Diacritics">
NON_VOICED("\u02f3", "\u0325"),
VOICED("\u02ec", "\u032c"),
ASPIRATED("\u02b0"),
MORE_ROUNDED(null, "\u0339"),
LESS_ROUNDED(null, "\u031c"),
ADVANCED("\u02d6", "\u031f"),
RETRACTED("\u02cd", "\u0320"),
CENTRALIZED(null, "\u0308"),
MID_CENTRALIZED("\u02df", "\u033d"),
SYLLABIC("\u02cc", "\u0329"),
NON_SYLLABIC(null, "\uu032f"),
RHOTICITY("\u02de"),
BREATHY_VOICED(null, "\u0324"),
CREAKY_VOICED("\u02f7", "\u0330"),
LINGUOLABIAL("\u02b7"),
PALATALIZED("\u02b2"),
VELARIZED("\u02e0"),
PHARYNGEALIZED("\u02e4"),
VELARIZED_PHARYNGEALIZED(null, "\u0334"),
RAISED("\u02d4", "\u031d"),
LOWERED("\u02d5", "\u031e"),
ADVANCED_TONGUEROOT(null, "\u0318"),
RETRACTED_TONGUEROOT(null, "\u0319"),
DENTAL(null, "\u032a"),
APICAL("\u02fd", "\u033a"),
LAMINAL(null, "\u033b"),
NASALIZED(null, "\u0303"),
NASAL_RELEASE("\u207f"),
LATERAL_RELEASE("\u02e1"),
NOAUDIBLERELEASE("\u02fa", "\u031a")
// </editor-fold>
;
private String m;
private String c;
private IPANameParts[] parts;
private UnicodeNames(String modifier, IPANameParts... ipaparts) {
m = modifier;
c = null;
parts = ipaparts;
}
private UnicodeNames(String modifier, String combining, IPANameParts... ipaparts) {
m = modifier;
c = combining;
if ( parts == null ) {
ArrayList<IPANameParts> list = new ArrayList<>();
IPANameParts ip;
String[] pt = toString().split("_");
for ( String s : pt ) {
switch ( s ) {
case "LABIODENTAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.DENTAL);
break;
case "LABIALPALATAL":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.PALATAL);
break;
case "ALVEOLOPALATAL":
list.add(IPANameParts.ALVEOLAR);
list.add(IPANameParts.PALATAL);
break;
case "LABIALVELAR":
list.add(IPANameParts.LABIAL);
list.add(IPANameParts.VELAR);
break;
default:
try {
ip = IPANameParts.valueOf(s);
if ( ip != null ) { list.add(ip); }
}
catch ( IllegalArgumentException ex ) {}
}
}
LogManager.getLogger().warn(toString());
if ( !list.isEmpty() ) { parts = list.toArray(new IPANameParts[list.size()]); }
}
else { parts = ipaparts; }
}
public boolean hasModifier() { return (m != null);}
public boolean hasCombining() { return (c != null); }
public boolean hasBoth() {
if ( hasModifier()!= hasCombining()) { return false; }
if ( hasModifier()&& hasCombining()) {
if ( m.equals(c) ) { return true; }
}
return false;
}
public String getModifier() { return m; }
public String getCombining() { return c; }
public IPANameParts[] getFunction() { return parts; }
}
package me.felinewith.lang_toolkit.plugins.ipa_helper.util;
import me.felinewith.lang_toolkit.library.actions.ActionHandle;
import me.felinewith.lang_toolkit.library.actions.UnifiedListener;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
/**
*
* @author jlhawkwell
*/
public class IPAHelperListener extends UnifiedListener {
@Override public void handleEvent(ActionHandle action) {
Logger log = LogManager.getLogger();
log.debug("IPAHelperListener", action);
}
}
......@@ -76,9 +76,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<modules>
<module>library/libbootstrap</module>
<module>library/liblangbuilder</module>
<module>library/libservices</module>
<module>apps/bootstrap</module>
<module>apps/langbuilder</module>
<module>plugins/ipa-helper</module>
</modules>
<organization>
......@@ -175,6 +178,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ma
<artifactId>liblangbuilder</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>me.felinewith.lang-toolkit.library</groupId>
<artifactId>libservices</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!