Saturday, December 27, 2008

Switching Dialog

Thanks for the answer, i think that then i have to do it for myself, for now i have one dialog similar to that, only that whith vertical scroll.

package es.telefonica.ui.menus;

import net.rim.device.api.i18n.ResourceBundle;
import net.rim.device.api.system.EncodedImage;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.Keypad;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.Dialog;
import es.telefonica.cmcore.ComunicadorCore;
import es.telefonica.common.MensajesLog;
import es.telefonica.countryinfo.CountryResource;
import es.telefonica.icons.IconosResource;
import es.telefonica.ui.componentes.BotonContactos;
import es.telefonica.ui.componentes.ImagenException;

/**
* Dialogo que sirve para seleccionar los posibles estados de presencia
* Ejemplo:Ausente, Conectado, etc..-
* @author jose
*
*/
public class DialogoEstados extends Dialog
{

private static ResourceBundle countryResource = ResourceBundle.getBundle(
CountryResource.BUNDLE_ID, CountryResource.BUNDLE_NAME);

private static ResourceBundle iconResource = ResourceBundle.getBundle(
IconosResource.BUNDLE_ID, IconosResource.BUNDLE_NAME);


private BotonContactos desconectado;
private BotonContactos conectado;
private BotonContactos ocupado;
private BotonContactos vuelvoEnseguida;
private BotonContactos ausente;
private BotonContactos alTelefono;

/**
* El constructor ya crea un dialogo con los botones y el titulo correctos
*/
public DialogoEstados()
{
super(countryResource.getString(CountryResource.Title_Status_Dialog),null,null,0,null,Manager.VERTICAL_SCROLL);
try
{
desconectado=new BotonContactos();
desconectado.setImagenEstado(ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Disconnected)));
// TODO Auto-generated catch block
desconectado.setLabelNombre(countryResource.getString(CountryResource.Disconnected));

this.add(desconectado);

conectado=new BotonContactos();
conectado.setImagenEstado(ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Connected)));
conectado.setLabelNombre(countryResource.getString(CountryResource.Connected));

this.add(conectado);

ocupado=new BotonContactos();
ocupado.setImagenEstado(ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Busy)));
ocupado.setLabelNombre(countryResource.getString(CountryResource.Busy));

this.add(ocupado);

vuelvoEnseguida=new BotonContactos();
vuelvoEnseguida.setImagenEstado(ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Back_Right_Away)));
vuelvoEnseguida.setLabelNombre(countryResource.getString(CountryResource.BackRightAway));

this.add(vuelvoEnseguida);

ausente=new BotonContactos();
ausente.setImagenEstado(ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Absent)));
ausente.setLabelNombre(countryResource.getString(CountryResource.Absent));

this.add(ausente);

alTelefono=new BotonContactos();
alTelefono.setImagenEstado(ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_To_The_Phone)));
alTelefono.setLabelNombre(countryResource.getString(CountryResource.ToThePhone));

this.add(alTelefono);
}
catch (ImagenException e)
{
e.printStackTrace();
}

}

/**
* Metodo que se ejecuta cuando se pulsa la rueda
*/
protected boolean navigationClick(int status, int time)
{
onSeleccion();
return super.navigationUnclick(status, time);
}

/**
* MEtodo que se ejecuta cuando se pulsa una tecla, en este caso no interesa solo el Enter y el Escape
*/
protected boolean keyChar(char key, int status, int time)
{
// TODO Auto-generated method stub
if(key==Keypad.KEY_ENTER)
{
onSeleccion();
}
else if(key==Keypad.KEY_ESCAPE)
{
this.close();
}
return super.keyChar(key, status, time);
}

/**
* Este metodo es el que extrae el boton que actualmente esta seleccionado, y ejecuta el cambio de estado
*/
private void onSeleccion()
{
Field panelVertical = this.getFieldWithFocus();
if(panelVertical instanceof Manager)
{
Manager manager=(Manager)panelVertical;
Field campoSeleccionado = manager.getFieldWithFocus();
campoSeleccionado.getBorderBottom();

EncodedImage imagenEstado=null;
if(campoSeleccionado instanceof BotonContactos)
{
try
{
BotonContactos boton=(BotonContactos)campoSeleccionado;
String id = boton.getLabelNombre();
if(id.equals(countryResource.getString(CountryResource.Disconnected)))
{
imagenEstado=ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Disconnected));
MensajesLog.debug(DialogoEstados.class, "Seleccionado: "+countryResource.getString(CountryResource.Disconnected));
}
else if(id.equals(countryResource.getString(CountryResource.Connected)))
{
imagenEstado=ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Connected));
MensajesLog.debug(DialogoEstados.class, "Seleccionado: "+countryResource.getString(CountryResource.Connected));
}
else if(id.equals(countryResource.getString(CountryResource.Busy)))
{
imagenEstado=ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Busy));
MensajesLog.debug(DialogoEstados.class, "Seleccionado: "+countryResource.getString(CountryResource.Busy));
}
else if(id.equals(countryResource.getString(CountryResource.BackRightAway)))
{
imagenEstado=ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Back_Right_Away));
MensajesLog.debug(DialogoEstados.class, "Seleccionado: "+countryResource.getString(CountryResource.BackRightAway));
}
else if(id.equals(countryResource.getString(CountryResource.Absent)))
{
imagenEstado=ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_Absent));
MensajesLog.debug(DialogoEstados.class, "Seleccionado: "+countryResource.getString(CountryResource.Absent));
}
else if(id.equals(countryResource.getString(CountryResource.ToThePhone)))
{
imagenEstado=ComunicadorCore.getGestorImagenes().getImagen(iconResource.getString(IconosResource.Image_To_The_Phone));
MensajesLog.debug(DialogoEstados.class, "Seleccionado: "+countryResource.getString(CountryResource.ToThePhone));
}

