Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » View in VE is wrong after upgrade to 1.1
View in VE is wrong after upgrade to 1.1 [message #610424] Mon, 29 August 2005 11:38
Robert BjervÃ¥s is currently offline Robert BjervÃ¥sFriend
Messages: 4
Registered: July 2009
Junior Member
I have used Eclipse 3.0.2 and VE 1.0.2 for a while. I use a base class
inheriting Composite to have a simple OO-design. After upgrading to
Eclipse 3.1 and VE 1.1 are the final classes (implementing the base class)
viewed in a wrong way (all components are in the upper left corner). Why
is is so? And is there a simple way to solve this issue by rewriting some
part of the code in the example?

Example:
In the example is Simple not viewed correct.

/Robert

BasePanel.java
==============
package simple;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;

/**
* Abstract class to be used as the common base for different
implementations
*/
public abstract class BasePanel extends Composite {

private Composite top = null;
private Composite bottom = null;

public BasePanel(Composite parent, int style) {
super(parent, style);
initialize();
}
public Composite getBottom() {
return bottom;
}
public Composite getTop() {
return top;
}
private void initialize() {
FormLayout layout1 = new FormLayout();
layout1.marginHeight = 3;
layout1.marginWidth = 3;
layout1.spacing = 3;
setBackground(new Color(Display.getDefault(), 128, 128, 255));
createBottom();
createTop();
setSize(new Point(300,200));
setLayout(layout1);
}
private void createTop() {
FillLayout layout2 = new FillLayout();
FormData formData1 = new FormData();
FormAttachment l = new FormAttachment(0);
FormAttachment r = new FormAttachment(100);
FormAttachment t = new FormAttachment(0);
FormAttachment b = new FormAttachment(bottom);
formData1.left = l;
formData1.right = r;
formData1.top = t;
formData1.bottom = b;
layout2.marginHeight = 3;
layout2.marginWidth = 3;
layout2.spacing = 3;
top = new Composite(this, SWT.NONE);
top.setBackground(new Color(Display.getDefault(), 255, 128, 128));
top.setLayoutData(formData1);
top.setLayout(layout2);
}
private void createBottom() {
FillLayout layout3 = new FillLayout();
FormData formData2 = new FormData();
FormAttachment l = new FormAttachment(0);
FormAttachment r = new FormAttachment(100);
FormAttachment b = new FormAttachment(100);
formData2.left = l;
formData2.right = r;
formData2.bottom = b;
formData2.height = 50;
layout3.marginHeight = 3;
layout3.marginWidth = 3;
layout3.spacing = 3;
bottom = new Composite(this, SWT.NONE);
bottom.setBackground(new Color(Display.getDefault(), 128, 255, 128));
bottom.setLayoutData(formData2);
bottom.setLayout(layout3);
}
}

FooPanel.java
=============
package simple;

import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;
/**
* An implementation of BasePanel
*/
public class FooPanel extends BasePanel {
private Button button = null;
private Text text = null;
public FooPanel(Composite parent, int style) {
super(parent, style);
initialize();
}
private void initialize() {
button = new Button(getBottom(), SWT.NONE);
text = new Text(getTop(), SWT.BORDER);
button.setText("Push");
}
}

Simple.java
===========
package simple;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.SWT;
/**
* A simple window for testing VE using inheritage
*/
public class Simple {
private Shell sShell = null;
private Composite fooPanel = null;
private void createSShell() {
sShell = new Shell(SWT.DIALOG_TRIM | SWT.RESIZE);
createComposite();
sShell.setText("Simple test of VE");
sShell.setLayout(new FillLayout());
sShell.setSize(new Point(300,200));
}
private void createComposite() {
fooPanel = new FooPanel(sShell, SWT.NONE);
}
public static void main(String[] args) {
Simple simple = new Simple();
Display display = new Display();
simple.createSShell();
simple.sShell.open();
while (!simple.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Previous Topic:problem to debug VE into eclipse 3.1.0 ?
Next Topic:VE development problem
Goto Forum:
  


Current Time: Fri Apr 26 16:45:27 GMT 2024

Powered by FUDForum. Page generated in 0.02482 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top