Revision 0099339a

b/src/gr/grnet/pithos/web/client/AbstractPropertiesDialog.java
67 67

  
68 68
	/**
69 69
	 * Accepts any change and updates the file
70
	 * @return 
70 71
	 *
71 72
	 */
72
	protected abstract void accept();
73
	protected abstract boolean accept();
73 74

  
74 75
	@Override
75 76
	protected void onPreviewNativeEvent(NativePreviewEvent preview) {
......
81 82
			  // enter or escape is pressed.
82 83
			  switch (evt.getKeyCode()) {
83 84
			    case KeyCodes.KEY_ENTER:
84
			    	accept();
85
			    //$FALL-THROUGH$
85
			    	if (accept())
86
			    		closeDialog();
87
			    	break;
86 88
			case KeyCodes.KEY_ESCAPE:
87 89
			        closeDialog();
88 90
			        break;
b/src/gr/grnet/pithos/web/client/FilePermissionsDialog.java
244 244
	 *
245 245
	 */
246 246
	@Override
247
	protected void accept() {
247
	protected boolean accept() {
248 248
        updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", permList.getPermissions());
249
        return true;
249 250
	}
250 251

  
251 252
	protected void updateMetaData(String api, String owner, final String path, final Map<String, Boolean[]> newPermissions) {
b/src/gr/grnet/pithos/web/client/FilePropertiesDialog.java
112 112
		final Button ok = new Button("OK", new ClickHandler() {
113 113
			@Override
114 114
			public void onClick(ClickEvent event) {
115
				accept();
116
				closeDialog();
115
				if (accept())
116
					closeDialog();
117 117
			}
118 118
		});
119 119
		ok.addStyleName("button");
......
226 226
	 *
227 227
	 */
228 228
	@Override
229
	protected void accept() {
229
	protected boolean accept() {
230 230
		String newFilename = null;
231 231

  
232 232
		if (!name.getText().trim().equals(file.getName())) {
233 233
			newFilename = name.getText().trim();
234
			if (newFilename.length() == 0)
235
				newFilename = null;
234 236
		}
237
		
235 238

  
236 239
        final Map<String, String> newMeta = new HashMap<String, String>();
237 240
        for (int row = 1; row < metaTable.getRowCount(); row++) {
......
239 242
        	String value = ((TextBox) metaTable.getWidget(row, 1)).getText().trim();
240 243
        	if (key.length() > 0 && value.length() > 0)
241 244
        		newMeta.put(key, value);
245
        	else if ((key.length() > 0 && value.length() == 0) || (key.length() == 0 && value.length() > 0)) {
246
        		app.displayError("You have empty keys or values");
247
        		return false;
248
        	}
242 249
        }
243 250

  
244 251
        if (newFilename != null) {
......
296 303
        }
297 304
        else
298 305
            updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", newMeta);
306
        return true;
299 307
	}
300 308

  
301 309
	protected void updateMetaData(String api, String owner, String path, Map<String, String> newMeta) {
b/src/gr/grnet/pithos/web/client/FilePublishDialog.java
221 221
    }
222 222
	/**
223 223
	 * Accepts any change and updates the file
224
	 * @return 
224 225
	 *
225 226
	 */
226 227
	@Override
227
	protected void accept() {
228
	protected boolean accept() {
228 229
        Boolean published = null;
229 230
		if (readForAll.getValue() != file.isPublished())
230 231
			if (file.getOwner().equals(app.getUsername()))
231 232
                published = readForAll.getValue();
232 233
        updateMetaData(app.getApiPath(), app.getUsername(), file.getUri() + "?update=", published);
234
        return true;
233 235
	}
234 236

  
235 237
	protected void updateMetaData(String api, String owner, final String path, final Boolean published) {
b/src/gr/grnet/pithos/web/client/FileVersionsDialog.java
185 185

  
186 186
	/**
187 187
	 * Accepts any change and updates the file
188
	 * @return 
188 189
	 *
189 190
	 */
190 191
	@Override
191
	protected void accept() {
192
	protected boolean accept() {
192 193
        app.updateFolder(file.getParent(), true, new Command() {
193 194
			
194 195
			@Override
......
197 198
					app.updateMySharedRoot();
198 199
			}
199 200
		}, true);
201
        
202
        return true;
200 203
	}
201 204
}
b/src/gr/grnet/pithos/web/client/FilesPropertiesDialog.java
140 140

  
141 141
	/**
142 142
	 * Accepts any change and updates the file
143
	 * @return 
143 144
	 *
144 145
	 */
145 146
	@Override
146
	protected void accept() {
147
	protected boolean accept() {
148
		return true;
147 149
	}
148 150
}

Also available in: Unified diff