Example usage for com.google.gwt.user.client.ui CustomButton CustomButton

List of usage examples for com.google.gwt.user.client.ui CustomButton CustomButton

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui CustomButton CustomButton.

Prototype

public CustomButton(String upText) 

Source Link

Document

Constructor for CustomButton.

Usage

From source file:edu.udes.bio.genus.client.ui.menu.Prop_Strands.java

License:Open Source License

private void init() {
    clear();//w  w  w  .  j a  v  a 2 s  .  co m
    this.basePropertiesPanel = new VerticalPanel();
    this.basePropertiesPanel.setBorderWidth(0);
    this.basePropertiesPanel.setSize("500px", "125px");
    this.add(this.basePropertiesPanel);

    setTextBoxName();
    setTextBoxStructure();
    setTextBoxSequence();
    setListBoxColor();
    setListBoxStyle();
    setListBoxStyle();

    // #########################################
    // Block for name panel
    final HorizontalPanel namePanel = new HorizontalPanel();
    namePanel.setWidth("500px");
    this.basePropertiesPanel.add(namePanel);

    final Label lblName = new Label("Name");
    lblName.setSize("100px", "20px");
    namePanel.add(lblName);
    namePanel.add(this.txtName);

    // #########################################
    // Block for dp entry
    final HorizontalPanel dpPanel = new HorizontalPanel();
    dpPanel.setWidth("500px");
    this.basePropertiesPanel.add(dpPanel);

    final Label lblDp = new Label("Structure");
    lblDp.setTitle("DotParentesis");
    lblDp.setSize("100px", "20px");
    dpPanel.add(lblDp);
    dpPanel.add(this.txtStructure);

    // #########################################
    // Block for sequence entry
    final HorizontalPanel nucPanel = new HorizontalPanel();
    nucPanel.setSize("500px", "20px");
    this.basePropertiesPanel.add(nucPanel);

    final Label lblNuc = new Label("Sequence");
    lblNuc.setSize("100px", "20px");
    nucPanel.add(lblNuc);
    nucPanel.add(this.txtSequence);

    // #########################################
    // Dropdown for color type
    final HorizontalPanel oPanel = new HorizontalPanel();
    oPanel.setSize("500px", "20px");
    this.basePropertiesPanel.add(oPanel);

    final Label lblCol = new Label("Colors :");
    lblCol.setSize("50px", "20px");
    oPanel.add(lblCol);
    oPanel.add(this.lbColor);

    // #########################################
    // Add the style list
    final Label lblStyle = new Label("Style :");
    lblStyle.setSize("50px", "20px");
    oPanel.add(lblStyle);
    oPanel.add(this.lbStyle);

    // #########################################
    // Add the action button panel
    final HorizontalPanel actionButtonPanel = new HorizontalPanel();
    actionButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    actionButtonPanel.setWidth("500px");

    // CANCEL BUTTON
    final Image iH = new Image(this.imagesBundle.hideButtonIcon());
    this.btnHide = new CustomButton(iH) {
        @Override
        protected void onClick() {
            getParent().getParent().setVisible(false);
        }
    };
    actionButtonPanel.add(this.btnHide);

    this.basePropertiesPanel.add(actionButtonPanel);

    DOM.setStyleAttribute(getElement(), "border", "1px solid grey");
    DOM.setStyleAttribute(getElement(), "background", "#e3e8f3");

    this.setVisible(true);
}

From source file:edu.udes.bio.genus.client.ui.menu.Sequence.java

License:Open Source License

/**
 * Instantiates a new sequence./*from w w w.  ja  v a 2 s  . co m*/
 * 
 * @param name
 *            the name
 * @param sequence
 *            the sequence itself (ex: "GACU GA")
 */
public Sequence(String name, String sequence) {
    super();
    if (name.equals("")) {
        this.name = sequence;
    } else {
        this.name = name;
    }
    this.sequence = sequence;

    // Setup main panel
    DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
    setSize("90%", "20px");
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // Create and setup label for the name of the strand
    this.sName.setPixelSize(164, 20);
    updateName();
    add(this.sName);

    final Image iD = new Image(this.imagesBundle.cancelButtonIcon());
    final CustomButton btnDel = new CustomButton(iD) {
        @Override
        protected void onClick() {
            if (DOM.eventGetCtrlKey(DOM.eventGetCurrentEvent())
                    || Window.confirm("Are you sure you want to delete this strand ?")) {
                GenUS.mainMenu.seqMenu.removeSequence(Sequence.this);
            }
        }
    };
    btnDel.setSize("16px", "16px");
    btnDel.setTitle("Press Ctrl to delete without confirmation.");
    add(btnDel);

    // Setup Widget
    final MouseOverHandler overHandler = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "#e3e8f3");
            DOM.setStyleAttribute(getElement(), "border", "1px solid lightgrey");
        }
    };
    addDomHandler(overHandler, MouseOverEvent.getType());
    final MouseOutHandler leaveHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
            DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
        }
    };
    addDomHandler(leaveHandler, MouseOutEvent.getType());
}

From source file:edu.udes.bio.genus.client.ui.menu.Strand.java

License:Open Source License

/**
 * Instantiates a new strand./*from w w w .j a v a2  s  .com*/
 * 
 * @param o
 *            the drawable object
 */
