List of usage examples for com.vaadin.ui Button setReadOnly
protected void setReadOnly(boolean readOnly)
From source file:edu.nps.moves.mmowgli.modules.administration.SubCardsGameDesignPanel.java
License:Open Source License
private Component renderFields(CardTypeFields fields, NativeSelect combo, String name) { VerticalLayout topPan = new VerticalLayout(); topPan.setWidth("98%"); topPan.addStyleName("m-greyborder3"); Label lab;/*from w ww. j a v a 2s . c om*/ topPan.addComponent(lab = new Label()); lab.setHeight("18px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true); ; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>")); lab.setSizeUndefined(); topHL.addComponent(combo); Button newTypeButt; topHL.addComponent(newTypeButt = new NativeButton("Define new type")); newTypeButt.addStyleName(Runo.BUTTON_SMALL); newTypeButt.setReadOnly(globs.readOnlyCheck(false)); newTypeButt.setEnabled(!newTypeButt.isReadOnly()); if (!newTypeButt.isReadOnly()) newTypeButt.addClickListener(new NewTypeListener(fields.typeOrdinal)); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topPan.addComponent(topHL); topHL.setWidth("100%"); topPan.addComponent(fields); fields.setWidth("100%"); return topPan; }
From source file:edu.nps.moves.mmowgli.modules.administration.TopCardsGameDesignPanel.java
License:Open Source License
private Component renderFields(CardTypeFields fields, NativeSelect combo, String name, Label editWarningLab) { VerticalLayout topPan = new VerticalLayout(); topPan.setWidth("98%"); topPan.addStyleName("m-greyborder3"); Label lab;/*w ww . ja v a2 s . c om*/ topPan.addComponent(lab = new Label()); lab.setHeight("18px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true); ; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>")); lab.setSizeUndefined(); topHL.addComponent(combo); Button newTypeButt; topHL.addComponent(newTypeButt = new NativeButton("Define new top-level type")); newTypeButt.addStyleName(Runo.BUTTON_SMALL); newTypeButt.setReadOnly(globals.readOnlyCheck(false)); newTypeButt.setEnabled(!newTypeButt.isReadOnly()); if (!newTypeButt.isReadOnly()) newTypeButt.addClickListener(new NewCardClassListener(fields.cardClass)); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topPan.addComponent(topHL); topHL.setWidth("100%"); addComponent(editWarningLab); topPan.addComponent(fields); fields.setWidth("100%"); return topPan; }
From source file:edu.nps.moves.mmowgli.modules.administration.VideoChangerComponent.java
License:Open Source License
VideoChangerComponent(MovePhase mp, String setterMethodName, Media m, GameDesignGlobals globs) { this.mp = mp; this.currentMedia = m; try {/* ww w .j a v a 2 s . co m*/ movePhaseSetter = MovePhase.class.getDeclaredMethod(setterMethodName, new Class<?>[] { Media.class }); } catch (Exception e) { throw new RuntimeException(e); } setSpacing(true); setMargin(false); setSizeUndefined(); addComponent(roTF = new TextField()); roTF.addStyleName("m-textarea-greyborder"); //tf.setColumns(20); roTF.setValue(currentMedia == null ? "" : currentMedia.getUrl()); roTF.setReadOnly(true); Button butt; addComponent(butt = new Button("change", this)); setComponentAlignment(butt, Alignment.MIDDLE_CENTER); butt.addStyleName(Reindeer.BUTTON_SMALL); butt.setReadOnly(globs.readOnlyCheck(false)); butt.setEnabled(!butt.isReadOnly()); }
From source file:org.eclipse.emf.ecp.controls.vaadin.AbstractVaadinSimpleControlRenderer.java
License:Open Source License
protected void createSetOrUnsetComponent(final Component component, final HorizontalLayout horizontalLayout, final Setting setting) { final Label unsetLabel = getUnsetComponent(); final Button setButton = getUnsetButton(component, horizontalLayout, setting); setButton.setEnabled(getVElement().isEnabled()); setButton.setVisible(getVElement().isVisible()); setButton.setReadOnly(getVElement().isReadonly()); horizontalLayout.addStyleName("textheight"); horizontalLayout.removeAllComponents(); Component addComponent = component; if (setting.isSet()) { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Set); unsetLabel.setCaption(getUnsetLabel()); addComponent = unsetLabel;//from ww w . j av a 2 s .co m } else { setButton.setCaption(VaadinRendererMessages.AbstractVaadinSimpleControlRenderer_Unset); } horizontalLayout.setData(addComponent); horizontalLayout.addComponent(addComponent); horizontalLayout.setExpandRatio(addComponent, 1f); horizontalLayout.addComponent(setButton); horizontalLayout.setComponentAlignment(setButton, Alignment.BOTTOM_RIGHT); }