//TODO cambiar el icono del usuario
if(imagenEstado!=null)
{

}
}
catch(ImagenException e)
{
e.printStackTrace();
}
finally
{
this.close();
}
}
}
}
}

thanks

Blackberry Virtual Keyboard

Well I have finally resolved this by developing my own home grown virtual keyboard. This should work until RIM fixes the bug with their virtual keyboard. In case anyone else is having the same problem, I have provide the code for it here:

public class MyVirtualKeyboard extends VerticalFieldManager
{
// 1---2---3
// 4---5---6
// 7---8---9
// .---0---x
private ButtonField[] numbers = new ButtonField[]
{
new ButtonField("1", ButtonField.CONSUME_CLICK),
new ButtonField("2", ButtonField.CONSUME_CLICK),
new ButtonField("3", ButtonField.CONSUME_CLICK),
new ButtonField("4", ButtonField.CONSUME_CLICK),
new ButtonField("5", ButtonField.CONSUME_CLICK),
new ButtonField("6", ButtonField.CONSUME_CLICK),
new ButtonField("7", ButtonField.CONSUME_CLICK),
new ButtonField("8", ButtonField.CONSUME_CLICK),
new ButtonField("9", ButtonField.CONSUME_CLICK),
new ButtonField(".", ButtonField.CONSUME_CLICK),
new ButtonField("0", ButtonField.CONSUME_CLICK),
new ButtonField("x", ButtonField.CONSUME_CLICK),
};
private ButtonField close = new ButtonField("Close",
ButtonField.CONSUME_CLICK);
private FieldChangeListener listener = new FieldChangeListener()
{
public void fieldChanged(Field f, int ctx)
{
if (ctx == FieldChangeListener.PROGRAMMATIC)
return;
String val = ((ButtonField) f).getLabel();
if (Character.isDigit(val.charAt(0)) || val.equals(".":smileywink:)
caller.setCharacter(val);
else if (val.equals("x":smileywink:)
caller.removeLastCharacter();
}
};
private Caller caller;

public MyVirtualKeyboard(Caller caller)
{
this.caller = caller;
// 4 rows of buttons will be displayed
int buttonIndex = 0;
for (int i = 0; i < 4; i++)
{
HorizontalFieldManager row = new HorizontalFieldManager();
for (int j = 0; j < 3; j++)
{
numbers[buttonIndex].setChangeListener(listener);
row.add(numbers[buttonIndex++]);
}
add(row);
}
close.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int ctx)
{
MyVirtualKeyboard.this.caller.closeMe();
}
});
add(close);
}
}

Here is the interface I created callled 'Caller':

public interface Caller
{
public void closeMe();
public void setCharacter(String character);
public void removeLastCharacter();
}

Here is how I invoke it (this code is in my MainScreen subclass, which is implementing FocusChangeListener and my call back interface Caller):

public void focusChanged(Field field, int ctx) {
currentlyEditing = null;
if (field != checkAmt && field != taxAmt)
return;
if (ctx == FocusChangeListener.FOCUS_GAINED)
{
currentlyEditing = (BasicEditField) field;
MyVirtualKeyboard keyboard = new MyVirtualKeyboard(this);
popup = new PopupScreen(keyboard);
getUiEngine().pushScreen(popup);
}
}

Here is the callback methods on the main screen class that take the input from the popup keyboard:

public void setCharacter(String character)
{
String currText = currentlyEditing.getText();
currText += character;
currentlyEditing.setText(currText);
}

public void removeLastCharacter()
{
String currText = currentlyEditing.getText();
if (currText.length() == 0)
return;
currentlyEditing.setText(currText.substring(0, currText.length() - 1));
}

public void closeMe()
{
getUiEngine().popScreen(popup);
}

Also, I have a menu item where if the user needs to display the keyboard, they can:

showKeyboard = new MenuItem("Show Keyboard", 3, 12) {
public void run()
{
MyVirtualKeyboard keyboard = new MyVirtualKeyboard(
MyScreen.this);
popup = new PopupScreen(keyboard);
getUiEngine().pushScreen(popup);
}
};

Here is what the popup virtual keyboard looks like:

virtual keyboard for floating point

Hopefully this will help someone else.

Message Edited by stevewarsa on 12-07-2008 08:02 AM

Tuesday, December 9, 2008

Redmine

Redmine

Redmine is a flexible project management web application. Written using Ruby on Rails framework, it is cross-platform and cross-database.

Redmine is open source and released under the terms of the GNU General Public License v2 (GPL).

Overview

  • Multiple projects support
  • Flexible role based access control.
  • Flexible issue tracking system
  • Gantt chart and calendar
  • News, documents & files management
  • Feeds & email notifications.
  • Per project wiki
  • Per project forums
  • Simple time tracking functionality
  • Custom fields for issues, projects and users
  • SCM integration (SVN, CVS, Git, Mercurial, Bazaar and Darcs)
  • Multiple LDAP authentication support
  • User self-registration support
  • Multilanguage support
  • Multiple databases support

Read more about Redmine features

Documentation

You can read the Redmine guide (work in progress).

Others resources:

They are using Redmine

This page lists some companies/projects using Redmine.

Support & getting help

For getting help or discussing about Redmine, you can browse the Redmine forums hosted right here in Redmine. Or, join #redmine on the freenode IRC network. Prior to March 7, 2008, the Redmine forums were hosted at Rubyforge. You can search the old forum archives as well.

Before submitting a bug report here, please read this: SubmittingBugs.