Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
69 additions
and
68 deletions.
There are no files selected for viewing
137 changes: 69 additions & 68 deletions
137
.../src/main/java/com/evolveum/midpoint/web/page/admin/reports/component/AceEditorPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,69 @@ | ||
/* | ||
* Copyright (c) 2010-2017 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.web.page.admin.reports.component; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.web.component.AceEditor; | ||
|
||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
|
||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.model.IModel; | ||
|
||
/** | ||
* @author shood | ||
*/ | ||
public class AceEditorPanel extends BasePanel<String> { | ||
|
||
private static final String ID_TITLE = "title"; | ||
private static final String ID_EDITOR = "editor"; | ||
|
||
private IModel<String> title; | ||
|
||
public AceEditorPanel(String id, IModel<String> title, IModel<String> data) { | ||
super(id, data); | ||
|
||
this.title = title; | ||
initLayout(0); | ||
} | ||
|
||
public AceEditorPanel(String id, IModel<String> title, IModel<String> data, int minSize) { | ||
super(id, data); | ||
|
||
this.title = title; | ||
initLayout(minSize); | ||
} | ||
|
||
|
||
private void initLayout(int minSize) { | ||
Label title = new Label(ID_TITLE, this.title); | ||
title.add(new VisibleEnableBehaviour() { | ||
@Override | ||
public boolean isVisible() { | ||
return title != null; | ||
} | ||
}); | ||
add(title); | ||
|
||
AceEditor editor = new AceEditor(ID_EDITOR, getModel()); | ||
editor.setReadonly(false); | ||
if (minSize > 0) { | ||
editor.setMinHeight(minSize); | ||
} | ||
editor.setResizeToMaxHeight(isResizeToMaxHeight()); | ||
add(editor); | ||
} | ||
|
||
public AceEditor getEditor(){ | ||
return (AceEditor)get(ID_EDITOR); | ||
} | ||
|
||
protected boolean isResizeToMaxHeight() { | ||
return true; | ||
} | ||
} | ||
/* | ||
* Copyright (c) 2010-2017 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.web.page.admin.reports.component; | ||
|
||
import com.evolveum.midpoint.gui.api.component.BasePanel; | ||
import com.evolveum.midpoint.web.component.AceEditor; | ||
|
||
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; | ||
|
||
import org.apache.wicket.markup.html.basic.Label; | ||
import org.apache.wicket.model.IModel; | ||
|
||
/** | ||
* @author shood | ||
*/ | ||
public class AceEditorPanel extends BasePanel<String> { | ||
|
||
private static final String ID_TITLE = "title"; | ||
private static final String ID_EDITOR = "editor"; | ||
|
||
private IModel<String> title; | ||
|
||
public AceEditorPanel(String id, IModel<String> title, IModel<String> data) { | ||
super(id, data); | ||
|
||
this.title = title; | ||
initLayout(0); | ||
} | ||
|
||
public AceEditorPanel(String id, IModel<String> title, IModel<String> data, int minSize) { | ||
super(id, data); | ||
|
||
this.title = title; | ||
initLayout(minSize); | ||
} | ||
|
||
|
||
private void initLayout(int minSize) { | ||
Label title = new Label(ID_TITLE, this.title); | ||
title.add(new VisibleEnableBehaviour() { | ||
@Override | ||
public boolean isVisible() { | ||
return title != null; | ||
} | ||
}); | ||
add(title); | ||
|
||
AceEditor editor = new AceEditor(ID_EDITOR, getModel()); | ||
editor.setReadonly(false); | ||
if (minSize > 0) { | ||
editor.setMinHeight(minSize); | ||
} | ||
editor.setResizeToMaxHeight(minSize == 0); | ||
// editor.setResizeToMaxHeight(isResizeToMaxHeight()); | ||
add(editor); | ||
} | ||
|
||
public AceEditor getEditor(){ | ||
return (AceEditor)get(ID_EDITOR); | ||
} | ||
|
||
protected boolean isResizeToMaxHeight() { | ||
return true; | ||
} | ||
} |