[Bluemusic-commits] SF.net SVN: bluemusic:[4195] blue/trunk/blue-ui-core/src/blue/ui/core
Brought to you by:
kunstmusik
From: <kun...@us...> - 2010-04-02 23:16:53
|
Revision: 4195 http://bluemusic.svn.sourceforge.net/bluemusic/?rev=4195&view=rev Author: kunstmusik Date: 2010-04-02 23:16:46 +0000 (Fri, 02 Apr 2010) Log Message: ----------- initial work on MIDI input panel Added Paths: ----------- blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml blue/trunk/blue-ui-core/src/blue/ui/core/midi/ blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java Added: blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentSettings.xml 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +To change this template, choose Tools | Templates +and open the template in the editor. +--> +<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd"> +<settings version="1.0"> + <module name="blue.ui.core" spec="1.0"/> + <instanceof class="org.openide.windows.TopComponent"/> + <instanceof class="blue.ui.core.midi.MidiInputPanelTopComponent"/> + <instance class="blue.ui.core.midi.MidiInputPanelTopComponent" method="getDefault"/> +</settings> Added: blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/MidiInputPanelTopComponentWstcref.xml 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +To change this template, choose Tools | Templates +and open the template in the editor. +--> +<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd"> +<tc-ref version="2.0" > + <module name="blue.ui.core" spec="1.0"/> + <tc-id id="MidiInputPanelTopComponent"/> + <state opened="false"/> +</tc-ref> Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/Bundle.properties 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,6 @@ +CTL_MidiInputPanelAction=MidiInputPanel +CTL_MidiInputPanelTopComponent=MidiInputPanel Window +HINT_MidiInputPanelTopComponent=This is a MidiInputPanel window +MidiInputPanelTopComponent.jRadioButton1.text=Instrument +MidiInputPanelTopComponent.jRadioButton2.text=Custom Note Template +MidiInputPanelTopComponent.jTextField1.text=jTextField1 Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.form 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> + <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="true"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> + <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" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jComboBox2" alignment="0" pref="194" max="32767" attributes="0"/> + <Component id="jRadioButton1" min="-2" max="-2" attributes="0"/> + <Component id="jRadioButton2" alignment="0" min="-2" max="-2" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="21" pref="21" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" max="-2" attributes="0"> + <Component id="jTextField1" max="32767" attributes="0"/> + <Component id="jComboBox1" alignment="1" min="-2" pref="173" max="-2" attributes="1"/> + </Group> + </Group> + </Group> + <EmptySpace max="-2" 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"/> + <Component id="jComboBox2" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jRadioButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jComboBox1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jRadioButton2" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jTextField1" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="166" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JRadioButton" name="jRadioButton1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jRadioButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JRadioButton" name="jRadioButton2"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jRadioButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jRadioButton2ActionPerformed"/> + </Events> + </Component> + <Component class="javax.swing.JComboBox" name="jComboBox1"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="blue/ui/core/midi/Bundle.properties" key="MidiInputPanelTopComponent.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="jComboBox2"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jComboBox2ActionPerformed"/> + </Events> + </Component> + </SubComponents> +</Form> Added: blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java =================================================================== --- blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java (rev 0) +++ blue/trunk/blue-ui-core/src/blue/ui/core/midi/MidiInputPanelTopComponent.java 2010-04-02 23:16:46 UTC (rev 4195) @@ -0,0 +1,188 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package blue.ui.core.midi; + +import java.util.logging.Logger; +import org.openide.util.NbBundle; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; +//import org.openide.util.ImageUtilities; +import org.netbeans.api.settings.ConvertAsProperties; + +/** + * Top component which displays something. + */ +@ConvertAsProperties(dtd = "-//blue.ui.core.midi//MidiInputPanel//EN", +autostore = false) +public final class MidiInputPanelTopComponent extends TopComponent { + + private static MidiInputPanelTopComponent instance; + + /** path to the icon used by the component and its open action */ +// static final String ICON_PATH = "SET/PATH/TO/ICON/HERE"; + private static final String PREFERRED_ID = "MidiInputPanelTopComponent"; + + public MidiInputPanelTopComponent() { + initComponents(); + setName(NbBundle.getMessage(MidiInputPanelTopComponent.class, "CTL_MidiInputPanelTopComponent")); + setToolTipText(NbBundle.getMessage(MidiInputPanelTopComponent.class, "HINT_MidiInputPanelTopComponent")); +// setIcon(ImageUtilities.loadImage(ICON_PATH, true)); + + } + + /** 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. + */ + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents + private void initComponents() { + + jRadioButton1 = new javax.swing.JRadioButton(); + jRadioButton2 = new javax.swing.JRadioButton(); + jComboBox1 = new javax.swing.JComboBox(); + jTextField1 = new javax.swing.JTextField(); + jComboBox2 = new javax.swing.JComboBox(); + + org.openide.awt.Mnemonics.setLocalizedText(jRadioButton1, org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jRadioButton1.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jRadioButton2, org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jRadioButton2.text")); // NOI18N + jRadioButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jRadioButton2ActionPerformed(evt); + } + }); + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + + jTextField1.setText(org.openide.util.NbBundle.getMessage(MidiInputPanelTopComponent.class, "MidiInputPanelTopComponent.jTextField1.text")); // NOI18N + + jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + jComboBox2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox2ActionPerformed(evt); + } + }); + + 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) + .addComponent(jComboBox2, 0, 194, Short.MAX_VALUE) + .addComponent(jRadioButton1) + .addComponent(jRadioButton2) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jTextField1) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jRadioButton1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jRadioButton2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(166, Short.MAX_VALUE)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jRadioButton2ActionPerformed + + private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jComboBox2ActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox jComboBox1; + private javax.swing.JComboBox jComboBox2; + private javax.swing.JRadioButton jRadioButton1; + private javax.swing.JRadioButton jRadioButton2; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables + /** + * Gets default instance. Do not use directly: reserved for *.settings files only, + * i.e. deserialization routines; otherwise you could get a non-deserialized instance. + * To obtain the singleton instance, use {@link #findInstance}. + */ + public static synchronized MidiInputPanelTopComponent getDefault() { + if (instance == null) { + instance = new MidiInputPanelTopComponent(); + } + return instance; + } + + /** + * Obtain the MidiInputPanelTopComponent instance. Never call {@link #getDefault} directly! + */ + public static synchronized MidiInputPanelTopComponent findInstance() { + TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + if (win == null) { + Logger.getLogger(MidiInputPanelTopComponent.class.getName()).warning( + "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system."); + return getDefault(); + } + if (win instanceof MidiInputPanelTopComponent) { + return (MidiInputPanelTopComponent) win; + } + Logger.getLogger(MidiInputPanelTopComponent.class.getName()).warning( + "There seem to be multiple components with the '" + PREFERRED_ID + + "' ID. That is a potential source of errors and unexpected behavior."); + return getDefault(); + } + + @Override + public int getPersistenceType() { + return TopComponent.PERSISTENCE_ALWAYS; + } + + @Override + public void componentOpened() { + // TODO add custom code on component opening + } + + @Override + public void componentClosed() { + // TODO add custom code on component closing + } + + void writeProperties(java.util.Properties p) { + // better to version settings since initial version as advocated at + // http://wiki.apidesign.org/wiki/PropertyFiles + p.setProperty("version", "1.0"); + // TODO store your settings + } + + Object readProperties(java.util.Properties p) { + if (instance == null) { + instance = this; + } + instance.readPropertiesImpl(p); + return instance; + } + + private void readPropertiesImpl(java.util.Properties p) { + String version = p.getProperty("version"); + // TODO read your settings according to their version + } + + @Override + protected String preferredID() { + return PREFERRED_ID; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |