Commit ba6cd6b5 by Jessica Hawkwell

Fixed things that weren't working

Added IPA chart for reference
1 parent 60feb6a0
Pipeline #192 passed
in 17 seconds
......@@ -12,7 +12,9 @@ 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;
......@@ -23,7 +25,9 @@ import javax.swing.UnsupportedLookAndFeelException;
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;
......@@ -224,30 +228,56 @@ 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());
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;
for ( a = 0; a < desktop.getTabCount(); a++ ) {
log.debug("Tab Index: ".concat(String.valueOf(a)));
c = desktop.getComponent(a);
if ( c == null ) {
log.error("Component at ".concat(String.valueOf(a)).concat(" does not exist!"));
}
else {
log.debug(c.getClass().getName());
if ( t.equals(c.getName()) ) { return; }
}
}
if ( plugin.hasWindow() ) {
JPanel jp = plugin.getPanel();
jp.setName(t);
desktop.addTab(plugin.getDisplayName(), plugin.getPanel());
}
}
});
desktopMenu.addButton(button);
needShowWindow = false;
}
if ( plugin.hasToolBar() ) {
jTabbedPane.addTab(plugin.getDisplayName(), plugin.getToolBar());
JToolBar jt = plugin.getToolBar();
jt.setName("plugin.".concat(plugin.getName()));
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("plugin.".concat(plugin.getName()));
desktop.addTab(plugin.getDisplayName(), jp);
}
}
@Override public void start() {
......
......@@ -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) {}
}
......@@ -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) {
......
No preview for this file type
package me.felinewith.lang_toolkit.plugins.ipa_helper;
import java.awt.Color;
import java.awt.GridLayout;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import me.felinewith.lang_toolkit.library.IStrappedPlugin;
import me.felinewith.lang_toolkit.plugins.ipa_helper.util.IPAHelperListener;
/**
*
......@@ -11,6 +17,7 @@ import me.felinewith.lang_toolkit.library.IStrappedPlugin;
*/
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);
......@@ -18,9 +25,40 @@ public class IPAHelper extends IStrappedPlugin {
jButton = new JButton(icon);
jButton.setName(getName());
jButton.setToolTipText(getDisplayName());
ipahl = new IPAHelperListener();
jButton.setActionCommand("IPAHelper");
GridLayout gl = new GridLayout(8, 11);
jPanel = new JPanel(gl);
JPanel pt;
// bilabial plosives
jPanel.add(makeLetterPanel(new String[]{"p", "b"}));
jPanel.add(makeLetterPanel());
jPanel.add(makeLetterPanel());
jPanel.add(makeLetterPanel(new String[]{"t", "d"}));
}
@Override public String getName() { return "IPAHelper"; }
@Override public String getDisplayName() { return "IPA Helper"; }
@Override public void getActionCommand(String command) {
}
private JPanel makeLetterPanel() { return makeLetterPanel(null, null); }
private JPanel makeLetterPanel(String[] letters) { return makeLetterPanel(letters, null); }
private JPanel makeLetterPanel(String[] letters, Color background) {
JPanel pt = new JPanel();
pt.setBorder(BorderFactory.createLineBorder(Color.BLACK));
if ( background == null ) { pt.setBackground(Color.WHITE); }
else { pt.setBackground(background); }
if ( letters != null ) {
for ( String s : letters ) { pt.add(new JLabel(s)); }
}
return pt;
}
}
<?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
}
/*
* 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.util;
import me.felinewith.lang_toolkit.library.actions.ActionHandle;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!