Blog do projektu Open Source JavaHotel

poniedziałek, 3 marca 2014

Jython MVP, enhancement

Introduction
I added several enhancement to MVP Jython framework. The source code is available here. The sample application (Google App Engine) is available here.
Show, hide, enable and disable buttons
The description is available here.
Custom button in list tool bar and image button

Description is available here.
Blobs, download and upload
All blob content (files) are stored in a single table. It is possible to upload and download content via UI and also API for blob handling is available directly. More information is available here.
PDF
I want also add a PDF creation. But it is not easy to find a package which works in Google App Engine. The iText looks promising. It can be reached from Jython directly - look sample.
from com.itextpdf.text import DocumentException
from com.itextpdf.text import Paragraph
from com.itextpdf.text.pdf import PdfWriter

def createPDF(var) :
  
    # step 1
    document = Document()
    b = ByteArrayOutputStream()
    # step 2
    PdfWriter.getInstance(document, b)
    # step 3
    document.open()
    # step 4
    document.add(Paragraph("Hello World!"))
    #step 5
    document.close()
    return b.toByteArray()
Practical test in Google App Engine environment: http://jythonui.appspot.com/?start=startleft.xml  -> Different lists -> Dialog with attachments -> Upload -> PDF

Brak komentarzy:

Prześlij komentarz