swt表对单元格中的文本长度有限制吗?

编程入门 行业动态 更新时间:2024-10-26 19:33:27
本文介绍了swt表对单元格中的文本长度有限制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用JFace TableViewer和数据绑定来显示数据库表的数据,有些列的文本很长,我发现文本被切掉了.如果我激活与该单元格关联的文本编辑器,则可以看到全文.

I use JFace TableViewer and databinding to display data of a database table, some columns have very long text, I found the text is cut out. if I activate the text editor associated with that cell, I can see the full text.

swt表对单元格中的文本长度有限制吗?还是操作系统有这样的限制?(我正在使用eclipse 3.6和Windows 7 32位)

Does swt table has limitation on text length in a cell ? or the OS has such limitation ?(I am using eclipse 3.6 and windows 7 32 bit)

/******************************************************************************* * Copyright (c) 2006 Tom Schindl and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * www.eclipse/legal/epl-v10.html * * Contributors: * Tom Schindl - initial API and implementation *******************************************************************************/ package org.eclipse.jface.snippets.viewers; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; /** * A simple TableViewer to demonstrate usage * * @author Tom Schindl <tom.schindl@bestsolution.at> * */ public class Snippet001TableViewer { private class MyContentProvider implements IStructuredContentProvider { /* (non-Javadoc) * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) */ public Object[] getElements(Object inputElement) { return (MyModel[])inputElement; } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#dispose() */ public void dispose() { } /* (non-Javadoc) * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } } public class MyModel { public int counter; public MyModel(int counter) { this.counter = counter; } public String toString() { **return "very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooog text" + this.counter;** } } public Snippet001TableViewer(Shell shell) { final TableViewer v = new TableViewer(shell); v.setLabelProvider(new LabelProvider()); v.setContentProvider(new MyContentProvider()); MyModel[] model = createModel(); v.setInput(model); v.getTable().setLinesVisible(true); } private MyModel[] createModel() { MyModel[] elements = new MyModel[10]; for( int i = 0; i < 10; i++ ) { elements[i] = new MyModel(i); } return elements; } /** * @param args */ public static void main(String[] args) { Display display = new Display (); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); new Snippet001TableViewer(shell); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }

推荐答案

这是Windows bug/功能(有关详细信息,请参见bugzilla ),这是证明(代码的Linux屏幕截图)

It's windows bug/feature (see bugzilla for details), here is the proof (linux screenshot of your code)

我可能可以通过自我单元格渲染来解决此错误/功能(请参见自定义工程图表格和树项教程.

I may be possible to workaround this bug/feature by self cell rendering (see Custom Drawing Table and Tree Items tutorial).

更多推荐

swt表对单元格中的文本长度有限制吗?

本文发布于:2023-10-17 11:05:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元格   长度   文本   swt

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!