Hi Tom,
What you said makes all the sense :-)
Follow my whole class:
package rendafixaarquitetura;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.nebula.widgets.datechooser.DateChooserCombo;
import org.eclipse.nebula.widgets.formattedtext.FormattedText;
import org.eclipse.nebula.widgets.formattedtext.NumberFormatter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.part.ViewPart;
import com.swtdesigner.ResourceManager;
public class BoletaParcialView2 extends ViewPart {
private Text text_4;
private Text text_3;
private Text text_1;
private Combo combo_3;
private Combo combo_2;
private Combo combo;
private Text text;
public static final String ID =
"rendafixaarquitetura.BoletaParcialView2"; //$NON-NLS-1$
/**
* Create contents of the view part
* @param parent
*/
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new FormLayout());
parent.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
FormToolkit toolkit = new FormToolkit(Display.getCurrent());
text = toolkit.createText(parent, null, SWT.NONE);
final FormData fd_text = new FormData();
fd_text.top = new FormAttachment(0, 145);
fd_text.left = new FormAttachment(0, 145);
text.setLayoutData(fd_text);
final Form boletaParcialForm = toolkit.createForm(parent);
final FormData fd_boletaParcialForm = new FormData();
fd_boletaParcialForm.right = new FormAttachment(100, -5);
fd_boletaParcialForm.left = new FormAttachment(0, 15);
fd_boletaParcialForm.bottom = new FormAttachment(0, 270);
fd_boletaParcialForm.top = new FormAttachment(0, 5);
boletaParcialForm.setLayoutData(fd_boletaParcialForm);
final Composite body = boletaParcialForm.getBody();
final FormData fd_body = new FormData();
fd_body.left = new FormAttachment(0, 5);
fd_body.top = new FormAttachment(0, 30);
fd_body.right = new FormAttachment(0, 479);
body.setLayoutData(fd_body);
toolkit.paintBordersFor(body);
combo = new Combo(body, SWT.NONE);
combo.setBounds(215, 24,92, 21);
toolkit.adapt(combo, true, true);
final Label contraparteLabel = toolkit.createLabel(body,
"Contraparte", SWT.NONE);
contraparteLabel.setBounds(215, 10,80, 13);
final Group group = new Group(body, SWT.NONE);
group.setText("Tipo Operação");
toolkit.adapt(group);
group.setBounds(15, 10, 89, 69);
final Button compraButton_1 = toolkit.createButton(group, "Venda", SWT.RADIO);
compraButton_1.setBounds(10, 40,63, 23);
final Button compraButton = toolkit.createButton(group, "Compra", SWT.RADIO);
compraButton.setBounds(10, 20,63, 23);
compraButton.setData("newKey", null);
//final DateTime dateTime = new DateTime(body, SWT.NONE);
final DateChooserCombo dateTime = new DateChooserCombo(body, SWT.BORDER);
dateTime.setFormatter(null);
dateTime.setRegion(null);
toolkit.adapt(dateTime, true, true);
dateTime.setBounds(110, 24, 87, 21);
final Label contraparteLabel_1 = toolkit.createLabel(body, "Data
Boletagem", SWT.NONE);
contraparteLabel_1.setBounds(110, 10, 80, 13);
combo_2 = new Combo(body, SWT.NONE);
combo_2.setBounds(320, 24, 92, 21);
toolkit.adapt(combo_2, true, true);
final Label contraparteLabel_2 = toolkit.createLabel(body, "Tipo
Ativo", SWT.NONE);
contraparteLabel_2.setBounds(320, 10, 80, 13);
final Label contraparteLabel_2_1 = toolkit.createLabel(body, "Código
Ativo", SWT.NONE);
contraparteLabel_2_1.setBounds(427, 10, 80, 13);
combo_3 = new Combo(body, SWT.NONE);
combo_3.setBounds(427, 24, 92, 17);
toolkit.adapt(combo_3, true, true);
final ImageHyperlink imageHyperlink =
toolkit.createImageHyperlink(body, SWT.NONE);
imageHyperlink.setActiveImage(ResourceManager.getPluginImage(Activator.getDefault(),
"icons/sample2.gif"));
imageHyperlink.setText("New ImageHyperlink");
imageHyperlink.setBounds(518, 24, 17, 17);
CCombo myControl = new CCombo(parent, SWT.NO);
myControl.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
// or myControl.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
toolkit.paintBordersFor(parent);
text_1 = toolkit.createText(body, null);
text_1.setBounds(540, 25, 80, 21);
final Label contraparteLabel_2_1_1 = toolkit.createLabel(body,
"Emissor", SWT.NONE);
contraparteLabel_2_1_1.setBounds(540, 10, 80, 13);
final Label contraparteLabel_2_1_1_1 = toolkit.createLabel(body,
"Índice", SWT.NONE);
contraparteLabel_2_1_1_1.setBounds(651, 10, 80, 13);
text_3 = toolkit.createText(body, null, SWT.BORDER);
text_3.setBounds(651, 24, 80, 21);
final Button liquidexButton = toolkit.createButton(body, "Liquidez",
SWT.CHECK);
liquidexButton.setBounds(120, 55, 69, 23);
final Label contraparteLabel_1_1 = toolkit.createLabel(body, "Data
Liquidação", SWT.NONE);
contraparteLabel_1_1.setBounds(215, 44, 80, 13);
final DateChooserCombo dateTime_1 = new DateChooserCombo(body, SWT.BORDER);
dateTime_1.setBounds(215, 58, 87, 21);
toolkit.adapt(dateTime_1);
final Label contraparteLabel_1_1_1 = toolkit.createLabel(body, "Data
Vencimento", SWT.NONE);
contraparteLabel_1_1_1.setBounds(320, 44, 80, 13);
final DateChooserCombo dateTime_1_1 = new DateChooserCombo(body, SWT.BORDER);
dateTime_1_1.setBounds(320, 58, 87, 21);
toolkit.adapt(dateTime_1_1);
final Label contraparteLabel_1_1_1_1 = toolkit.createLabel(body,
"Taxa Operação", SWT.NONE);
contraparteLabel_1_1_1_1.setBounds(427, 44, 80, 13);
boletaParcialForm.setText("Boleta Parcial");
text_4 = toolkit.createText(body, null, SWT.BORDER);
text_4.setBounds(427, 58, 92, 21);
FormattedText text10 = new FormattedText(text_4);
NumberFormatter formatter = new NumberFormatter();
formatter.setFixedLengths(false, true);
text10.setFormatter(formatter);
text10.setValue(new Double(123.4));
//text10.getControl().setBounds(427, 58, 92, 21);
//toolkit.adapt(text10.getControl());
//
createActions();
initializeToolBar();
initializeMenu();
}
/**
* Create the actions
*/
private void createActions() {
// Create the actions
}
/**
* Initialize the toolbar
*/
private void initializeToolBar() {
IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
}
/**
* Initialize the menu
*/
private void initializeMenu() {
IMenuManager manager = getViewSite().getActionBars().getMenuManager();
}
@Override
public void setFocus() {
// Set the focus
}
}
Thanks again.
Marcelo
On Wed, Jun 11, 2008 at 5:23 AM, Tom Schindl <listom@xxxxxxxxxxxxxxx> wrote:
I want a completely *runnable* snippet (or project with a view or class)
because I have not time to write one my own :-). This is not because I'm so
lazy but if I would write a snippet always myself when trying to answer a
question I could quit my day job.
Tom
Marcelo Alcantara schrieb:
Hi Tom,
I am using Windows XP and Eclipse 3.4 RC2.
Does the code snippet I posted look correct?
Thanks,
Marcelo
On Tue, Jun 10, 2008 at 1:17 PM, Tom Schindl <listom@xxxxxxxxxxxxxxx>
wrote:
Nothing :-) (maybe the OS and Eclipse-Version would help)
Tom
Marcelo Alcantara schrieb:
Hi Tom,
I will begin posting there from now on.
What you need besides the snippet I posted?
Thanks in advance.
Marcelo
On Tue, Jun 10, 2008 at 11:49 AM, Tom Schindl <listom@xxxxxxxxxxxxxxx>
wrote:
Please ask user questions on the newsgroup. Could you by chance provide
a
snippet so that i gets easier for us to run and see what's going wrong?
Tom
Marcelo Alcantara schrieb:
Hi,
I am trying to use the FormattedText with Eclipse Forms.
My code to render the text field look like this:
text_4 = toolkit.createText(body, null, SWT.BORDER);
text_4.setBounds(427, 58, 92, 21);
FormattedText text10 = new FormattedText(text_4);
NumberFormatter formatter = new NumberFormatter();
formatter.setFixedLengths(false, true);
text10.setFormatter(formatter);
text10.setValue(new Double(123.4));
It shows the text field, but no formatting is being shown. Neither the
default value appears.
Somebody can give me some help on this?
I searched the net and this forum, but could not find anything related
to this issue.
Thanks in advance.
Marcelo
_______________________________________________
nebula-dev mailing list
nebula-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/nebula-dev
_______________________________________________
nebula-dev mailing list
nebula-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/nebula-dev
_______________________________________________
nebula-dev mailing list
nebula-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/nebula-dev