List of usage examples for com.vaadin.ui Button isReadOnly
protected boolean isReadOnly()
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 ava 2 s . c o m*/ 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 w w . j av a 2 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 {// w ww .jav a2 s . c o 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()); }