From 7e81377ec29b5440847151d0355026d6a9d7c067 Mon Sep 17 00:00:00 2001 From: "uims.com" Date: Tue, 29 May 2012 10:46:22 +0000 Subject: [PATCH] --- hello.client.gui/.classpath | 8 ++ hello.client.gui/.project | 23 ++++ .../.settings/org.eclipse.jdt.core.prefs | 6 + .../.settings/org.maven.ide.eclipse.prefs | 8 ++ hello.client.gui/pom.xml | 58 ++++++++++ .../hello/client/gui/SpellCheckerGui.java | 108 ++++++++++++++++++ .../src/main/resources/metadata.xml | 11 ++ .../target/hello.client.gui-1.0.0.jar | Bin 0 -> 6653 bytes 8 files changed, 222 insertions(+) create mode 100644 hello.client.gui/.classpath create mode 100644 hello.client.gui/.project create mode 100644 hello.client.gui/.settings/org.eclipse.jdt.core.prefs create mode 100644 hello.client.gui/.settings/org.maven.ide.eclipse.prefs create mode 100644 hello.client.gui/pom.xml create mode 100644 hello.client.gui/src/main/java/ipojo/example/hello/client/gui/SpellCheckerGui.java create mode 100644 hello.client.gui/src/main/resources/metadata.xml create mode 100644 hello.client.gui/target/hello.client.gui-1.0.0.jar diff --git a/hello.client.gui/.classpath b/hello.client.gui/.classpath new file mode 100644 index 00000000..df370c06 --- /dev/null +++ b/hello.client.gui/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/hello.client.gui/.project b/hello.client.gui/.project new file mode 100644 index 00000000..bc505ef5 --- /dev/null +++ b/hello.client.gui/.project @@ -0,0 +1,23 @@ + + + hello.client.gui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/hello.client.gui/.settings/org.eclipse.jdt.core.prefs b/hello.client.gui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..d28b004d --- /dev/null +++ b/hello.client.gui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +#Tue May 29 10:20:53 CST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hello.client.gui/.settings/org.maven.ide.eclipse.prefs b/hello.client.gui/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 00000000..14b7aea9 --- /dev/null +++ b/hello.client.gui/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Tue May 29 10:20:52 CST 2012 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/hello.client.gui/pom.xml b/hello.client.gui/pom.xml new file mode 100644 index 00000000..476e4dfe --- /dev/null +++ b/hello.client.gui/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + + iPOJOTutorial + hello.client.gui + 1.0.0 + bundle + + hello.client.gui + http://maven.apache.org + + + UTF-8 + + + + + iPOJOTutorial + hello.service + 1.0.0 + + + junit + junit + 3.8.1 + test + + + + + + org.apache.felix + maven-bundle-plugin + 1.4.3 + true + + + ${pom.artifactId} + ipojo.example.hello.client.gui + + + + + org.apache.felix + maven-ipojo-plugin + 1.2.0 + + + + ipojo-bundle + + + + + + + diff --git a/hello.client.gui/src/main/java/ipojo/example/hello/client/gui/SpellCheckerGui.java b/hello.client.gui/src/main/java/ipojo/example/hello/client/gui/SpellCheckerGui.java new file mode 100644 index 00000000..b030f080 --- /dev/null +++ b/hello.client.gui/src/main/java/ipojo/example/hello/client/gui/SpellCheckerGui.java @@ -0,0 +1,108 @@ +package ipojo.example.hello.client.gui; + +import ipojo.example.hello.SpellChecker; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JTextField; + +/** + * A very simple Gui interacting with the CheckSpeller service + */ +public class SpellCheckerGui extends JFrame { + /** + * Swing component where the user write the passage to check. + */ + private JTextField m_passage = null; + + /** + * Check button + */ + private JButton m_checkButton = null; + + /** + * Area where the result is displayed. + */ + private JLabel m_result = null; + /** + * Service dependency on the SpellChecker. + */ + private SpellChecker m_checker; + + /** + * Constructor. Initialize the GUI. + */ + public SpellCheckerGui() { + super(); + initComponents(); + this.setTitle("Spellchecker Gui"); + } + + /** + * Initialize the Swing Gui. + */ + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + m_checkButton = new javax.swing.JButton(); + m_result = new javax.swing.JLabel(); + m_passage = new javax.swing.JTextField(); + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); // Stop + // Felix + getContentPane().setLayout(new java.awt.GridBagLayout()); + m_checkButton.setText("Check"); + m_checkButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + check(); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); + getContentPane().add(m_checkButton, gridBagConstraints); + m_result.setPreferredSize(new java.awt.Dimension(175, 20)); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); + getContentPane().add(m_result, gridBagConstraints); + m_passage.setPreferredSize(new java.awt.Dimension(175, 20)); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); + getContentPane().add(m_passage, gridBagConstraints); + pack(); + } + + /** + * Check Button action. Collects the user input and checks it. + */ + private void check() { + String[] result = m_checker.check(m_passage.getText()); + if (result != null) { + m_result.setText(result.length + " word(s) are mispelled"); + } else { + m_result.setText("All words are correct"); + } + } + + /** + * Start callback. This method will be called when the instance becomes + * valid. It set the Gui visibility to true. + */ + public void start() { + this.setVisible(true); + } + + /** + * Stop callback. This method will be called when the instance becomes + * invalid or stops. It deletes the Gui. + */ + public void stop() { + this.dispose(); + } +} \ No newline at end of file diff --git a/hello.client.gui/src/main/resources/metadata.xml b/hello.client.gui/src/main/resources/metadata.xml new file mode 100644 index 00000000..097bbb97 --- /dev/null +++ b/hello.client.gui/src/main/resources/metadata.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/hello.client.gui/target/hello.client.gui-1.0.0.jar b/hello.client.gui/target/hello.client.gui-1.0.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..d6b58c85656439f78fba24d3e2e187e9db61f2b1 GIT binary patch literal 6653 zcmbW51z1#D*T;upK)Q1XK|vZpknV1f5^1D!hHg+&8l+pgkro(`?vm~jltw~A1bpH3 zdhwR;cfWO>nR(`!{r|6h&RMh0-ajQ-cn}@{>FP+)Y!m|g6nFp-Kwex`m`Pee;=a7F zg0zIViYl|b#APo45Ee5GnPI`|T#P!sU5vC7qyYz-NpK;GAjhq4%E)U~-3A1n5}QsMLFYBE z-gkgkai`L$CFD?Y)K{q@8}Mf`Xo@P$?&9Sdu{~`hJ)g<0>~=Nq6eF$qD&=3VW*Yor z$1XUFHWrCfS~4Y#0ky1h{gG9B9LzhP&CAieAoc}6MLzq|*5H9VYN={k*=60cyXdw) z+nU8f!%Zn0MrKaBZjjG)T(l>qYI-{sWnmRe%PVqO?4eISWT%-FM^${;Q zEB2_MsiXN{+%9RyN_?+eBCcM1|Jn@-v1W$a zL7>KV4(7)8=so2qzARXPcl?pwTu@Bu<_sT|K;;aLd_m|YF=n{fNcLD0WbrJCM7&qS z%>RpDjBg8kd}_Z$s~+2AEee@3yktpI0S@0D$Qy2r2Lh|{-?9WkQYSY>zYNeF4{8`z zqi~O}ygfcA4YVz!HkKGhv0p}yKS)m%d-=qVjsTb5@(BLs{z*+ z;Nk!4uqFv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