/* 暂存列表 */ public void onClick$saveSign() { List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); for (int a = 0; a < sList.size(); a++) { nameList.add(sList.get(a).getKsName()); valueList.add(sList.get(a).getKsValue()); } String sName = signName.getValue().trim(); String sValue = signValue.getValue().trim(); if (!sName.equals("") && !sValue.equals("")) { if (signList.getSelectedItem() == null) { WKTHtmlSign sign = new WKTHtmlSign(); sign.setKsName(sName); sign.setKsValue(sValue); if (!nameList.contains(sign.getKsName()) && !valueList.contains(sign.getKsValue())) { sList.add(sign); } else { MessageBox.showWarning("名称或值重复!"); } loadSignList(); } else { WKTHtmlSign sign = (WKTHtmlSign) signList.getSelectedItem().getValue(); WKTHtmlSign sign2; for (int i = 0; i < sList.size(); i++) { sign2 = sList.get(i); if (sign2.getKsName().equals(sign.getKsName())) { sign.setKsName(signName.getValue()); sign.setKsValue(signValue.getValue()); sign2 = sign; } } loadSignList(); } } else { MessageBox.showWarning("请将信息填充完整!"); } }
public void onClick$moveDown() { if (signList.getSelectedItem() == null) { MessageBox.showWarning("请选择移动对象!"); } else { WKTHtmlSign htmlSign = (WKTHtmlSign) signList.getSelectedItem().getValue(); Integer cId = signList.getSelectedItem().getIndex(); WKTHtmlSign hmSign = sList.get(cId + 1); sList.set(cId + 1, htmlSign); sList.set(cId, hmSign); loadSignList(); } }
public void onClick$delete() { if (signList.getSelectedItem() == null) { MessageBox.showWarning("请选择删除项!"); } else { WKTHtmlSign sign = (WKTHtmlSign) signList.getSelectedItem().getValue(); WKTHtmlSign wHtmlSign = signService.findBySignValue(sign.getKsValue().trim()); if (wHtmlSign.equals("")) { WKTHtmlSign sign2; for (int i = 0; i < sList.size(); i++) { sign2 = sList.get(i); if (sign.getKsName().equals(sign2.getKsName())) { try { if (Messagebox.show( "确定删除标记信息?", "提示信息", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES) { sList.remove(i); signValue.setValue(""); signName.setValue(""); loadSignList(); } } catch (InterruptedException e) { e.printStackTrace(); } } } } else { try { if (Messagebox.show( "确定删除标记信息?", "提示信息", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES) { signService.delete(sign); signValue.setValue(""); signName.setValue(""); Init(); } } catch (InterruptedException e) { e.printStackTrace(); } } // else } }