public void setDatas(List<AutoTriggerSettingsDataBean> databeanlist) { this.beanlist = databeanlist; int len = databeanlist.size(); datalength = len; ccy = new String[len]; for(int i=0; i<len; i++){ ccy[i] = databeanlist.get(i).getCycy(); } comboAutotriger = new Combo[ccy.length]; comboSecond = new Combo[ccy.length]; textSecond = new Text[ccy.length]; comboLongAmt = new Combo[ccy.length]; textLongAmt = new Text[ccy.length]; comboAskProfit = new Combo[ccy.length]; textAskProfit = new Text[ccy.length]; comboAskLoss = new Combo[ccy.length]; textAskLoss = new Text[ccy.length]; comboShortAmt = new Combo[ccy.length]; textShortAmt = new Text[ccy.length]; comboBidProfit = new Combo[ccy.length]; textBidProfit = new Text[ccy.length]; comboBidLoss = new Combo[ccy.length]; textBidLoss = new Text[ccy.length]; comboProfitValue = new Combo[ccy.length]; textProfitValue = new Text[ccy.length]; comboProfitValue2 = new Combo[ccy.length]; textProfitValue2 = new Text[ccy.length]; comboLossValue = new Combo[ccy.length]; comboLossValue2 = new Combo[ccy.length]; textLossValue = new Text[ccy.length]; textLossValue2 = new Text[ccy.length]; comboEod = new Combo[ccy.length]; textEod = new Text[ccy.length]; comboMailSwitch = new Combo[ccy.length]; textMail = new Text[ccy.length]; TableItem item; for (int i = 0; i < ccy.length; i++) { item = new TableItem(table, SWT.NULL); item.setImage(image); item.setText(0, databeanlist.get(i).getCycy()); }
final TableItem[] items = table.getItems(); TableItem[] itemsss = new TableItem[items.length]; for (int i = 0; i < ccy.length; i++) {
final TableItem currentItem = items[i]; itemsss[i] = currentItem; final String allpair = currentItem.getText(); AutoTriggerSettingsDataBean bean = databeanlist.get(i);
comboAutotriger[i] = new Combo(this.table, SWT.DROP_DOWN); setComboBox(currentItem, comboAutotriger[i], bean.getAutotriger(), 1); comboAutotriger[i].addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) { if (((Combo) evt.getSource()).getText().equals( comboValues[0])) { setAllCombo(ccy, comboAutotriger, comboValues[0]); } else { setAllCombo(ccy, comboAutotriger, comboValues[1]); } } } }); //滞留秒数(秒) comboSecond[i] = new Combo(this.table, SWT.DROP_DOWN | SWT.NONE); setComboBox(currentItem, comboSecond[i], bean.getSecondswitch(), 2); textSecond[i] = new Text(this.table, SWT.NONE); textSecond[i].addVerifyListener(secondVer); textSecond[i].setTextLimit(4);
textSecond[i].addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent evt) { if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) { Text txtMy = (Text) evt.getSource(); if(null != txtMy){ setAllTextValue(ccy, textSecond, txtMy.getText()); } } } });
用过table显示数据几万行*10几列,
也没出现lz提到的问题。
this.beanlist = databeanlist;
int len = databeanlist.size();
datalength = len;
ccy = new String[len];
for(int i=0; i<len; i++){
ccy[i] = databeanlist.get(i).getCycy();
}
comboAutotriger = new Combo[ccy.length];
comboSecond = new Combo[ccy.length];
textSecond = new Text[ccy.length];
comboLongAmt = new Combo[ccy.length];
textLongAmt = new Text[ccy.length];
comboAskProfit = new Combo[ccy.length];
textAskProfit = new Text[ccy.length];
comboAskLoss = new Combo[ccy.length];
textAskLoss = new Text[ccy.length];
comboShortAmt = new Combo[ccy.length];
textShortAmt = new Text[ccy.length];
comboBidProfit = new Combo[ccy.length];
textBidProfit = new Text[ccy.length];
comboBidLoss = new Combo[ccy.length];
textBidLoss = new Text[ccy.length];
comboProfitValue = new Combo[ccy.length];
textProfitValue = new Text[ccy.length];
comboProfitValue2 = new Combo[ccy.length];
textProfitValue2 = new Text[ccy.length];
comboLossValue = new Combo[ccy.length];
comboLossValue2 = new Combo[ccy.length];
textLossValue = new Text[ccy.length];
textLossValue2 = new Text[ccy.length];
comboEod = new Combo[ccy.length];
textEod = new Text[ccy.length];
comboMailSwitch = new Combo[ccy.length];
textMail = new Text[ccy.length];
TableItem item;
for (int i = 0; i < ccy.length; i++) {
item = new TableItem(table, SWT.NULL);
item.setImage(image);
item.setText(0, databeanlist.get(i).getCycy());
}
final TableItem[] items = table.getItems();
TableItem[] itemsss = new TableItem[items.length];
for (int i = 0; i < ccy.length; i++) {
final TableItem currentItem = items[i];
itemsss[i] = currentItem;
final String allpair = currentItem.getText();
AutoTriggerSettingsDataBean bean = databeanlist.get(i);
comboAutotriger[i] = new Combo(this.table, SWT.DROP_DOWN);
setComboBox(currentItem, comboAutotriger[i], bean.getAutotriger(), 1);
comboAutotriger[i].addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) {
if (((Combo) evt.getSource()).getText().equals(
comboValues[0])) {
setAllCombo(ccy, comboAutotriger, comboValues[0]);
} else {
setAllCombo(ccy, comboAutotriger, comboValues[1]);
}
} }
}); //滞留秒数(秒)
comboSecond[i] = new Combo(this.table, SWT.DROP_DOWN | SWT.NONE);
setComboBox(currentItem, comboSecond[i], bean.getSecondswitch(), 2);
textSecond[i] = new Text(this.table, SWT.NONE);
textSecond[i].addVerifyListener(secondVer);
textSecond[i].setTextLimit(4);
textSecond[i].addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent evt) {
if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) {
Text txtMy = (Text) evt.getSource();
if(null != txtMy){
setAllTextValue(ccy, textSecond, txtMy.getText());
}
}
}
});
textSecond[i].setText(bean.getSecond());
setText(currentItem, textSecond[i], bean.getSecondswitch(), 2);
comboSecond[i].addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) {
if (((Combo) evt.getSource()).getText().equals(
comboValues[0])) {
setAllCombo(ccy, comboSecond, comboValues[0]);
setAllText(ccy, textSecond, true);
} else {
setAllCombo(ccy, comboSecond, comboValues[1]);
setAllText(ccy, textSecond, false);
}
} else {
if (((Combo) evt.getSource()).getText().equals(
comboValues[0])) {
int position = getPosition(ccy, currentItem);
textSecond[position].setEnabled(true);
} else {
int position = getPosition(ccy, currentItem);
textSecond[position].setEnabled(false);
}
} }
});
} } private void setText(final TableItem item, Text text, String flag, int position) {
TableEditor editor = new TableEditor(this.table); editor.grabHorizontal = false;
editor.minimumWidth = 50;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(text, item, position);
}