i want to retrieve value in my Ui class to dispaly using array list ..but only single value is appearing
public class UiClass {
public Composite method() {
final Composite container = (Composite) super.createContents(parent);
container.setLayout(new GridLayout(3, true));
container.setLayoutData(new GridData(GridData.FILL_BOTH));
ArrayList<String> lblsInGroup1 = new ArrayList<String>();
ArrayList<String> lblsInGroup2 = new ArrayList<String>();
ArrayList<String> lblsInGroup3 = new ArrayList<String>();
ArrayList<String> lblsInGroup4 = new ArrayList<String>();
SAXBuilder builder = new SAXBuilder();
File xmlFile = new File("GroupElement.xml");
ArrayList<String> listOfTitles = new ArrayList<String>();
ArrayList<String> listOfValues = new ArrayList<String>();
try {
Document document = (Document) builder.build(xmlFile);
Element rootNode = document.getRootElement();
List list = rootNode.getChildren("GroupElement");
System.err.println(list.size());
for (int i = 0;
i < list.size();
i++) {
Element groupNode = (Element) list.get(i);
ArrayList<String> tempArray = new ArrayList<String>();
tempArray.add(groupNode.getAttribute("Title").getValue());
List itemList = groupNode.getChildren();
Iterator listIter = itemList.iterator();
while (listIter.hasNext()){
Element childNode = (Element) listIter.next();
System.out.println("Item : " + childNode.getAttribute("plugin").getValue());
}
System.err.println(itemList.size());
for (int j = 0; j < itemList.size(); j++) {
tempArray.add(groupNode.getChildText("Item"));
}
tempArray.add(groupNode.getChildText("Item"));
if (i==0) {
lblsInGroup1 = tempArray;
} else if (i==1) {
lblsInGroup2 = tempArray;
} else if (i==2) {
lblsInGroup3 = tempArray;
} else if (i==3) {
lblsInGroup4 = tempArray;
}
}
} catch (IOException io) {
System.out.println(io.getMessage());
} catch (JDOMException jdomex) {
System.out.println(jdomex.getMessage());
}
if (lblsInGroup1.size()>0) {
Label myLabelheading= new Label(container,SWT.FILL);
GridData gridData11 = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
gridData11.horizontalAlignment = GridData.FILL;
gridData11.horizontalSpan= 3;
myLabelheading.setText(lblsInGroup1.get(0));
FontData[] _font = myLabelheading.getFont().getFontData();
_font[0].setHeight(11);
_font[0].setStyle(SWT.BOLD);
myLabelheading.setFont( new Font(null,_font[0]));
myLabelheading.setLayoutData(gridData11);
for (int _ind = 1;
_ind < lblsInGroup1.size();
++_ind) {
String currStr = lblsInGroup1.get(_ind);
Label _lbl= new Label(container,SWT.FILL);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
_lbl.setText(currStr);
_lbl.setLayoutData(gridData);
Button _btn = new Button(container,SWT.PUSH);
gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
_btn.setText("START");
_btn.setLayoutData(gridData);
Button _chkbtn= new Button(container,SWT.CHECK);
gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
_chkbtn.setText("STATUS");
_chkbtn.setSelection(false);
_chkbtn.setLayoutData(gridData);
}
}
if (lblsInGroup2.size() > 0) {
Label _lbl= new Label(container,SWT.FILL);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
gridData.horizontalAlignment = GridData.FILL;
gridData.horizontalSpan = 3;
_lbl.setText(lblsInGroup2.get(0));
FontData[] fontData = _lbl.getFont().getFontData();
fontData[0].setHeight(11);
fontData[0].setStyle(SWT.BOLD);
_lbl.setFont( new Font(null,fontData[0]));
_lbl.setLayoutData(gridData);
for (int _ind = 1;
_ind < lblsInGroup2.size();
++_ind) {
String currStr = lblsInGroup2.get(_ind);
_lbl= new Label( container,SWT.FILL);
gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1,1);
_lbl.setText(currStr);
_lbl.setLayoutData(gridData);
Button _btn = new Button( container,SWT.PUSH);
gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
_btn.setText("START");
_btn.setLayoutData(gridData);
Button _chkbtn= new Button( container,SWT.CHECK);
gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
_chkbtn.setText("STATUS");
_chkbtn.setLayoutData(gridData);
}
}
if (lblsInGroup3.size() > 0) {
Label _lbl= new Label(container,SWT.FILL);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
gridData.horizontalAlignment = GridData.FILL;
gridData.horizontalSpan = 3;
FontData[] fData = _lbl.getFont().getFontData();
fData[0].setHeight(11);
fData[0].setStyle(SWT.BOLD);
_lbl.setText(lblsInGroup3.get(0));
_lbl.setFont( new Font(null,fData[0]));
_lbl.setLayoutData(gridData);
for (int _ind = 1;
_ind < lblsInGroup3.size();
++_ind) {
String currStr = lblsInGroup3.get(_ind);
Label _lblline= new Label(container,SWT.FILL);
GridData gridDataline = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1,1);
_lblline.setText(currStr);
_lblline.setLayoutData(gridDataline);
Button _btn = new Button( container,SWT.PUSH);
gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1,1);
_btn.setText("START");
_btn.setLayoutData(gridData);
Button _chkbtn= new Button( container,SWT.CHECK);
gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1,1);
_chkbtn.setText("STATUS");
_chkbtn.setLayoutData(gridData);
}
}
return container;
}
private Display getDisplay() {
return null;
}
}