Skip to main content

List scrollbar issues using renderingPrototype

3 replies [Last post]
francisdb
Offline
Joined: 2006-06-16

Hi,

Are there any list scrollbar issues in the last drop? Our list has a rendering prototype set and I think the scollbar is calculated using the real renderer instead of the prototype renderer. When we scroll to the bottom of the list, the scrollbar stays about 60 pixels from the bottom of the screen.

There might be a link to the extra one pixel painted for the textfield's fourth line (the prototype has only 3 lines) see this previous issue:
http://forums.java.net/jive/thread.jspa?threadID=44182&tstart=25

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Shai Almog

Hi,
we fixed a miscalculation of list height because of fisheye issues
but I can't see a problem with the rendering prototype. If you can
reproduce this it would be helpful.

Thanks.

> Hi,
>
> Are there any list scrollbar issues in the last drop? Our list has
> a rendering prototype set and I think the scollbar is calculated
> using the real renderer instead of the prototype renderer. When we
> scroll to the bottom of the list, the scrollbar stays about 60
> pixels from the bottom of the screen.
>
> There might be a link to the extra one pixel painted for the
> textfield's fourth line (the prototype has only 3 lines) see this
> previous issue:
> http://forums.java.net/jive/thread.jspa?threadID=44182&tstart=25
> [Message sent by forum member 'francisdb' (francisdb)]
>
> http://forums.java.net/jive/thread.jspa?messageID=290102
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]

Francis De Brabandere

this application demonstrates both bugs (Might have something to do
with the different image sizes...)

import com.sun.lwuit.Component;
import com.sun.lwuit.Container;
import com.sun.lwuit.Font;
import com.sun.lwuit.Form;
import com.sun.lwuit.Image;
import com.sun.lwuit.Label;
import com.sun.lwuit.List;
import com.sun.lwuit.TextArea;
import com.sun.lwuit.layouts.BorderLayout;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.list.DefaultListCellRenderer;
import com.sun.lwuit.list.DefaultListModel;
import com.sun.lwuit.list.ListCellRenderer;
import com.sun.lwuit.list.ListModel;

import java.util.Vector;

/**
*
* @author francisdb
*/
public class TestForm2 extends Form {

private List listComp;

public TestForm2() {
this.setLayout(new BorderLayout());
this.setScrollable(false);
this.listComp = createList(createModel());

addComponent(BorderLayout.CENTER, listComp);
}

private ListModel createModel() {
Vector videos = new Vector();
Video video = null;
for (int i = 0; i < 10; i++) {
video = createPrototype();
video.setTitle("test "+i);
video.setDescription("This is a veeeery\n long description
ttttthat should span over at least 4 lines on a 320 * 240 screen. I
hope we get there :-)... bla bla bla now let's try this");
videos.addElement(video);
}

ListModel model = new DefaultListModel(videos);
return model;
}

private Video createPrototype() {
Video prototype = new Video();
prototype.setTitle("TestProt");
prototype.setAdded("Today");
prototype.setCategory("Test");
prototype.setLength(320);
prototype.setSource("Test source");
prototype.setDescription("A medium to short description for
the video prototype");
prototype.setThumbnailId(0);
return prototype;
}

private List createList(ListModel model) {
List list = new List();

list.setRenderingPrototype(createPrototype());
list.getStyle().setBorder(null);
list.setSmoothScrolling(false);
list.getStyle().setBgTransparency(0);
list.setListCellRenderer(new VideoRenderer());
list.setModel(model);
return list;
}

private class VideoRenderer extends Container implements ListCellRenderer {

private final ListCellRenderer original;
private Label title = new Label("");
private TextArea description = new TextArea(3, 50);
private Label pic = new Label();

public VideoRenderer() {
this.original = new DefaultListCellRenderer();
setLayout(new BorderLayout());
Container picContainer = new Container(new
BoxLayout(BoxLayout.Y_AXIS));
picContainer.addComponent(pic);
addComponent(BorderLayout.WEST, picContainer);
pic.getStyle().setBgTransparency(0);
title.getStyle().setBgTransparency(0);
title.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM,
Font.STYLE_BOLD, Font.SIZE_SMALL));
addComponent(BorderLayout.NORTH, title);
description.getStyle().setBgTransparency(0);
description.getStyle().setBorder(null);
description.setIsScrollVisible(false);
description.setGrowByContent(false);
addComponent(BorderLayout.CENTER, description);
}

public Component getListCellRendererComponent(List list,
Object value, int index, boolean isSelected) {
Video video = (Video) value;
title.setText(video.getTitle());
String descr = video.getSource() + " " + video.getLength()
+ "\n" + video.getDescription();
description.setText(descr);

if("TestProt".equals(video.getTitle()) || "test
1".equals(video.getTitle())){
pic.setIcon(Image.createImage(60, 45));
}else{
pic.setIcon(Image.createImage(100, 75));
}
return this;
}

public Component getListFocusComponent(List list) {
return original.getListFocusComponent(list);
}
}

/**
*
* @author francisdb
*/
public class Video {

private int id;
private int thumbnailId;
private String title;
private String description;
private String extension;
private String category;
private String source;
private String added;
private long length;

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public int getThumbnailId() {
return thumbnailId;
}

public void setThumbnailId(int thumbnailId) {
this.thumbnailId = thumbnailId;
}

public String getExtension() {
return extension;
}

public void setExtension(String extension) {
this.extension = extension;
}

public long getLength() {
return length;
}

public void setLength(long length) {
this.length = length;
}

public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public String getAdded() {
return added;
}

public void setAdded(String added) {
this.added = added;
}

public String getSource() {
return source;
}

public void setSource(String source) {
this.source = source;
}

}
}

On Tue, Jul 29, 2008 at 5:56 PM, Shai Almog wrote:
> Hi,
> we fixed a miscalculation of list height because of fisheye issues but I
> can't see a problem with the rendering prototype. If you can reproduce this
> it would be helpful.
> Thanks.
>
> Hi,
> Are there any list scrollbar issues in the last drop? Our list has a
> rendering prototype set and I think the scollbar is calculated using the
> real renderer instead of the prototype renderer. When we scroll to the
> bottom of the list, the scrollbar stays about 60 pixels from the bottom of
> the screen.
> There might be a link to the extra one pixel painted for the textfield's
> fourth line (the prototype has only 3 lines) see this previous issue:
> http://forums.java.net/jive/thread.jspa?threadID=44182&tstart=25
> [Message sent by forum member 'francisdb' (francisdb)]
> http://forums.java.net/jive/thread.jspa?messageID=290102
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
> Shai Almog
> http://lwuit.blogspot.com/
>

--
http://www.somatik.be
Microsoft gives you windows, Linux gives you the whole house.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

Shai Almog

Hi Francis,
there is an issue in the way in which we calculate preferred size
(this is done from two separate locations, I'm not very happy about
that). This is fixed now and will hopefully make it to the next drop.

Thanks!
Shai.


> this application demonstrates both bugs (Might have something to do
> with the different image sizes...)
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]
[Picture 97.png]