Permalink
Browse files

formatka edycji osoby

  • Loading branch information...
1 parent aec1096 commit bd80efddba3bcddbc6f997224919bc65f7f1423e @ertwroc committed Aug 14, 2009
Showing with 97 additions and 1 deletion.
  1. +2 −1 META-INF/MANIFEST.MF
  2. +16 −0 plugin.xml
  3. +79 −0 src/gusiatko/forms/OsobaForm.java
View
@@ -6,6 +6,7 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Activator: gusiatko.Activator
Bundle-Vendor: ert i art
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime
+ org.eclipse.core.runtime,
+ org.eclipse.ui.forms;bundle-version="3.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
View
@@ -26,5 +26,21 @@
</action>
</actionSet>
</extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ allowMultiple="false"
+ category="Gusiatko.mainCategory"
+ class="gusiatko.forms.OsobaForm"
+ icon="icons/sample.gif"
+ id="Gusiatko.personForm"
+ name="Osoba Form"
+ restorable="true">
+ </view>
+ <category
+ id="Gusiatko.mainCategory"
+ name="Gusiatko">
+ </category>
+ </extension>
</plugin>
@@ -0,0 +1,79 @@
+package gusiatko.forms;
+
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.part.ViewPart;
+
+public class OsobaForm extends ViewPart{
+ private FormToolkit toolkit;
+ private Form form;
+ @Override
+ public void createPartControl(Composite parent) {
+ toolkit = new FormToolkit(parent.getDisplay());
+ form = toolkit.createForm(parent);
+ Section sectionOsoba = createOsobaPart();
+ Section sectionUzytkownik = createUzytkownikPart();
+ GridLayoutFactory.fillDefaults().numColumns(1).generateLayout(sectionOsoba);
+ GridLayoutFactory.fillDefaults().numColumns(1).generateLayout(sectionUzytkownik);
+ GridLayoutFactory.fillDefaults().numColumns(1).generateLayout(form.getBody());
+ }
+ private Section createOsobaPart(){
+ Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION
+ | Section.EXPANDED | Section.TITLE_BAR | Section.TWISTIE);
+ section.setText("Osoba");
+ section.setDescription("Dane osoby");
+
+ Composite client = toolkit.createComposite(section, SWT.WRAP);
+
+ Label imieLabel = toolkit.createLabel(client, "Imię");
+ Text imieText = toolkit.createText(client, "", SWT.BORDER);
+
+ Label nazwiskoLabel = toolkit.createLabel(client, "Nazwisko");
+ Text nazwiskoText = toolkit.createText(client, "", SWT.BORDER);
+
+ Label dataUrLabel = toolkit.createLabel(client, "Data ur.");
+ Text dataUrField = toolkit.createText(client, "", SWT.BORDER);
+
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10)
+ .generateLayout(client);
+ section.setClient(client);
+ return section;
+ }
+
+ private Section createUzytkownikPart(){
+ Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION
+ | Section.EXPANDED | Section.TITLE_BAR | Section.TWISTIE);
+ section.setText("Użytkownik");
+ section.setDescription("Dane użytkownika (opcjonalne)");
+
+ Composite client = toolkit.createComposite(section, SWT.WRAP);
+
+ Label loginLabel = toolkit.createLabel(client, "Login");
+ Text loginText = toolkit.createText(client, "", SWT.BORDER);
+
+ Label hasloLabel = toolkit.createLabel(client, "Hasło");
+ Text hasloText = toolkit.createText(client, "", SWT.BORDER | SWT.PASSWORD);
+
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10)
+ .generateLayout(client);
+ section.setClient(client);
+ return section;
+ }
+
+ @Override
+ public void setFocus() {
+ // TODO Auto-generated method stub
+
+ }
+ @Override
+ public void dispose() {
+ toolkit.dispose();
+ super.dispose();
+ }
+}

0 comments on commit bd80efd

Please sign in to comment.