svnno****@sourc*****
svnno****@sourc*****
2009年 6月 22日 (月) 03:41:11 JST
Revision: 3433 http://sourceforge.jp/projects/jiemamy/svn/view?view=rev&revision=3433 Author: happy_ryo Date: 2009-06-22 03:41:11 +0900 (Mon, 22 Jun 2009) Log Message: ----------- 初期インポート Added Paths: ----------- sandbox/nekotter/nb-configuration.xml sandbox/nekotter/nbactions.xml sandbox/nekotter/pom.xml sandbox/nekotter/src/ sandbox/nekotter/src/main/ sandbox/nekotter/src/main/java/ sandbox/nekotter/src/main/java/org/ sandbox/nekotter/src/main/java/org/jiemamy/ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterAction.java sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.form sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.java sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigOptionsPanelController.java sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.form sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.java sandbox/nekotter/src/main/nbm/ sandbox/nekotter/src/main/nbm/manifest.mf sandbox/nekotter/src/main/nbm/module.xml sandbox/nekotter/src/main/resources/ sandbox/nekotter/src/main/resources/org/ sandbox/nekotter/src/main/resources/org/jiemamy/ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/Bundle.properties sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentSettings.xml sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentWstcref.xml sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/layer.xml sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/Bundle.properties sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/config/ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/config/Bundle.properties sandbox/nekotter/src/test/ sandbox/nekotter/src/test/java/ sandbox/nekotter/src/test/java/org/ sandbox/nekotter/src/test/java/org/jiemamy/ sandbox/nekotter/src/test/java/org/jiemamy/nekotter/ sandbox/nekotter/src/test/java/org/jiemamy/nekotter/deleteme.txt Property Changed: ---------------- sandbox/nekotter/ -------------- next part -------------- Property changes on: sandbox/nekotter ___________________________________________________________________ Added: svn:ignore + target Added: sandbox/nekotter/nb-configuration.xml =================================================================== --- sandbox/nekotter/nb-configuration.xml (rev 0) +++ sandbox/nekotter/nb-configuration.xml 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,20 @@ +<?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. +--> + <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width> + <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>8</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size> + <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>default</org-netbeans-modules-editor-indent.CodeStyle.usedProfile> + </properties> +</project-shared-configuration> Added: sandbox/nekotter/pom.xml =================================================================== --- sandbox/nekotter/pom.xml (rev 0) +++ sandbox/nekotter/pom.xml 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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>org.jiemamy</groupId> + <artifactId>nekotter</artifactId> + <packaging>nbm</packaging> + <version>1.0</version> + <name>nekotter</name> + + <repositories> + <!-- this is a remote repository hosting the netbeans api artifacts. + the versions of the artifacts are netbeans IDE release based, eg. RELEASE41, RELEASE50. + You might want to use your own repository. To create one, use the nbm:populate-repository goal. + --> + <repository> + <id>netbeans</id> + <name>repository hosting netbeans.org api artifacts</name> + <url>http://deadlock.netbeans.org/maven2</url> + </repository> + </repositories> + + <description>Twit only plugin.</description> + + <dependencies> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-util</artifactId> + <version>RELEASE60</version> + </dependency> + <dependency> + <groupId>net.homeip.yusuke</groupId> + <artifactId>twitter4j</artifactId> + <version>2.0.0</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-windows</artifactId> + <version>RELEASE60</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-openide-awt</artifactId> + <version>RELEASE60</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-jdesktop-layout</artifactId> + <version>RELEASE60</version> + </dependency> + <dependency> + <groupId>net.java.dev.swing-layout</groupId> + <artifactId>swing-layout</artifactId> + <version>1.0.2</version> + </dependency> + <dependency> + <groupId>org.netbeans.api</groupId> + <artifactId>org-netbeans-modules-options-api</artifactId> + <version>RELEASE60</version> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>nbm-maven-plugin</artifactId> + <version>2.6.2</version> + <extensions>true</extensions> + <configuration> + <descriptor>src/main/nbm/module.xml</descriptor> + </configuration> + </plugin> + + <!-- netbeans modules in 5.5+ are 1.5 compatible --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>1.5</source> + <target>1.5</target> + <encoding>${project.build.sourceEncoding}</encoding> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>2.2</version> + <configuration> + <encoding>${project.build.sourceEncoding}</encoding> + </configuration> + </plugin> + </plugins> + </build> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> Added: sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterAction.java =================================================================== --- sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterAction.java (rev 0) +++ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterAction.java 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.jiemamy.nekotter.window; + +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import org.openide.util.NbBundle; +import org.openide.windows.TopComponent; + +/** + * Action which shows Nekotter component. + */ +public class NekotterAction extends AbstractAction { + /** + * コンストラクタ + */ + public NekotterAction() { + super(NbBundle.getMessage(NekotterAction.class, "CTL_NekotterAction")); +// putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage(NekotterTopComponent.ICON_PATH, true))); + } + + public void actionPerformed(ActionEvent evt) { + TopComponent win = NekotterTopComponent.findInstance(); + win.open(); + win.requestActive(); + } +} Added: sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.form =================================================================== --- sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.form (rev 0) +++ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.form 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,103 @@ +<?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="2"/> + <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"/> + <Component id="jPanel1" max="32767" attributes="0"/> + <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="jPanel1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel1"> + <Properties> + <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> + <Color blue="cc" green="cc" red="cc" type="rgb"/> + </Property> + </Properties> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="2" max="-2" attributes="0"/> + <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="btnPost" min="-2" max="-2" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jScrollPane1" min="-2" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="35" max="-2" attributes="0"/> + <Component id="btnPost" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JScrollPane" name="jScrollPane1"> + <AuxValues> + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> + </AuxValues> + + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> + <SubComponents> + <Component class="javax.swing.JTextArea" name="txtPost"> + <Properties> + <Property name="columns" type="int" value="20"/> + <Property name="rows" type="int" value="5"/> + </Properties> + </Component> + </SubComponents> + </Container> + <Component class="javax.swing.JButton" name="btnPost"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/jiemamy/nekotter/window/Bundle.properties" key="NekotterTopComponent.btnPost.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="btnPostActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> + </SubComponents> +</Form> Added: sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.java =================================================================== --- sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.java (rev 0) +++ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/NekotterTopComponent.java 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,220 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.jiemamy.nekotter.window; + +import java.io.Serializable; +import java.util.logging.Logger; +import java.util.prefs.PreferenceChangeEvent; +import java.util.prefs.PreferenceChangeListener; +import java.util.prefs.Preferences; +import org.jiemamy.nekotter.window.config.ConfigOptionsPanelController; +import org.openide.util.NbBundle; +import org.openide.util.NbPreferences; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; +import twitter4j.Twitter; +import twitter4j.TwitterException; +//import org.openide.util.Utilities; + +/** + * Top component which displays something. + */ +final class NekotterTopComponent extends TopComponent { + + private static Twitter twitter; + private static NekotterTopComponent instance; + private static Preferences pref; + /** 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 = "NekotterTopComponent"; + + private NekotterTopComponent() { + initComponents(); + setName(NbBundle.getMessage(NekotterTopComponent.class, "CTL_NekotterTopComponent")); + setToolTipText(NbBundle.getMessage(NekotterTopComponent.class, "HINT_NekotterTopComponent")); +// setIcon(Utilities.loadImage(ICON_PATH, true)); + if (pref == null) { + pref = NbPreferences.forModule(ConfigOptionsPanelController.class); + } + String user = pref.get("twitter_id", ""); + String pass = pref.get("twitter_pw", ""); + + pref.addPreferenceChangeListener(new PreferenceChangeListener() { + + public void preferenceChange(PreferenceChangeEvent evt) { + if (evt.getKey().equals("twitter_id")) { + twitter.setUserId(evt.getNewValue()); + } else if (evt.getKey().equals("twitter_pw")) { + twitter.setPassword(evt.getNewValue()); + } + txtPost.setText(""); + verify(); + } + }); + + if (twitter == null) { + twitter = new Twitter(user, pass); + } + verify(); + } + + /** 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() { + + jPanel1 = new javax.swing.JPanel(); + jScrollPane1 = new javax.swing.JScrollPane(); + txtPost = new javax.swing.JTextArea(); + btnPost = new javax.swing.JButton(); + + jPanel1.setForeground(new java.awt.Color(204, 204, 204)); + + txtPost.setColumns(20); + txtPost.setRows(5); + jScrollPane1.setViewportView(txtPost); + + org.openide.awt.Mnemonics.setLocalizedText(btnPost, org.openide.util.NbBundle.getMessage(NekotterTopComponent.class, "NekotterTopComponent.btnPost.text")); // NOI18N + btnPost.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnPostActionPerformed(evt); + } + }); + + org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout.createSequentialGroup() + .add(2, 2, 2) + .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(btnPost) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout.createSequentialGroup() + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(jPanel1Layout.createSequentialGroup() + .add(35, 35, 35) + .add(btnPost))) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void btnPostActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPostActionPerformed + try { + twitter.update(txtPost.getText()); + txtPost.setText(""); + } catch (TwitterException ex) { + txtPost.setText("Post失敗するっす。"); + } + }//GEN-LAST:event_btnPostActionPerformed + + private void auth() { + } + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnPost; + private javax.swing.JPanel jPanel1; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextArea txtPost; + // 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 NekotterTopComponent getDefault() { + if (instance == null) { + instance = new NekotterTopComponent(); + } + return instance; + } + + /** + * Obtain the NekotterTopComponent instance. Never call {@link #getDefault} directly! + */ + public static synchronized NekotterTopComponent findInstance() { + TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID); + if (win == null) { + Logger.getLogger(NekotterTopComponent.class.getName()).warning( + "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system."); + return getDefault(); + } + if (win instanceof NekotterTopComponent) { + return (NekotterTopComponent) win; + } + Logger.getLogger(NekotterTopComponent.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() { + } + + @Override + public void componentClosed() { + } + + /** replaces this in object stream */ + @Override + public Object writeReplace() { + return new ResolvableHelper(); + } + + @Override + protected String preferredID() { + return PREFERRED_ID; + } + + final static class ResolvableHelper implements Serializable { + + private static final long serialVersionUID = 1L; + + public Object readResolve() { + return NekotterTopComponent.getDefault(); + } + } + + private void verify() { + try { + twitter.verifyCredentials(); + } catch (TwitterException ex) { + txtPost.setText("認証失敗するっす。"); + } + } +} Added: sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigOptionsPanelController.java =================================================================== --- sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigOptionsPanelController.java (rev 0) +++ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigOptionsPanelController.java 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.jiemamy.nekotter.window.config; + +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import javax.swing.JComponent; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; + +/** + * コンフィグパネルのコントローラー + * @author happy_ryo + */ +public final class ConfigOptionsPanelController extends OptionsPanelController { + + private ConfigPanel panel; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private boolean changed; + + public void update() { + getPanel().load(); + changed = false; + } + + public void applyChanges() { + getPanel().store(); + changed = false; + } + + public void cancel() { + // need not do anything special, if no changes have been persisted yet + } + + public boolean isValid() { + return getPanel().valid(); + } + + public boolean isChanged() { + return changed; + } + + public HelpCtx getHelpCtx() { + return null; // new HelpCtx("...ID") if you have a help set + } + + public JComponent getComponent(Lookup masterLookup) { + return getPanel(); + } + + public void addPropertyChangeListener(PropertyChangeListener l) { + pcs.addPropertyChangeListener(l); + } + + public void removePropertyChangeListener(PropertyChangeListener l) { + pcs.removePropertyChangeListener(l); + } + + private ConfigPanel getPanel() { + if (panel == null) { + panel = new ConfigPanel(this); + } + return panel; + } + + void changed() { + if (!changed) { + changed = true; + pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + } + pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + } +} Added: sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.form =================================================================== --- sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.form (rev 0) +++ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.form 2009-06-21 18:41:11 UTC (rev 3433) @@ -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="2"/> + <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"> + <Component id="jPanel1" alignment="0" max="32767" attributes="0"/> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jPanel1" min="-2" max="-2" attributes="0"/> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Container class="javax.swing.JPanel" name="jPanel1"> + <Properties> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> + <TitledBorder title="ねこった〜"> + <ResourceString PropertyName="titleX" bundle="org/jiemamy/nekotter/window/config/Bundle.properties" key="ConfigPanel.jPanel1.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </TitledBorder> + </Border> + </Property> + </Properties> + + <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"> + <Component id="jLabel1" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="txtTwitterPw" pref="454" max="32767" attributes="0"/> + <Component id="txtTwitterId" alignment="0" pref="454" max="32767" attributes="0"/> + </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"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="txtTwitterId" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace type="separate" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="txtTwitterPw" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/jiemamy/nekotter/window/config/Bundle.properties" key="ConfigPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/jiemamy/nekotter/window/config/Bundle.properties" key="ConfigPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="txtTwitterId"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/jiemamy/nekotter/window/config/Bundle.properties" key="ConfigPanel.txtTwitterId.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="txtTwitterPw"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/jiemamy/nekotter/window/config/Bundle.properties" key="ConfigPanel.txtTwitterPw.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + </SubComponents> + </Container> + </SubComponents> +</Form> Added: sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.java =================================================================== --- sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.java (rev 0) +++ sandbox/nekotter/src/main/java/org/jiemamy/nekotter/window/config/ConfigPanel.java 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,107 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package org.jiemamy.nekotter.window.config; + +import org.openide.util.NbPreferences; + +final class ConfigPanel extends javax.swing.JPanel { + + private final ConfigOptionsPanelController controller; + + ConfigPanel(ConfigOptionsPanelController controller) { + this.controller = controller; + initComponents(); + // TODO listen to changes in form fields and call controller.changed() + } + + /** 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() { + + jPanel1 = new javax.swing.JPanel(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + txtTwitterId = new javax.swing.JTextField(); + txtTwitterPw = new javax.swing.JTextField(); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ConfigPanel.class, "ConfigPanel.jPanel1.border.title"))); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ConfigPanel.class, "ConfigPanel.jLabel1.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(ConfigPanel.class, "ConfigPanel.jLabel2.text")); // NOI18N + + txtTwitterId.setText(org.openide.util.NbBundle.getMessage(ConfigPanel.class, "ConfigPanel.txtTwitterId.text")); // NOI18N + + txtTwitterPw.setText(org.openide.util.NbBundle.getMessage(ConfigPanel.class, "ConfigPanel.txtTwitterPw.text")); // NOI18N + + org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel1) + .add(jLabel2)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(txtTwitterPw, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE) + .add(txtTwitterId, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel1) + .add(txtTwitterId, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(18, 18, 18) + .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(txtTwitterPw, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel2)) + .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + ); + }// </editor-fold>//GEN-END:initComponents + + void load() { + txtTwitterId.setText(NbPreferences.forModule(ConfigPanel.class).get("twitter_id", "")); + txtTwitterPw.setText(NbPreferences.forModule(ConfigPanel.class).get("twitter_pw", "")); + + } + + void store() { + NbPreferences.forModule(ConfigPanel.class).put("twitter_id", txtTwitterId.getText()); + NbPreferences.forModule(ConfigPanel.class).put("twitter_pw", txtTwitterPw.getText()); + } + + boolean valid() { + return true; + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JPanel jPanel1; + private javax.swing.JTextField txtTwitterId; + private javax.swing.JTextField txtTwitterPw; + // End of variables declaration//GEN-END:variables +} Added: sandbox/nekotter/src/main/nbm/manifest.mf =================================================================== --- sandbox/nekotter/src/main/nbm/manifest.mf (rev 0) +++ sandbox/nekotter/src/main/nbm/manifest.mf 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +OpenIDE-Module-Localizing-Bundle: org/jiemamy/nekotter/Bundle.properties +OpenIDE-Module-Layer: org/jiemamy/nekotter/layer.xml Added: sandbox/nekotter/src/main/nbm/module.xml =================================================================== --- sandbox/nekotter/src/main/nbm/module.xml (rev 0) +++ sandbox/nekotter/src/main/nbm/module.xml 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,15 @@ +<nbm> + <!--moduleType>autoload</moduleType--> + <!--codeNameBase>org.jiemamy.nekotter/1</codeNameBase--> + <!-- the cluster where you want the module to be located. --> + <!--cluster>mycluster1</cluster--> + <manifest>src/main/nbm/manifest.mf</manifest> + <!-- base url of the autoupdate center (where the nbm will be located --> + <!--distributionUrl>http://myorg.org/autoupdate</distributionUrl--> + <licenseName>Apache License, Version 2.0</licenseName> + <licenseFile>license.txt</licenseFile> + <!--dependencies that are not part of existing module, you need to include as part of this module --> + <!--libraries> + <library>jdom:jdom</library> + </libraries--> +</nbm> \ No newline at end of file Added: sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/Bundle.properties =================================================================== --- sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/Bundle.properties (rev 0) +++ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/Bundle.properties 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,2 @@ +# Sample ResourceBundle properties file +OpenIDE-Module-Display-Category=Twitter Added: sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentSettings.xml =================================================================== --- sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentSettings.xml (rev 0) +++ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentSettings.xml 2009-06-21 18:41:11 UTC (rev 3433) @@ -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="org.jiemamy.nekotter" spec="1.0"/> + <instanceof class="org.openide.windows.TopComponent"/> + <instanceof class="org.jiemamy.nekotter.window.NekotterTopComponent"/> + <instance class="org.jiemamy.nekotter.window.NekotterTopComponent" method="getDefault"/> +</settings> Added: sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentWstcref.xml =================================================================== --- sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentWstcref.xml (rev 0) +++ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/NekotterTopComponentWstcref.xml 2009-06-21 18:41:11 UTC (rev 3433) @@ -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="org.jiemamy.nekotter" spec="1.0"/> + <tc-id id="NekotterTopComponent"/> + <state opened="false"/> +</tc-ref> Added: sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/layer.xml =================================================================== --- sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/layer.xml (rev 0) +++ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/layer.xml 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd"> +<filesystem> + + <folder name="Actions"> + <folder name="Window"> + <file name="org-jiemamy-nekotter-window-NekotterAction.instance"/> + </folder> + </folder> + <folder name="Menu"> + <folder name="Window"> + <file name="NekotterAction.shadow"> + <attr name="originalFile" stringvalue="Actions/Window/org-jiemamy-nekotter-window-NekotterAction.instance"/> + </file> + </folder> + </folder> + <folder name="OptionsDialog"> + <folder name="Advanced"> + <file name="org-jiemamy-nekotter-window-config-ConfigAdvancedOption.instance"> + <attr name="controller" newvalue="org.jiemamy.nekotter.window.config.ConfigOptionsPanelController"/> + <attr name="displayName" bundlevalue="org.jiemamy.nekotter.window.config.Bundle#AdvancedOption_DisplayName_Config"/> + <attr name="instanceCreate" methodvalue="org.netbeans.spi.options.AdvancedOption.createSubCategory"/> + <attr name="keywords" bundlevalue="org.jiemamy.nekotter.window.config.Bundle#AdvancedOption_Keywords_Config"/> + <attr name="keywordsCategory" stringvalue="Advanced/null"/> + <attr name="toolTip" bundlevalue="org.jiemamy.nekotter.window.config.Bundle#AdvancedOption_Tooltip_Config"/> + </file> + </folder> + </folder> + <folder name="Windows2"> + <folder name="Components"> + <file name="NekotterTopComponent.settings" url="NekotterTopComponentSettings.xml"/> + </folder> + <folder name="Modes"> + <folder name="properties"> + <file name="NekotterTopComponent.wstcref" url="NekotterTopComponentWstcref.xml"/> + </folder> + </folder> + </folder> +</filesystem> Added: sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/Bundle.properties =================================================================== --- sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/Bundle.properties (rev 0) +++ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/Bundle.properties 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,4 @@ +CTL_NekotterAction=Nekotter +CTL_NekotterTopComponent=Nekotter \u30A6\u30A3\u30F3\u30C9\u30A6 +HINT_NekotterTopComponent=\u3053\u308C\u306F Nekotter \u30A6\u30A3\u30F3\u30C9\u30A6\u3067\u3059 +NekotterTopComponent.btnPost.text=POST Added: sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/config/Bundle.properties =================================================================== --- sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/config/Bundle.properties (rev 0) +++ sandbox/nekotter/src/main/resources/org/jiemamy/nekotter/window/config/Bundle.properties 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1,8 @@ +AdvancedOption_DisplayName_Config=\u306D\u3053\u3063\u305F\u301C +AdvancedOption_Keywords_Config=nekotter +AdvancedOption_Tooltip_Config=\u306D\u3053\u3063\u305F\u301C +ConfigPanel.jPanel1.border.title=\u306D\u3053\u3063\u305F\u301C +ConfigPanel.jLabel1.text=ID +ConfigPanel.jLabel2.text=Pass +ConfigPanel.txtTwitterId.text= +ConfigPanel.txtTwitterPw.text= Added: sandbox/nekotter/src/test/java/org/jiemamy/nekotter/deleteme.txt =================================================================== --- sandbox/nekotter/src/test/java/org/jiemamy/nekotter/deleteme.txt (rev 0) +++ sandbox/nekotter/src/test/java/org/jiemamy/nekotter/deleteme.txt 2009-06-21 18:41:11 UTC (rev 3433) @@ -0,0 +1 @@ +Just delete me. \ No newline at end of file