Codenameone iOS问题:IndexOutOfBoundsException
Codenameone iOS问题:IndexOutOfBoundsException,codenameone,Codenameone,我面临着iOS的问题。 我有一个在安卓系统上运行完美的应用程序。我为Android Debug构建了它,当我试图显示我的表单时,我得到了一个索引AutofBoundsException 这是我的密码: package com.idenovia.calendovia.form; public class FichePro extends Form { public static Site site; public static Boolean isFavorite = fals
我面临着iOS的问题。 我有一个在安卓系统上运行完美的应用程序。我为Android Debug构建了它,当我试图显示我的表单时,我得到了一个索引AutofBoundsException 这是我的密码:
package com.idenovia.calendovia.form;
public class FichePro extends Form {
public static Site site;
public static Boolean isFavorite = false;
public static List<Performance> performances = new ArrayList<Performance>();
public static Long canContactTakeEvent;
public FichePro(final int idPro,final String searchWho, final List<Site> savedSites){
try {
Dialog ip = new InfiniteProgress().showInifiniteBlocking();
ip.getContentPane().getStyle().setBgTransparency(0, true);
ip.getContentPane().getComponentAt(0).getStyle().setBgTransparency(0, true);
Map<String,Object> result;
if(CalendoviaApp.isConnected ==1 && CalendoviaApp.customer.getId() != 0)
result = AccessSite.getSiteFromId(idPro,CalendoviaApp.customer.getId());
else
result = AccessSite.getSiteFromId(idPro,0);
if(result.containsKey("sites")){
site = (Site) result.get("sites");
}else{
site = null;
}
if(result.containsKey("performances")){
performances = (List<Performance>) result.get("performances");
}else{
performances = null;
}
if(result.containsKey("canContactTakeEvent")){
canContactTakeEvent = (Long) result.get("canContactTakeEvent");
}else{
canContactTakeEvent = null;
}
ip.dispose();
} catch (Exception e1) {
e1.printStackTrace();
}
/*
* Form theming and configuring
*/
if(site != null)
setTitle("Dr. "+site.getSiteYou().getShowname());
else{
SearchList searchList = new SearchList(searchWho,"",savedSites);
searchList.show();
}
Container content = new Container(new BoxLayout(BoxLayout.Y_AXIS));
content.setUIID("ctrContent");
setLayout(new BorderLayout());
setTransitionInAnimator(CommonTransitions.createFade(200));
final Font fnt = Font.createTrueTypeFont("CALENDOVIA_APP", "CALENDOVIA_APP.ttf");
Container ctrPhoto = new Container(new BorderLayout());
ctrPhoto.setUIID("ctrPhoto");
// try {
Image image = CalendoviaApp.res.getImage("placeholderProvider").scaled((int)(Display.getInstance().getDisplayWidth()*0.25),(int)(Display.getInstance().getDisplayWidth()*0.25));
for (Site favoris : CalendoviaApp.favorites) {
if(favoris.getId().equals(site.getId())){
isFavorite = true;
}
}
final CheckBox favButton2 = new CheckBox();
final Button favButton = new Button();
if(isFavorite){
favButton.setIcon(FontImage.createFixed("\ue900", fnt, 0x2995d0,(int)(Display.getInstance().getDisplayWidth()*0.2), (int)(Display.getInstance().getDisplayWidth()*0.2)));
}else{
favButton.setIcon(FontImage.createFixed("\ue931", fnt, 0x2995d0,(int)(Display.getInstance().getDisplayWidth()*0.2), (int)(Display.getInstance().getDisplayWidth()*0.2)));
}
favButton.setTextPosition(Component.BOTTOM);
favButton.getStyle().setBgTransparency(0,true);
favButton.getPressedStyle().setBgTransparency(0,true);
favButton.getDisabledStyle().setBgTransparency(0,true);
favButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if(isFavorite){
do some stuff like seticon or network access
}else{
do some stuff too
}
}
});
ctrPhoto.add(BorderLayout.WEST, image);
ctrPhoto.add(BorderLayout.EAST, favButton);
Container ctrglobalInfosFichePro = new Container(new BoxLayout(BoxLayout.Y_AXIS));
ctrglobalInfosFichePro.setScrollVisible(false);
ctrglobalInfosFichePro.setScrollableY(true);
ctrglobalInfosFichePro.setUIID("ctrglobalInfosFichePro");
//First Part
Container ctrglobalInfosFirstPart = new Container(new BoxLayout(BoxLayout.Y_AXIS));
ctrglobalInfosFirstPart.setScrollableY(false);
ctrglobalInfosFirstPart.setUIID("ctrglobalInfosFirstPart");
Label lblProviderName = new Label("Dr "+site.getSiteYou().getShowname());
lblProviderName.setUIID("lblNameProvider");
ctrglobalInfosFichePro.add(lblProviderName);
try{
Label lblProviderSpe = new Label(new SectorConvert().getValue(site.getSiteYou().getSectorfirst().intValue()).toString());
lblProviderSpe.setUIID("lblSpeProvider");
ctrglobalInfosFichePro.add(lblProviderSpe);
}catch(Exception e){
} if(site.getSiteOption().getCbcard()||site.getSiteOption().getCheckp()||site.getSiteOption().getSpecies()){
Label lblPaiement = new Label("MOYENS DE PAIEMENT");
lblPaiement.setUIID("lblTitleForSpanLabel");
lblPaiement.setVerticalAlignment(Component.CENTER);
String acceptedPaiement ="";
if(site.getSiteOption().getCbcard()){
acceptedPaiement+=" CB /";
}
Label lblAcceptedPaiement = new Label(acceptedPaiement);
ctrglobalInfosFirstPart.add(lblPaiement);
ctrglobalInfosFirstPart.add(lblAcceptedPaiement);
}
//Second Part
Container ctrglobalInfosSecondPart= new Container(new BorderLayout());
if(site.getSiteYou().getPhonepro().trim().length() != 0){
ctrglobalInfosSecondPart.setUIID("ctrglobalInfosFirstPart");
Button btnAppeler = new Button("Appeler");
btnAppeler.setUIID("btnAppelerFichePro");
btnAppeler.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Display.getInstance().dial(site.getSiteYou().getPhonepro());
}
});
ctrglobalInfosSecondPart.add(BorderLayout.EAST,btnAppeler);
}
ctrglobalInfosFichePro.add(ctrglobalInfosFirstPart);
ctrglobalInfosFichePro.add(ctrglobalInfosSecondPart);
content.add(ctrglobalInfosFichePro);
/*
* Building Form
*/
if(site.getCanaccess()){
Button btnTakeAppointement = new Button("");
btnTakeAppointement.setUIID("");
btnTakeAppointement.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if(site.getNewcontactblocked()){
if(canContactTakeEvent != null && CalendoviaApp.isConnected==1 && CalendoviaApp.customer.getId() != 0){
switch(canContactTakeEvent.intValue()){
case 0:
FicheProCannotTakeEvent ficheProCannotTakeEvent = new FicheProCannotTakeEvent(site, canContactTakeEvent, savedSites, searchWho,true);
ficheProCannotTakeEvent.show();
break;
case 1:
FicheProRdvSelect ficheProRdvSelect = new FicheProRdvSelect(performances,site, savedSites, searchWho, null);
ficheProRdvSelect.show();
break;
[...]
default:
FicheProCannotTakeEvent ficheProCannotTakeEvent4 = new FicheProCannotTakeEvent(site, new Long(4), savedSites, searchWho,true);
ficheProCannotTakeEvent4.show();
break;
}
}else{
FicheProCannotTakeEvent ficheProCannotTakeEvent = new FicheProCannotTakeEvent(site, new Long(0), savedSites, searchWho,false);
ficheProCannotTakeEvent.show();
}
}
else{
FicheProRdvSelect ficheProRdvSelect = new FicheProRdvSelect(performances,site, savedSites, searchWho, null);
ficheProRdvSelect.show();
}
}
});
addComponent(BorderLayout.SOUTH,btnTakeAppointement);
}else{
Button btnParrainage = new Button("");
btnParrainage.setUIID("btnTakeRdvBig");
btnParrainage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Parrainage parrainage = new Parrainage(site, getComponentForm());
parrainage.show();
}
});
addComponent(BorderLayout.SOUTH,btnParrainage);
}
addComponent(BorderLayout.NORTH, ctrPhoto);
addComponent(BorderLayout.CENTER, content);
}
}
package com.idenovia.calendovia.form;
公共类FichePro扩展表单{
公共静态站点;
公共静态布尔值isFavorite=false;
公共静态列表性能=新建ArrayList();
公共静态长事件;
公共FichePro(最终int idPro、最终字符串搜索WHO、最终列表保存站点){
试一试{
对话框ip=new InfiniteProgress().showinFiniteBlock();
ip.getContentPane().getStyle().SetbGTTransparency(0,true);
ip.getContentPane().getComponentAt(0.getStyle().SetbGTTransparency(0,true);
地图结果;
if(CalendoviaApp.isConnected==1&&CalendoviaApp.customer.getId()!=0)
结果=AccessSite.getSiteFromId(Idro,CalendoviaApp.customer.getId());
其他的
结果=AccessSite.getSiteFromId(idPro,0);
如果(结果:集装箱(“现场”)){
site=(site)result.get(“sites”);
}否则{
site=null;
}
如果(结果包含(“性能”)){
性能=(列表)result.get(“性能”);
}否则{
性能=空;
}
if(result.containsKey(“canContactTakeEvent”)){
canContactTakeEvent=(Long)result.get(“canContactTakeEvent”);
}否则{
canContactTakeEvent=null;
}
ip.dispose();
}捕获(异常e1){
e1.printStackTrace();
}
/*
*表单主题化和配置
*/
如果(站点!=null)
setTitle(“Dr.”+site.getSiteYou().getShowname());
否则{
SearchList SearchList=新的搜索列表(searchWho,“,savedsite);
searchList.show();
}
容器内容=新容器(新的BoxLayout(BoxLayout.Y_轴));
content.setUIID(“ctrContent”);
setLayout(新的BorderLayout());
setTransitionNanImator(CommonTransitions.createFade(200));
最终字体fnt=Font.createTrueTypeFont(“CALENDOVIA_应用程序”、“CALENDOVIA_应用程序.ttf”);
Container ctrPhoto=新容器(新的BorderLayout());
ctrPhoto.setUIID(“ctrPhoto”);
//试一试{
Image Image=CalendoviaApp.res.getImage(“占位符提供程序”).scaled((int)(Display.getInstance().getDisplayWidth()*0.25),(int)(Display.getInstance().getDisplayWidth()*0.25));
用于(网站收藏夹:CalendoviaApp.favorites){
if(favoris.getId().equals(site.getId())){
isFavorite=true;
}
}
最终复选框favButton2=新复选框();
最终按钮favButton=新按钮();
如果(我最喜欢){
设置图标(FontImage.createFixed(“\ue900”,fnt,0x2995d0,(int)(Display.getInstance().getDisplayWidth()*0.2),(int)(Display.getInstance().getDisplayWidth()*0.2));
}否则{
设置图标(FontImage.createFixed(“\ue931”,fnt,0x2995d0,(int)(Display.getInstance().getDisplayWidth()*0.2),(int)(Display.getInstance().getDisplayWidth()*0.2));
}
favButton.setTextPosition(组件.底部);
favButton.getStyle().SetbGTTransparency(0,true);
favButton.getPressedStyle().SetbGTTransparency(0,true);
favButton.getDisabledStyle().SetbGTTransparency(0,true);
addActionListener(新ActionListener(){
已执行的公共无效操作(操作事件evt){
如果(我最喜欢){
做一些事情,比如设置图标或网络访问
}否则{
也做一些事情
}
}
});
ctrPhoto.add(BorderLayout.WEST,图像);
ctrPhoto.add(BorderLayout.EAST,favButton);
容器ctrglobalInfosFichePro=新容器(新的BoxLayout(BoxLayout.Y_轴));
ctrglobalInfosFichePro.setScrollVisible(假);
ctrglobalInfosFichePro.setScrollableY(真);
ctrglobalInfosFichePro.setUIID(“ctrglobalInfosFichePro”);
//第一部分
容器ctrglobalInfosFirstPart=新容器(新的BoxLayout(BoxLayout.Y_轴));
ctrglobalInfosFirstPart.setScrollableY(假);
ctrglobalInfosFirstPart.setUIID(“ctrglobalInfosFirstPart”);
Label lblProviderName=新标签(“Dr”+site.getSiteYou().getShowname());
lblProviderName.setUIID(“lblNameProvider”);
ctrglobalInfosFichePro.add(lblProviderName);
试一试{
Label lblProviderSpe=new Label(new SectorConvert().getValue(site.getsiteu().getSectorfirst().intValue()).toString());
lblProviderSpe.setUIID(“lblSpeProvider”);
ctrglobalInfosFichePro.add(lblProviderSpe);
}捕获(例外e){
}如果(site.getSiteOption().getCbcard()| | site.getSiteOption().getCheckp()| | site.getSiteOption().getSpecies()){
标签LBLPIEment=新标签(“MOYENS DE PAIEMENT”);
lblpiement.setUIID(“lbltitleforspan标签”);
lblPaiement.setVerticalAlignment(组件中心);
字符串AcceptedPaItem=“”;
if(site.getSiteOption().getCbcard()){
AcceptedPaItem+=“CB/”;
}
标签lblAcceptedPaiement=新标签(已接受的标签);
ctrglobalInfosFirstPart.add(LBLPiement);
ctrglobalInfosFirstPart.add(lblAcceptedPaiement);
}
//第二部分
Container CtrGlobalInvoseCondPart=新容器(新边界布局());
如果(site.getSiteYou().getPhonepro().trim().length()!=0){
Ctrglobalinfosecondpart.setUIID(“ctrglobalInfosFirstPart”);
按钮btnAppeler=新按钮(“Appeler”);
btnAppeler.setUIID(“btnAppelerFi