previousImage = getPreviousImage(iwc, imageFolder, imageNumber); nextImage = getNextImage(iwc, imageFolder, imageNumber);
previousImage = getPreviousImage(iwc, imageFolder, imageNumber - 1); nextImage = getNextImage(iwc, imageFolder, imageNumber + 1);
  public void main(IWContext iwc){    IWResourceBundle iwrb = getResourceBundle(iwc);        Image image = null;    String info = null;    String title = "";    this.setAllMargins(0);    // set size		setSize(iwc);    // get title    if (iwc.isParameterSet(PARAMETER_TITLE))      title = iwc.getParameter(PARAMETER_TITLE);    // set title    setTitle(title);     // get info text     if(iwc.isParameterSet(PARAMETER_INFO))      info = iwc.getParameter(PARAMETER_INFO);    // get image    int id = -1;    if(iwc.isParameterSet(PARAMETER_IMAGE_ID)){      try {        id = Integer.parseInt(iwc.getParameter(PARAMETER_IMAGE_ID));        image = new Image(id);      }      catch (Exception ex) {        info = "We are sorry: Image is not available";      }    }        int imageNumber = -1;    if (iwc.isParameterSet(PARAMETER_IMAGE_NUMBER)) {    		imageNumber = Integer.parseInt(iwc.getParameter(PARAMETER_IMAGE_NUMBER));    }    AdvancedImage previousImage = null;    AdvancedImage nextImage = null;    if (id != -1) {			try {				ICFile imageFile = ((ICFileHome) IDOLookup.getHome(ICFile.class)).findByPrimaryKey(new Integer(id));				ICFile imageFolder = (ICFile) imageFile.getParentEntity();								previousImage = getPreviousImage(iwc, imageFolder, imageNumber);				nextImage = getNextImage(iwc, imageFolder, imageNumber);			}			catch (IDOLookupException ile) {				log(ile);			}			catch (FinderException fe) {				log(fe);			}    }        // define frameTable to force to show the image in the center    // of the window		Table frameTable = setFrameTable();        // define table with the image and the info    Table table = new Table(1,3);    // set aligments    table.setAlignment(1,1,Table.HORIZONTAL_ALIGN_CENTER);    table.setAlignment(1,2,Table.HORIZONTAL_ALIGN_CENTER);    table.setAlignment(1,3,Table.HORIZONTAL_ALIGN_CENTER);    // add image if available    if(image !=null){      table.add(image,1,1);    // add info if necessary      if(info!=null)        table.add(info,1,2);    }        Table buttonTable = new Table(3, 1);    buttonTable.setWidth(Table.HUNDRED_PERCENT);    buttonTable.setWidth(1, "33%");    buttonTable.setWidth(2, "33%");    buttonTable.setWidth(3, "33%");    buttonTable.setAlignment(2, 1, Table.HORIZONTAL_ALIGN_CENTER);    buttonTable.setAlignment(3, 1, Table.HORIZONTAL_ALIGN_RIGHT);        Link close = new Link(iwrb.getLocalizedString("close", "Close"));    close.setAsCloseLink();    buttonTable.add(close, 2, 1);        if (previousImage != null) {    		try {    			Link previous = getImageLink(iwc, iwrb.getLocalizedString("previous", "Previous"), previousImage, imageNumber - 1);    			buttonTable.add(previous, 1, 1);    		}    		catch (Exception e) {    			log(e);    		}    }    if (nextImage != null) {	  		try {	  			Link next = getImageLink(iwc, iwrb.getLocalizedString("next", "Next"), nextImage, imageNumber + 1);	  			buttonTable.add(next, 3, 1);	  		}	  		catch (Exception e) {	  			log(e);	  		}    }    table.add(buttonTable,1,3);    frameTable.add(table);    add(frameTable);  }