public Strand(RNAssDrawable o) {
    super();
    this.poolObj = o;

    // Setup main panel
    DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
    setSize("90%", "20px");
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // Create and setup checkbox
    this.cbxDisplay.setChecked(true);
    this.cbxDisplay.setPixelSize(16, 16);
    final ClickHandler cbxClickHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Strand.this.poolObj.setVisible(Strand.this.cbxDisplay.isChecked());
        }
    };
    this.cbxDisplay.addClickHandler(cbxClickHandler);
    add(this.cbxDisplay);

    // Create and setup label for the name of the strand
    this.sName.setPixelSize(132, 20);
    updateName();
    add(this.sName);

    // Create and setup Edit button
    final Image iE = new Image(this.imagesBundle.detailsButtonIcon());
    final CustomButton btnEdit = new CustomButton(iE) {
        @Override
        protected void onClick() {
            GenUS.propMenu.show(Strand.this.poolObj);
        }
    };
    btnEdit.setPixelSize(16, 16);
    btnEdit.setTitle("Details");
    add(btnEdit);

    final Image iD = new Image(this.imagesBundle.cancelButtonIcon());
    final CustomButton btnDel = new CustomButton(iD) {
        @Override
        protected void onClick() {
            if (DOM.eventGetCtrlKey(DOM.eventGetCurrentEvent())
                    || Window.confirm("Are you sure you want to delete this strand ?")) {
                GenUS.rnaPool.removeFromPool(Strand.this.poolObj);
            }
        }
    };
    btnDel.setSize("16px", "16px");
    btnDel.setTitle("Press Ctrl to delete without confirmation.");
    add(btnDel);

    // Setup Widget
    final MouseOverHandler overHandler = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "#e3e8f3");
            DOM.setStyleAttribute(getElement(), "border", "1px solid lightgrey");
        }
    };
    addDomHandler(overHandler, MouseOverEvent.getType());
    final MouseOutHandler leaveHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
            DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
        }
    };
    addDomHandler(leaveHandler, MouseOutEvent.getType());
}

From source file:edu.udes.bio.genus.client.ui.menu.Structure.java

License:Open Source License

/**
 * Instantiates a new structure./*from  w  ww  .j ava  2s. co  m*/
 * 
 * @param name
 *            the name
 * @param struct
 *            the structure in dot parenthisis format (ex: "..((...)..)." )
 */
public Structure(String name, String struct) {
    super();
    if (name.equals("")) {
        this.name = struct;
    } else {
        this.name = name;
    }
    this.structure = struct;

    // Setup main panel
    DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
    setSize("90%", "20px");
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // Create and setup label for the name of the strand
    this.sName.setPixelSize(164, 20);
    updateName();
    add(this.sName);

    // TODO Include the image in the project
    final Image iD = new Image(this.imagesBundle.cancelButtonIcon());
    final CustomButton btnDel = new CustomButton(iD) {
        @Override
        protected void onClick() {
            if (DOM.eventGetCtrlKey(DOM.eventGetCurrentEvent())
                    || Window.confirm("Are you sure you want to delete this strand ?")) {
                GenUS.mainMenu.structMenu.removeStructure(Structure.this);
            }
        }
    };
    btnDel.setSize("16px", "16px");
    btnDel.setTitle("Press Ctrl to delete without confirmation.");
    add(btnDel);

    // Setup Widget
    final MouseOverHandler overHandler = new MouseOverHandler() {
        @Override
        public void onMouseOver(MouseOverEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "#e3e8f3");
            DOM.setStyleAttribute(getElement(), "border", "1px solid lightgrey");
        }
    };
    addDomHandler(overHandler, MouseOverEvent.getType());
    final MouseOutHandler leaveHandler = new MouseOutHandler() {

        @Override
        public void onMouseOut(MouseOutEvent event) {
            DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
            DOM.setStyleAttribute(getElement(), "border", "1px solid #e3e8f3");
        }
    };
    addDomHandler(leaveHandler, MouseOutEvent.getType());
}

From source file:org.pentaho.pat.client.ui.panels.windows.ConnectionManagerPanel.java

License:Open Source License

private Widget createRichListBoxCell(final ConnectionItem item) {
    final FlexTable table = new FlexTable();
    final FlexCellFormatter cellFormatter = table.getFlexCellFormatter();

    table.setWidth("100%"); //$NON-NLS-1$
    table.setBorderWidth(0);//from  w  w  w . ja  va  2s  .c o m
    table.setCellPadding(3);
    table.setCellSpacing(0);

    Image cImage;
    if (item.isConnected()) {
        cImage = Pat.IMAGES.connect().createImage();
    } else {
        cImage = Pat.IMAGES.disconnect().createImage();
    }
    final CustomButton cButton = new CustomButton(cImage) {
        @Override
        protected void onClick() {
            super.onClick();
            connectEvent(item.getId(), item.isConnected(), true);
        };
    };
    table.setWidget(0, 0, cButton);
    cellFormatter.setWidth(0, 0, "25px"); //$NON-NLS-1$
    table.setHTML(0, 1, "<b>" + item.getName() + "</b>"); //$NON-NLS-1$ //$NON-NLS-2$
    cellFormatter.setWidth(0, 1, "100%"); //$NON-NLS-1$
    return table;
}