@@ -141,6 +141,9 @@ public static interface DeleteWithDetailsListener {
141141 private boolean dirty = false ;
142142
143143 private boolean shortcutsEnabled = false ;
144+
145+ private boolean hideButtons = false ;
146+
144147 protected transient List <ClickShortcut > actions ;
145148
146149 protected CommitDiscardWrapperComponent () {
@@ -152,12 +155,32 @@ public CommitDiscardWrapperComponent(C component, FieldGroup... fieldGroups) {
152155 }
153156
154157 public CommitDiscardWrapperComponent (C component , Boolean isEditingAllowed , FieldGroup ... fieldGroups ) {
158+ this (component , isEditingAllowed , false , fieldGroups );
159+ }
160+
161+ public CommitDiscardWrapperComponent (C component , Boolean isEditingAllowed , boolean hideButtons , FieldGroup ... fieldGroups ) {
162+ this .hideButtons = hideButtons ;
155163 setWrappedComponent (component , fieldGroups );
156164 if (isEditingAllowed != null ) {
157165 setEnabled (isEditingAllowed );
158166 }
159167 }
160168
169+ /**
170+ * Meant to be used when the wrapper is required due to used API but the inner component(s) already contains the discard/save/delete UI.
171+ *
172+ * @param component
173+ * that will be integrated within the wrapper.
174+ * @param fieldGroups
175+ * additional fields
176+ * @return invisible wrapper: no buttons
177+ * @param <C>
178+ * component type.
179+ */
180+ public static <C extends Component > CommitDiscardWrapperComponent <C > withoutButtons (C component , FieldGroup ... fieldGroups ) {
181+ return new CommitDiscardWrapperComponent <>(component , true , true , fieldGroups );
182+ }
183+
161184 protected void setWrappedComponent (C component , FieldGroup ... fieldGroups ) {
162185
163186 this .wrappedComponent = component ;
@@ -178,23 +201,25 @@ protected void setWrappedComponent(C component, FieldGroup... fieldGroups) {
178201 addComponent (contentPanel );
179202 setExpandRatio (contentPanel , 1 );
180203
181- buttonsPanel = new HorizontalLayout ();
182- buttonsPanel .setMargin (false );
183- buttonsPanel .setSpacing (true );
184- buttonsPanel .setWidth (100 , Unit .PERCENTAGE );
204+ if (!hideButtons ) {
205+ buttonsPanel = new HorizontalLayout ();
206+ buttonsPanel .setMargin (false );
207+ buttonsPanel .setSpacing (true );
208+ buttonsPanel .setWidth (100 , Unit .PERCENTAGE );
185209
186- Button discardButton = getDiscardButton ();
187- buttonsPanel .addComponent (discardButton );
188- buttonsPanel .setComponentAlignment (discardButton , Alignment .BOTTOM_RIGHT );
189- buttonsPanel .setExpandRatio (discardButton , 1 );
210+ Button discardButton = getDiscardButton ();
211+ buttonsPanel .addComponent (discardButton );
212+ buttonsPanel .setComponentAlignment (discardButton , Alignment .BOTTOM_RIGHT );
213+ buttonsPanel .setExpandRatio (discardButton , 1 );
190214
191- Button commitButton = getCommitButton ();
192- buttonsPanel .addComponent (commitButton );
193- buttonsPanel .setComponentAlignment (commitButton , Alignment .BOTTOM_RIGHT );
194- buttonsPanel .setExpandRatio (commitButton , 0 );
215+ Button commitButton = getCommitButton ();
216+ buttonsPanel .addComponent (commitButton );
217+ buttonsPanel .setComponentAlignment (commitButton , Alignment .BOTTOM_RIGHT );
218+ buttonsPanel .setExpandRatio (commitButton , 0 );
195219
196- addComponent (buttonsPanel );
197- setComponentAlignment (buttonsPanel , Alignment .BOTTOM_RIGHT );
220+ addComponent (buttonsPanel );
221+ setComponentAlignment (buttonsPanel , Alignment .BOTTOM_RIGHT );
222+ }
198223
199224 setShortcutsEnabled (shortcutsEnabled );
200225
0 commit comments