|
|
Re: WorkbenchWindowControlContribution resize problem in trim area [message #507514 is a reply to message #507502] |
Wed, 13 January 2010 13:12 |
Eclipse User |
|
|
|
Originally posted by: jccanova.gmail.com
Have you tried composite.getParent().layout(true, true). ?
this means that the parent will check if the control (parent) need a resize
and cascade the method call to its children.
In matter of fact... layout ()... call the method bellow passing the second
parameter as false. while the layout (true,true) call the same method
passing the second argument as true... also if you understand what this
method bellow does... let me know :).
void updateLayout (boolean resize, boolean all) {
Composite parent = findDeferredControl ();
if (parent != null) {
parent.state |= LAYOUT_CHILD;
return;
}
if ((state & LAYOUT_NEEDED) != 0) {
boolean changed = (state & LAYOUT_CHANGED) != 0;
state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
if (resize) setResizeChildren (false);
layout.layout (this, changed);
if (resize) setResizeChildren (true);
}
if (all) {
state &= ~LAYOUT_CHILD;
Control [] children = _getChildren ();
for (int i=0; i<children.length; i++) {
children [i].updateLayout (resize, all);
}
}
}
Just a question is you composite inside the toolbar or you have a button
that when pressed shows your composite passing as argument the parent ?
regards.
"Jan" <jan.kuenstler@bader-jene.de> wrote in message
news:hikuld$uig$1@build.eclipse.org...
> myToolbar is only resizing/redraw correctly on mouse drag. There must be a
> way to this programmatically.
>
> Anyone?
|
|
|
Re: WorkbenchWindowControlContribution resize problem in trim area [message #507516 is a reply to message #507514] |
Wed, 13 January 2010 18:17 |
Eclipse User |
|
|
|
Originally posted by: jccanova.gmail.com
Assume the "receiver" means "this" (Carolyn - Answer 2 days ago - in swt
forum).
The part changed argument (first boolean) means that "no flushCache()"
method call will be called if you passed as "false"... i guess the cache in
question means that some property of the layout
is cached in some Layout classes.
I still need to know which layout has a cache and which does not. I guess
your question if good for the eclipse SWT .. i guess.
Carolyn from IBM is a subject matter expert in SWT in the swt forum.
The Javadoc stands the following. in the layout(bool,bool).
/**
* If the receiver has a layout, asks the layout to <em>lay out</em>
* (that is, set the size and location of) the receiver's children.
* If the changed argument is <code>true</code> the layout must not rely
* on any information it has cached about its children. If it
* is <code>false</code> the layout may (potentially) optimize the
* work it is doing by assuming that none of the receiver's
* children has changed state since the last layout.
* If the all argument is <code>true</code> the layout will cascade down
* through all child widgets in the receiver's widget tree, regardless of
* whether the child has changed size. The changed argument is applied to
* all layouts. If the all argument is <code>false</code>, the layout will
* <em>not</em> cascade down through all child widgets in the receiver's
widget
* tree. However, if a child is resized as a result of a call to layout,
the
* resize event will invoke the layout of the child. Note that
* a layout due to a resize will not flush any cached information
* (same as <code>layout(false)</code>).
* </p>
* <p>
* Note: Layout is different from painting. If a child is
* moved or resized such that an area in the parent is
* exposed, then the parent will paint. If no child is
* affected, the parent will not paint.
* </p>
"Jose Carlos Canova" <jccanova@gmail.com> wrote in message
news:hil22c$qg0$1@build.eclipse.org...
> Have you tried composite.getParent().layout(true, true). ?
> this means that the parent will check if the control (parent) need a
> resize and cascade the method call to its children.
>
> In matter of fact... layout ()... call the method bellow passing the
> second parameter as false. while the layout (true,true) call the same
> method passing the second argument as true... also if you understand what
> this method bellow does... let me know :).
>
>
> void updateLayout (boolean resize, boolean all) {
> Composite parent = findDeferredControl ();
> if (parent != null) {
> parent.state |= LAYOUT_CHILD;
> return;
> }
> if ((state & LAYOUT_NEEDED) != 0) {
> boolean changed = (state & LAYOUT_CHANGED) != 0;
> state &= ~(LAYOUT_NEEDED | LAYOUT_CHANGED);
> if (resize) setResizeChildren (false);
> layout.layout (this, changed);
> if (resize) setResizeChildren (true);
> }
> if (all) {
> state &= ~LAYOUT_CHILD;
> Control [] children = _getChildren ();
> for (int i=0; i<children.length; i++) {
> children [i].updateLayout (resize, all);
> }
> }
> }
>
>
> Just a question is you composite inside the toolbar or you have a button
> that when pressed shows your composite passing as argument the parent ?
>
> regards.
>
> "Jan" <jan.kuenstler@bader-jene.de> wrote in message
> news:hikuld$uig$1@build.eclipse.org...
>> myToolbar is only resizing/redraw correctly on mouse drag. There must be
>> a way to this programmatically.
>>
>> Anyone?
>
|
|
|
|
|
|
|
Re: WorkbenchWindowControlContribution resize problem in trim area [message #1079877 is a reply to message #758287] |
Mon, 05 August 2013 07:31 |
Brian Lei Messages: 1 Registered: August 2013 |
Junior Member |
|
|
Hi , i had this problem with it. And try to fixed it according to your solution. But the application always error below when a inner Class Observer call getParent().update(true) this line : java.lang.IllegalArgumentException: Argument not valid. So how to fix it?
@Override
protected Control createControl(Composite parent) {
if (!init) {
composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true));
composite.setLayout(new GridLayout());
labelStatus = new Label(composite, SWT.NONE);
labelStatus.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true));
CurrentLabelManager.getLabelObserver().addObserver(selectionObserver);
init = true;
}
if (!labelStatus.isDisposed())
labelStatus.setText(status);
return composite;
}
Observer selectionObserver = new Observer(){
@Override
public void update(Observable o, Object arg) {
List<MultiItem> selectionList = (List<MultiItem> )arg;
if (selectionList != null && selectionList.size()!= 1) {
labelStatus.setText(selectionList.size() + " rows selected");
} else {
PhoneLabel label = CurrentLabelManager.getCurrentLabel();
if (label != null ) {
StringBuffer sb = new StringBuffer();
sb.append("Product:" + label.getProductName());
sb.append(" ");
sb.append("Module:"+label.getModuleName());
sb.append(" ");
sb.append("Label:"+label.getName());
sb.append(" ");
sb.append("Master text:"+label.getMasterText().getColumnText(ColumnCodes.MASTER_TXT));
// if (!labelStatus.isDisposed())
// labelStatus.setText(sb.toString().trim());
status = sb.toString();
SelectedLabelInfoControl.this.updateStatus();
}
}
}
};
private void updateStatus(){
getParent().update(true);
}
/**
* for void happen widge is disposed error.
*/
@Override
public boolean isDynamic(){
return true;
}
|
|
|
Powered by
FUDForum. Page generated in 0.04357 seconds