Saturday, November 18, 2006

Java2Html - Download

http://www.java2html.de/download.html

Netbeans Module Development

Netbeans Module Development - 1

Date: 18 Nov' 2006

This example adds "Export Sources" menu item to File Menu in the IDE. Onclicking it displays a message box and creates an output tab and writes into in.

Requires:

Dialogs API, I/O API, Utilities API


package org.deb.exportmodule;

import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
import org.openide.windows.OutputWriter;

public final class ExportFiles extends CallableSystemAction
{

public void performAction()
{
InputOutput io = IOProvider.getDefault().getIO("Hello", true);
NotifyDescriptor d = new NotifyDescriptor.Message("I am plugged in!", NotifyDescriptor.INFORMATION_MESSAGE);
DialogDisplayer.getDefault().notify(d);
io.getOut().println("Hello from standard out");
io.getErr().println("Hello from standard err"); //this text should appear in red
io.getOut().close();
io.getErr().close();
}

public String getName()
{
return NbBundle.getMessage(ExportFiles.class, "CTL_ExportFiles");
}

protected void initialize()
{
super.initialize();
// see org.openide.util.actions.SystemAction.iconResource() javadoc for more details
putValue("noIconInMenu", Boolean.TRUE);
}

public HelpCtx getHelpCtx()
{
return HelpCtx.DEFAULT_HELP;
}

protected boolean asynchronous()
{
return true;
}

}















Friday, November 17, 2006

Mailing in Java Using Lotus Notes

Mailing in Java Using Lotus Notes
Date: 17 November' 2006

Add to Class Path:
C:\Program Files\Lotus\Notes\Notes.jar
Add to Environment Variable:
Path=C:\Program Files\Lotus\Notes;

Download the JAR domino-1.1.jar and place in class path

http://domingo.sourceforge.net/installation.html


Source Code



import de.bea.domingo.DDocument;
import java.util.Date;
import java.util.Iterator;

import de.bea.domingo.DDatabase;
import de.bea.domingo.DNotesException;
import de.bea.domingo.DNotesFactory;
import de.bea.domingo.DSession;
import de.bea.domingo.DView;
import de.bea.domingo.DViewEntry;
import lotus.notes.addins.util.MailMessage;


//http://www-128.ibm.com/developerworks/lotus/library/ls-Java_Mail_Forwarding_Agent/index.html

public class LotusMailer {

public static void main(String[] args) throws DNotesException {

// get an instance of the domingo factory
DNotesFactory factory = DNotesFactory.getInstance();

// create a session to the local Lotus Notes client
DSession session = factory.getSession();

// get the local database names.nsf
//DDatabase database = session.getDatabase("", "names.nsf");//names.nsf
DDatabase database = session.getDatabase("SERVER", "path\\to\\mailbox.nsf");

//MailMessage
System.out.println(database.getTitle());
DView view = database.getView("($Inbox)");
Iterator allEntries = view.getAllEntries();
System.out.println("Content of view ($Inbox)");

while (allEntries.hasNext())
{
DViewEntry entry = (DViewEntry) allEntries.next();
System.out.println("Entry :: " + entry.getDocument().getAuthors());
for (int i = 0; i < entry.getColumnValues().size(); i++)
{
System.out.println(i + "." +
entry.getColumnValues().get(i).getClass().getName() + " : " +
":" + entry.getColumnValues().get(i));
}
break;
}

DDocument d = database.createDocument();
d.setSaveMessageOnSend(true);
d.appendItemValue("Subject", "Automail");
d.appendItemValue("Body", "Today " + new Date());
d.appendItemValue("SentTo", "anyone@mail.com");
d.send("anyone@mail.com");
System.out.println("Mail sent !!!");
}
}