So I created a new ViewPart and added all required Fields to match our old application.
In Desing / Preview everything looks fine, but at runtime the labels, text fields and so on which are located in a Group with a GridLayout don´t appear.
If I remove the GridLayout from the Group everything is fine.... Any suggestions???
With visible Fields at preview
Without the Fields at Runtime:
- Code: Select all
package org.vhb.lvcopy.views;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;
import com.swtdesigner.SWTResourceManager;
/**
* @author sauerral
*
* created first in Project org.vhb.lvcopy
* at 20.06.2005
*
*/
public class SKStudentView
extends ViewPart //implements SelectionListener
{
class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
public String getColumnText(Object element, int columnIndex)
{
return element.toString();
}
public Image getColumnImage(Object element, int columnIndex)
{
return null;
}
}
class ContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object inputElement)
{
return new Object[] { "item_0", "item_1", "item_2" };
}
public void dispose()
{
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
{
}
}
public static final String ID_VIEW = "org.vhb.lvcopy.views.SKStudentView"; //$NON-NLS-1$
private Table table;
private Text text_15;
private Combo combo_3;
private Text text_14;
private Combo combo_2;
private Combo combo_1;
private Text bafoegnrText;
private Text serverhomeText;
private Text emailText;
private Text geburtsnameText;
private Text geburtsortText;
private Text geburtsdatumText;
private Text nationalitaetText;
private Text akadgradText;
private Text anschrift2telefonText;
private Text anschrift2vermieterText;
private Text anschrift2strasseText;
private Text anschrift2ortText;
private Text anschrift2plzText;
private Text anschrift2landText;
private Text anschrift1telefonText;
private Text anschrift1vermieterText;
private Text anschrift1strasseText;
private Text anschrift1ortText;
private Text anschrift1plzText;
private Text anschrift1landText;
private Text nachnameText;
private Text vornameText;
private Combo loginCombo;
public void createPartControl(Composite parent)
{
Composite container = new Composite(parent, SWT.NONE);
container.setSize(335,515);
final TabFolder tabFolder = new TabFolder(container, SWT.NONE);
tabFolder.setBounds(-1, 60, 330, 362);
final TabItem allgemeinTab = new TabItem(tabFolder, SWT.NONE);
allgemeinTab.setText("Allgemein");
final Composite composite = new Composite(tabFolder, SWT.NONE);
allgemeinTab.setControl(composite);
GridData gridData = new GridData (GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_BOTH);
composite.setLayoutData(gridData);
final Group stammdatengroup = new Group(composite, SWT.NONE);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
stammdatengroup.setLayout(gridLayout);
stammdatengroup.setData("newKey", null);
stammdatengroup.setText("Stammdaten");
stammdatengroup.setBounds(3, 5, 310, 108);
final Label label = new Label(stammdatengroup, SWT.NONE);
label.setText("Login");
loginCombo = new Combo(stammdatengroup, SWT.NONE);
final Button maennlichButton = new Button(stammdatengroup, SWT.RADIO);
maennlichButton.setText("männlich");
final Label label_1 = new Label(stammdatengroup, SWT.NONE);
label_1.setText("Vorname");
vornameText = new Text(stammdatengroup, SWT.BORDER);
final Button weiblichButton = new Button(stammdatengroup, SWT.RADIO);
weiblichButton.setText("weiblich");
final Label label_2 = new Label(stammdatengroup, SWT.NONE);
label_2.setText("Nachname");
nachnameText = new Text(stammdatengroup, SWT.BORDER);
final Button alleButton = new Button(stammdatengroup, SWT.RADIO);
alleButton.setSelection(true);
alleButton.setText("alle");
final Group pruefungsdatenGroup = new Group(composite, SWT.NONE);
pruefungsdatenGroup.setText("Prüfungsdaten");
pruefungsdatenGroup.setBounds(3, 114, 310, 70);
final Label pruefungsdatengroup = new Label(pruefungsdatenGroup, SWT.NONE);
pruefungsdatengroup.setText("Der Explorer stellt alle Prüfungsdaten \nin Form eines Baumes dar. Die rechte \nMaustaste öffnet ein Kontextmenü");
pruefungsdatengroup.setBounds(5, 15, 229, 53);
final Button explorerButton = new Button(pruefungsdatenGroup, SWT.NONE);
explorerButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/explorer.gif"));
explorerButton.setToolTipText("Explorer");
explorerButton.setBounds(240, 15, 55, 45);
final Group datenschutzGroup = new Group(composite, SWT.NONE);
datenschutzGroup.setText("Datenschutz");
datenschutzGroup.setBounds(3, 185, 310, 70);
final Label datenschutzlabel = new Label(datenschutzGroup, SWT.NONE);
datenschutzlabel.setText("Verwaltung von Passwörtern und \nTransaktionsnummern der Studenten für \ndie WWW-Schnittstelle");
datenschutzlabel.setBounds(5, 15, 217, 50);
final Button pinButton = new Button(datenschutzGroup, SWT.NONE);
pinButton.setEnabled(false);
pinButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/Key.gif"));
pinButton.setBounds(240, 15, 55, 45);
final Group wwwGroup = new Group(composite, SWT.NONE);
wwwGroup.setText("WWW");
wwwGroup.setBounds(3, 256, 310, 70);
final Label wwwgroup = new Label(wwwGroup, SWT.NONE);
wwwgroup.setText("Protokoll aller WWW-Transaktionen \nund Änderung von Daten");
wwwgroup.setBounds(5, 15, 200, 40);
final Button protokollButton = new Button(wwwGroup, SWT.NONE);
protokollButton.setEnabled(false);
protokollButton.setToolTipText("Protokoll");
protokollButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/protokoll.gif"));
protokollButton.setBounds(240, 15, 55, 45);
final TabItem anschriftTab = new TabItem(tabFolder, SWT.NONE);
anschriftTab.setText("Anschrift");
final Composite composite_1 = new Composite(tabFolder, SWT.NONE);
anschriftTab.setControl(composite_1);
final Group anschrift1Group = new Group(composite_1, SWT.NONE);
final GridLayout gridLayout_1 = new GridLayout();
gridLayout_1.numColumns = 4;
anschrift1Group.setLayout(gridLayout_1);
anschrift1Group.setText("Anschrift 1");
anschrift1Group.setBounds(3, 5, 310, 155);
final Label label_3 = new Label(anschrift1Group, SWT.NONE);
label_3.setText("Land / PLZ");
anschrift1landText = new Text(anschrift1Group, SWT.BORDER);
anschrift1landText.setText("D");
final GridData gridData_9 = new GridData();
gridData_9.widthHint = 40;
anschrift1landText.setLayoutData(gridData_9);
anschrift1plzText = new Text(anschrift1Group, SWT.BORDER);
final Label label_4 = new Label(anschrift1Group, SWT.NONE);
final Label label_5 = new Label(anschrift1Group, SWT.NONE);
label_5.setText("Ort");
anschrift1ortText = new Text(anschrift1Group, SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_1.horizontalSpan = 3;
anschrift1ortText.setLayoutData(gridData_1);
final Label label_6 = new Label(anschrift1Group, SWT.NONE);
label_6.setText("Strasse");
anschrift1strasseText = new Text(anschrift1Group, SWT.BORDER);
final GridData gridData_2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_2.horizontalSpan = 3;
anschrift1strasseText.setLayoutData(gridData_2);
final Label label_7 = new Label(anschrift1Group, SWT.NONE);
label_7.setText("Vermieter");
anschrift1vermieterText = new Text(anschrift1Group, SWT.BORDER);
final GridData gridData_3 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_3.horizontalSpan = 3;
anschrift1vermieterText.setLayoutData(gridData_3);
final Label label_8 = new Label(anschrift1Group, SWT.NONE);
label_8.setText("Telefon");
anschrift1telefonText = new Text(anschrift1Group, SWT.BORDER);
final GridData gridData_4 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_4.horizontalSpan = 2;
anschrift1telefonText.setLayoutData(gridData_4);
final Button postanschrift1Button = new Button(anschrift1Group, SWT.RADIO);
postanschrift1Button.setSelection(true);
postanschrift1Button.setText("Postanschrift");
final Group anschrift2Group = new Group(composite_1, SWT.NONE);
final GridLayout gridLayout_2 = new GridLayout();
gridLayout_2.numColumns = 4;
anschrift2Group.setLayout(gridLayout_2);
anschrift2Group.setText("Anschrift 2");
anschrift2Group.setBounds(3, 161, 310, 155);
final Label label_9 = new Label(anschrift2Group, SWT.NONE);
label_9.setText("Land / PLZ");
anschrift2landText = new Text(anschrift2Group, SWT.BORDER);
final GridData gridData_10 = new GridData();
gridData_10.widthHint = 40;
anschrift2landText.setLayoutData(gridData_10);
anschrift2plzText = new Text(anschrift2Group, SWT.BORDER);
final Label label_10 = new Label(anschrift2Group, SWT.NONE);
final Label label_11 = new Label(anschrift2Group, SWT.NONE);
label_11.setText("Ort");
anschrift2ortText = new Text(anschrift2Group, SWT.BORDER);
final GridData gridData_5 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_5.horizontalSpan = 3;
anschrift2ortText.setLayoutData(gridData_5);
final Label label_12 = new Label(anschrift2Group, SWT.NONE);
label_12.setText("Strasse");
anschrift2strasseText = new Text(anschrift2Group, SWT.BORDER);
final GridData gridData_6 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_6.horizontalSpan = 3;
anschrift2strasseText.setLayoutData(gridData_6);
final Label label_13 = new Label(anschrift2Group, SWT.NONE);
label_13.setText("Vermieter");
anschrift2vermieterText = new Text(anschrift2Group, SWT.BORDER);
final GridData gridData_7 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_7.horizontalSpan = 3;
anschrift2vermieterText.setLayoutData(gridData_7);
final Label label_14 = new Label(anschrift2Group, SWT.NONE);
label_14.setText("Telefon");
anschrift2telefonText = new Text(anschrift2Group, SWT.BORDER);
final GridData gridData_8 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_8.horizontalSpan = 2;
anschrift2telefonText.setLayoutData(gridData_8);
final Button postanschrift2Button = new Button(anschrift2Group, SWT.RADIO);
postanschrift2Button.setText("Postanschrift");
final TabItem persoenlichesTab = new TabItem(tabFolder, SWT.NONE);
persoenlichesTab.setText("Persönliches");
final Composite composite_2 = new Composite(tabFolder, SWT.NONE);
persoenlichesTab.setControl(composite_2);
final Group group = new Group(composite_2, SWT.NONE);
final GridLayout gridLayout_3 = new GridLayout();
gridLayout_3.numColumns = 3;
group.setLayout(gridLayout_3);
group.setText("Persönliche Daten");
group.setBounds(3, 5, 310, 155);
final Label label_15 = new Label(group, SWT.NONE);
label_15.setText("Akad. Grad");
akadgradText = new Text(group, SWT.BORDER);
final GridData gridData_11 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_11.widthHint = 200;
gridData_11.horizontalSpan = 2;
akadgradText.setLayoutData(gridData_11);
final Label label_16 = new Label(group, SWT.NONE);
label_16.setText("Nationalität");
nationalitaetText = new Text(group, SWT.BORDER);
final GridData gridData_12 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_12.widthHint = 75;
nationalitaetText.setLayoutData(gridData_12);
final Label label_17 = new Label(group, SWT.NONE);
final Label label_18 = new Label(group, SWT.NONE);
label_18.setText("Geburtsdatum");
geburtsdatumText = new Text(group, SWT.BORDER);
final GridData gridData_15 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_15.widthHint = 75;
geburtsdatumText.setLayoutData(gridData_15);
final Label label_19 = new Label(group, SWT.NONE);
final Label label_20 = new Label(group, SWT.NONE);
label_20.setText("Geburtsort");
geburtsortText = new Text(group, SWT.BORDER);
final GridData gridData_13 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_13.widthHint = 200;
gridData_13.horizontalSpan = 2;
geburtsortText.setLayoutData(gridData_13);
final Label label_21 = new Label(group, SWT.NONE);
label_21.setText("Geburtsname");
geburtsnameText = new Text(group, SWT.BORDER);
final GridData gridData_14 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_14.widthHint = 200;
gridData_14.horizontalSpan = 2;
geburtsnameText.setLayoutData(gridData_14);
final Group group_4 = new Group(composite_2, SWT.NONE);
group_4.setText("E-Mail");
group_4.setBounds(3, 158, 310, 50);
emailText = new Text(group_4, SWT.BORDER);
emailText.setBounds(5, 15, 295, 20);
final Group group_5 = new Group(composite_2, SWT.NONE);
group_5.setText("Server-Home");
group_5.setBounds(3, 207, 310, 50);
serverhomeText = new Text(group_5, SWT.BORDER);
serverhomeText.setBounds(5, 15, 295, 20);
final Group group_6 = new Group(composite_2, SWT.NONE);
group_6.setText("BAFöG Förderungsnummer");
group_6.setBounds(3, 255, 310, 50);
bafoegnrText = new Text(group_6, SWT.BORDER);
bafoegnrText.setBounds(5, 15, 295, 20);
final TabItem hochschuleTab = new TabItem(tabFolder, SWT.NONE);
hochschuleTab.setText("Hochschule");
final Composite composite_3 = new Composite(tabFolder, SWT.NONE);
hochschuleTab.setControl(composite_3);
final Group group_7 = new Group(composite_3, SWT.NONE);
final GridLayout gridLayout_4 = new GridLayout();
gridLayout_4.numColumns = 2;
group_7.setLayout(gridLayout_4);
group_7.setText("Stammhochschule");
group_7.setBounds(3, 5, 310, 105);
combo_1 = new Combo(group_7, SWT.NONE);
final GridData gridData_16 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_16.horizontalSpan = 2;
gridData_16.widthHint = 260;
combo_1.setLayoutData(gridData_16);
final Label label_22 = new Label(group_7, SWT.NONE);
label_22.setText("Hochschulstatus");
combo_2 = new Combo(group_7, SWT.NONE);
combo_2.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
final Label label_23 = new Label(group_7, SWT.NONE);
label_23.setText("Matrikelnummer");
text_14 = new Text(group_7, SWT.BORDER);
final GridData gridData_17 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gridData_17.widthHint = 186;
text_14.setLayoutData(gridData_17);
final Group group_8 = new Group(composite_3, SWT.NONE);
group_8.setText("Registrierungsstatus");
group_8.setBounds(5, 108, 310, 50);
combo_3 = new Combo(group_8, SWT.NONE);
combo_3.setBounds(5, 15, 290, 20);
final TabItem studiengangTab = new TabItem(tabFolder, SWT.NONE);
studiengangTab.setText("Studiengang");
final Composite composite_4 = new Composite(tabFolder, SWT.NONE);
studiengangTab.setControl(composite_4);
final Group studiengangGroup = new Group(composite_4, SWT.NONE);
studiengangGroup.setText("Studiengang");
studiengangGroup.setBounds(3, 5, 310, 220);
text_15 = new Text(studiengangGroup, SWT.BORDER);
text_15.setBounds(5, 15, 295, 20);
final Label label_24 = new Label(studiengangGroup, SWT.NONE);
label_24.setText("zum Studiengang korrespondierende Fächergruppe(n)");
label_24.setBounds(5, 40, 295, 20);
CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(studiengangGroup, SWT.BORDER);
checkboxTableViewer.setLabelProvider(new TableLabelProvider());
checkboxTableViewer.setContentProvider(new ContentProvider());
table = checkboxTableViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
table.setBounds(5, 60, 300, 155);
final TableColumn faechergruppeColumn = new TableColumn(table, SWT.NONE);
faechergruppeColumn.setWidth(290);
faechergruppeColumn.setText("Fächergruppe");
checkboxTableViewer.setInput(new Object());
final Group group_9 = new Group(composite_4, SWT.NONE);
group_9.setText("Automatische Registrierung/Rückmeldung");
group_9.setBounds(5, 223, 310, 105);
final Label label_25 = new Label(group_9, SWT.NONE);
label_25.setText("Klicken Sie hier, um den Studenten für\ndas aktuelle Semester zu registrieren bzw.\nfür das nächste Semester rückzumelden.");
label_25.setBounds(5, 29, 200, 51);
final Button aktSemButton = new Button(group_9, SWT.NONE);
aktSemButton.setText("Akt. Sem.");
aktSemButton.setBounds(220, 15, 80, 35);
final Button folgesemButton = new Button(group_9, SWT.NONE);
folgesemButton.setText("Folgesem.");
folgesemButton.setBounds(220, 60, 80, 35);
final Button searchButton = new Button(container, SWT.TOGGLE);
searchButton.setToolTipText("Suchen");
searchButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/search.ico"));
searchButton.setBounds(7, 8, 55, 45);
final Button updateButton = new Button(container, SWT.NONE);
updateButton.setToolTipText("Änderungen speichern");
updateButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/update.gif"));
updateButton.setBounds(210, 8, 55, 45);
final Button deleteButton = new Button(container, SWT.NONE);
deleteButton.setToolTipText("Datensatz löschen");
deleteButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/delete.gif"));
deleteButton.setBounds(270, 8, 55, 45);
final Group navigationgroup = new Group(container, SWT.NONE);
navigationgroup.setBounds(5, 429, 320, 70);
navigationgroup.setText("Navigation");
final Button firstButton = new Button(navigationgroup, SWT.NONE);
firstButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/first.gif"));
firstButton.setToolTipText("erster Datensatz");
firstButton.setEnabled(false);
firstButton.setBounds(15, 25, 30, 30);
final Button previousButton = new Button(navigationgroup, SWT.NONE);
previousButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/prev.gif"));
previousButton.setEnabled(false);
previousButton.setBounds(55, 25, 30, 30);
final Button nextButton = new Button(navigationgroup, SWT.NONE);
nextButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/next.gif"));
nextButton.setEnabled(false);
nextButton.setBounds(230, 25, 30, 30);
final Button lastButton = new Button(navigationgroup, SWT.NONE);
lastButton.setImage(SWTResourceManager.getImage(SKStudentView.class, "/icons/last.gif"));
lastButton.setEnabled(false);
lastButton.setBounds(270, 25, 30, 30);
//
createActions();
initializeToolBar();
initializeMenu();
}
private void createActions()
{
}
private void initializeToolBar()
{
IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
}
private void initializeMenu()
{
IMenuManager manager = getViewSite().getActionBars().getMenuManager();
}
public void setFocus()
{
}
}