org.apache.wicket.markup.html.basic.MultiLineLabel Java Examples
The following examples show how to use
org.apache.wicket.markup.html.basic.MultiLineLabel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UIVisualizersRegistry.java From Orienteer with Apache License 2.0 | 6 votes |
public UIVisualizersRegistry() { registerUIComponentFactory(DefaultVisualizer.INSTANCE); registerUIComponentFactory(new SimpleVisualizer("textarea", MultiLineLabel.class, TextArea.class, OType.STRING)); registerUIComponentFactory(new SimpleVisualizer("table", true, LinksPropertyDataTablePanel.class, LinksPropertyDataTablePanel.class, OType.LINKLIST, OType.LINKSET, OType.LINKBAG)); registerUIComponentFactory(new SimpleVisualizer(VISUALIZER_RESTRICTED_WIDTH, TextBreakPanel.class, TextField.class, OType.STRING)); registerUIComponentFactory(new ListboxVisualizer()); registerUIComponentFactory(new PasswordVisualizer()); registerUIComponentFactory(new HTMLVisualizer()); registerUIComponentFactory(new UrlLinkVisualizer()); registerUIComponentFactory(new MarkDownVisualizer()); registerUIComponentFactory(new LocalizationVisualizer()); registerUIComponentFactory(new ImageVisualizer()); registerUIComponentFactory(new SuggestVisualizer()); registerUIComponentFactory(new CodeVisualizer()); registerUIComponentFactory(new JavaScriptCodeVisualizer()); registerUIComponentFactory(new SqlCodeVisualizer()); registerUIComponentFactory(new HexVisualizer()); registerUIComponentFactory(new LinksAsEmbeddedVisualizer()); }
Example #2
Source File: SystemLogPage.java From nextreports-server with Apache License 2.0 | 6 votes |
public SystemLogPage() { super(); WebMarkupContainer cssContainer = new WebMarkupContainer("cssPath"); cssContainer.add(new AttributeModifier("href", ThemesManager.getInstance().getThemeRelativePathCss())); add(cssContainer); FileAppender appender = (FileAppender) LogManager.getRootLogger().getAppender("FILE"); File logFile = new File(appender.getFile()); String content; try { content = FileUtils.readFileToString(logFile); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); content = e.toString(); } add(new Label("size", FileUtils.byteCountToDisplaySize(logFile.length()))); add(new Label("lastModified", new Date(logFile.lastModified()).toString())); add(new MultiLineLabel("log", content)); }
Example #3
Source File: RunHistoryQueryPanel.java From nextreports-server with Apache License 2.0 | 6 votes |
public RunHistoryQueryPanel(String id, final RunReportHistory runHistory) { super(id); int index = runHistory.getPath().lastIndexOf("/runHistory"); String reportPath = runHistory.getPath().substring(0, index); Report report; String query = "NA"; try { report = (Report)storageService.getEntity(reportPath); if (ReportConstants.NEXT.equals(report.getType())) { query = ro.nextreports.engine.util.ReportUtil.getSql( NextUtil.getNextReport(settings.getSettings(), report), runHistory.getParametersValues()); } } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } add(new MultiLineLabel("query", new Model<String>(query))); }
Example #4
Source File: RunHistoryDetailPanel.java From nextreports-server with Apache License 2.0 | 6 votes |
public RunHistoryDetailPanel(String id, final RunReportHistory runHistory) { super(id); add(new ContextImage("image", new LoadableDetachableModel<String>() { @Override protected String load() { String theme = settings.getSettings().getColorTheme(); return runHistory.isSuccess() ? "images/" + ThemesManager.getTickImage(theme, (NextServerApplication)getApplication()) : "images/delete.gif"; } })); add(new Label("messageTitle", new Model<String>(getString("ActionContributor.RunHistory.message")))); add(new MultiLineLabel("messageContent", new Model<String>(runHistory.getMessage()))); add(new Label("valuesTitle", new Model<String>(getString("ActionContributor.RunHistory.runtime")))); String values = ReportUtil.getDebugParameters(runHistory.getParametersValues(), runHistory.getParametersDisplayNames()); //values = values.replaceAll("\r\n", "<br>"); add(new MultiLineLabel("valuesContent", new Model<String>(values))); }
Example #5
Source File: ODBScriptResultRenderer.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public Component render(String id, IModel<?> dataModel) { if(dataModel == null) return null; else if(dataModel instanceof OQueryModel) { OQueryModel<ODocument> queryModel = (OQueryModel<ODocument>) dataModel; OClass oClass = queryModel.probeOClass(20); if(oClass!=null) { return new OQueryModelResultsPanel(id, queryModel); } } else { // Trying to find ODocument related stuff Object value = dataModel.getObject(); if(value == null) return null; Class<?> valueClass = value.getClass(); if(valueClass.isArray()) { Class<?> arrayClass = valueClass.getComponentType(); if(!arrayClass.isPrimitive()) { value = Arrays.asList((Object[])value); if(arrayClass != null && OIdentifiable.class.isAssignableFrom(arrayClass)) { return new MultiLineLabel(id, serializeODocuments((Collection<OIdentifiable>)value)); } } } if(value instanceof Collection<?>) { Collection<?> collection = (Collection<?>)value; if(!collection.isEmpty() && collection.iterator().next() instanceof OIdentifiable) { //TODO: add more suitable component for visualization of result set return new MultiLineLabel(id, serializeODocuments((Collection<OIdentifiable>)collection)); } } } return null; }
Example #6
Source File: ViewUMLDialogPanel.java From Orienteer with Apache License 2.0 | 5 votes |
public ViewUMLDialogPanel(String id, final IModel<String> model) { super(id, model); add(new WebMarkupContainer("umlImg") { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("src", umlService.asImage(model.getObject())); } }); add(new MultiLineLabel("uml", model).setVisible(umlService.isUmlDebugEnabled())); }
Example #7
Source File: HexVisualizer.java From Orienteer with Apache License 2.0 | 5 votes |
@Override public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel, IModel<OProperty> propertyModel, IModel<V> valueModel) { IModel<byte[]> model = (IModel<byte[]>)valueModel; switch (mode) { case VIEW: return new MultiLineLabel(id, valueModel); case EDIT: return new TextArea<>(id, valueModel).setType(byte[].class); default: return null; } }
Example #8
Source File: ViewInfoPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
public ViewInfoPanel(String id, final Report report, final Report original, String versionName) { super(id, new Model<Report>(report)); String name = report.getName(); if (versionName != null) { name += " (" + getString("ActionContributor.Info.version") + ": " + versionName + ")"; } add(new Label("legend", getString("ActionContributor.Info.reportInfo"))); add(new Label("entityId", getString("ActionContributor.Info.id"))); add(new Label("reportId", report.getId())); add(new Label("entityName", getString("ActionContributor.Info.entityName"))); add(new Label("reportName", name)); add(new Label("descLabel", getString("ActionContributor.Info.description"))); add(new TextArea<String>("description", new Model<String>(report.getDescription()))); addParametersTable(report); String sql = "NA"; if (ReportConstants.NEXT.equals(report.getType())) { sql = ReportUtil.getSql(NextUtil.getNextReport(settings.getSettings(), report)); } else if (ReportConstants.JASPER.equals(report.getType())) { sql = JasperReportsUtil.getMasterQuery(report); } add(new MultiLineLabel("sql", new Model<String>(sql))); add(new AjaxLink<Void>("cancel") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { EntityBrowserPanel panel = findParent(EntityBrowserPanel.class); panel.backwardWorkspace(target); } }); }
Example #9
Source File: ViewInfoPanel.java From nextreports-server with Apache License 2.0 | 5 votes |
public ViewInfoPanel(String id, final Chart chart, final Chart original, String versionName) { super(id, new Model<Chart>(chart)); String name = chart.getName(); if (versionName != null) { name += " (" + getString("ActionContributor.Info.version") + ": " + versionName + ")"; } add(new Label("legend", getString("ActionContributor.Info.chartInfo"))); add(new Label("entityId", getString("ActionContributor.Info.id"))); add(new Label("reportId", chart.getId())); add(new Label("entityName", getString("ActionContributor.Info.entityName"))); add(new Label("reportName", name)); add(new Label("descLabel", getString("ActionContributor.Info.description"))); add(new TextArea<String>("description", new Model<String>(chart.getDescription()))); addParametersTable(chart); String sql = ReportUtil.getSql(NextUtil.getNextReport(settings.getSettings(), chart)); add(new MultiLineLabel("sql", new Model<String>(sql))); add(new AjaxLink<Void>("cancel") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { EntityBrowserPanel panel = findParent(EntityBrowserPanel.class); panel.backwardWorkspace(target); } }); }
Example #10
Source File: EtcdNodePanel.java From etcd-viewer with Apache License 2.0 | 4 votes |
public EtcdNodePanel(String id, IModel<String> etcdRegistry, IModel<String> keyModel) { super(id); this.registry = etcdRegistry; this.key = keyModel; setModel(new LoadableDetachableModel<EtcdNode>() { private static final long serialVersionUID = 1L; @Override protected EtcdNode load() { if (registry.getObject() == null) { return null; } try (EtcdProxy p = proxyFactory.getEtcdProxy(registry.getObject())) { return p.getNode(key.getObject()); } catch (Exception e) { log.warn(e.getLocalizedMessage(), e); // TODO: handle this exception and show some alert on page error("Could not retrieve key " + key.getObject() + ": " + e.toString()); EtcdNodePanel.this.setEnabled(false); return null; } } }); parentKey = new ParentKeyModel(); setOutputMarkupId(true); createModalPanels(); add(breadcrumbAndActions = new WebMarkupContainer("breadcrumbAndActions")); breadcrumbAndActions.setOutputMarkupId(true); createBreadcrumb(); createNodeActions(); add(new WebMarkupContainer("icon").add(new AttributeModifier("class", new StringResourceModel("icon.node.dir.${dir}", getModel(), "")))); add(new Label("key", new PropertyModel<>(getModel(), "key"))); add(contents = new WebMarkupContainer("contents")); contents.setOutputMarkupId(true); WebMarkupContainer currentNode; contents.add(currentNode = new WebMarkupContainer("currentNode")); currentNode.add(new AttributeAppender("class", new StringResourceModel("nodeClass", getModel(), "") , " ")); currentNode.add(new Label("createdIndex", new PropertyModel<>(getModel(), "createdIndex"))); currentNode.add(new Label("modifiedIndex", new PropertyModel<>(getModel(), "modifiedIndex"))); currentNode.add(new Label("ttl", new PropertyModel<>(getModel(), "ttl"))); currentNode.add(new Label("expiration", new PropertyModel<>(getModel(), "expiration"))); contents.add(new TriggerModalLink<EtcdNode>("editValue", getModel(), editNodeModal) { private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); if (key.getObject() == null || "".equals(key.getObject()) || "/".equals(key.getObject())) { add(AttributeAppender.append("disabled", "disabled")); } else { add(AttributeModifier.remove("disabled")); } // hide value for directory entries setVisible(EtcdNodePanel.this.getModelObject() != null && !EtcdNodePanel.this.getModelObject().isDir()); } @Override protected void onModalTriggerClick(AjaxRequestTarget target) { updating.setObject(true); actionModel.setObject(getModelObject()); } } .add(new MultiLineLabel("value", new PropertyModel<>(getModel(), "value")))); AbstractLink goUp; contents.add(goUp = createNavigationLink("goUp", parentKey)); goUp.add(new Behavior() { private static final long serialVersionUID = 1L; @Override public void onConfigure(Component component) { super.onConfigure(component); component.setEnabled(key.getObject() != null && !"".equals(key.getObject()) && !"/".equals(key.getObject())); } }); contents.add(createNodesView("nodes")); }
Example #11
Source File: ODatabaseMetaPanel.java From Orienteer with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override protected Component resolveComponent(String id, DisplayMode mode, String critery) { if(DisplayMode.EDIT.equals(mode) && !OSecurityHelper.isAllowed(ORule.ResourceGeneric.SCHEMA, null, OrientPermission.UPDATE)) { mode = DisplayMode.VIEW; } if(DisplayMode.VIEW.equals(mode)) { if(ATTRIBUTES.VALIDATION.name().equals(critery)) { return new BooleanViewPanel(id, (IModel<Boolean>)getModel()).setDefaultValue(true); } else if(ATTRIBUTES.CUSTOM.name().equals(critery)) { return new MultiLineLabel(id, getModel()); } else { return new Label(id, getModel()); } } else if(DisplayMode.EDIT.equals(mode)) { if(ATTRIBUTES.CLUSTERSELECTION.name().equals(critery)) { return new DropDownChoice<String>(id, (IModel<String>)getModel(), CLUSTER_SELECTIONS); } else if(ATTRIBUTES.STATUS.name().equals(critery)) { return new DropDownChoice<STATUS>(id, (IModel<STATUS>)getModel(), Arrays.asList(STATUS.values())); } else if(ATTRIBUTES.VALIDATION.name().equals(critery)) { return new BooleanEditPanel(id, (IModel<Boolean>)getModel()); } else if(ATTRIBUTES.CUSTOM.name().equals(critery)) { return new TextArea<String>(id, (IModel<String>) getModel()); } else if (ATTRIBUTES.TIMEZONE.name().equals(critery)) { return new DropDownChoice<String>(id, (IModel<String>)getModel(), TIMEZONES); } else if(ATTRIBUTES.TYPE.name().equals(critery)){ return resolveComponent(id, DisplayMode.VIEW, critery); } else if(ATTRIBUTES.DATEFORMAT.name().equals(critery) || ATTRIBUTES.DATETIMEFORMAT.name().equals(critery)) { return new TextField<String>(id, (IModel<String>)getModel()).setType(String.class) .add(DateFormatValidator.SIMPLE_DATE_FORMAT_VALIDATOR); } else { return new TextField<V>(id, getModel()).setType(String.class); } } return null; }
Example #12
Source File: SearchEntityPanel.java From nextreports-server with Apache License 2.0 | 4 votes |
public SearchEntityPanel(String id, final String path) { super(id); this.sectionId = ((EntitySection) sectionManager.getSelectedSection()).getId(); this.path = path; SearchContext searchContext = NextServerSession.get().getSearchContext(); if (searchContext != null) { this.path = searchContext.getPath(); } provider = new EntityListDataProvider(); AdvancedForm form = new SearchForm("form"); feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setOutputMarkupId(true); feedbackPanel.setEscapeModelStrings(false); List<SearchEntry> searchEntries = Collections.emptyList(); if (searchContext != null) { searchEntries = searchContext.getSearchEntries(); } if (searchEntries.size() > 0) { try { Entity[] entities = storageService.search(searchEntries, null); provider.setList(Arrays.asList(entities)); } catch (Exception e) { e.printStackTrace(); error(e.getMessage()); } } add(new Label("title", getString("ActionContributor.Search.name") + " " + getString("Section." + sectionManager.getSelectedSection().getTitle() + ".name"))); resultsLabel = new MultiLineLabel("resultsLabel", new Model() { @Override public Serializable getObject() { return getSearchString(); } }); resultsLabel.setOutputMarkupId(true); resultsLabel.setVisible(false); form.add(resultsLabel); container = new WebMarkupContainer("table-container"); container.setOutputMarkupId(true); container.setVisible(false); form.add(container); final AjaxCheckTablePanel<Entity> tablePanel = createTablePanel(provider); container.add(tablePanel); form.add(feedbackPanel); submitLink = new AjaxSubmitConfirmLink("deleteLink", getString("deleteEntities")) { private static final long serialVersionUID = 1L; protected void onSubmit(AjaxRequestTarget target, Form<?> form) { if (StorageUtil.isCommonPath(tablePanel.getSelected())) { error(getString("deleteEntitiesAmbiguous")); target.add(feedbackPanel); } else { for (Entity h : tablePanel.getSelected()) { try { if (!StorageUtil.isSystemPath(h.getPath()) && securityService.hasPermissionsById(ServerUtil.getUsername(), PermissionUtil.getDelete(), h.getId())) { storageService.removeEntityById(h.getId()); } } catch (Exception e) { e.printStackTrace(); add(new AlertBehavior(e.getMessage())); target.add(this); } } if (tablePanel.getSelected().size() > 0) { tablePanel.unselectAll(); refresh(target); } } } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { target.add(feedbackPanel); } }; submitLink.setVisible(false); form.add(submitLink); add(form); setOutputMarkupId(true); }
Example #13
Source File: UserGroupDescriptionPanel.java From artifact-listener with Apache License 2.0 | 4 votes |
public UserGroupDescriptionPanel(String id, final IModel<UserGroup> userGroupModel) { super(id, userGroupModel); add(new WebMarkupContainer("lockedWarningContainer") { private static final long serialVersionUID = -6522648858912041466L; @Override protected void onConfigure() { super.onConfigure(); setVisible(userGroupModel.getObject().isLocked()); } }); add(new MultiLineLabel("description", BindingModel.of(userGroupModel, Binding.userGroup().description()))); add(new ListView<Authority>("authorities", Model.ofList(authorityUtils.getPublicAuthorities())) { private static final long serialVersionUID = -4307272691513553800L; @Override protected void populateItem(ListItem<Authority> item) { Authority authority = item.getModelObject(); item.add(new Label("authorityName", new ResourceModel( "administration.usergroup.authority." + authority.getName()))); item.add(new BooleanIcon("authorityCheck", Model.of( userGroupModel.getObject().getAuthorities().contains(authority)))); } }); // User group update popup UserGroupFormPopupPanel userGroupUpdatePanel = new UserGroupFormPopupPanel("userGroupUpdatePopupPanel", getModel()); add(userGroupUpdatePanel); Button updateUserGroup = new Button("updateUserGroup") { private static final long serialVersionUID = 993019796184673872L; @Override protected void onConfigure() { super.onConfigure(); setVisible(!UserGroupDescriptionPanel.this.getModelObject().isLocked()); } }; updateUserGroup.add(new AjaxModalOpenBehavior(userGroupUpdatePanel, MouseEvent.CLICK) { private static final long serialVersionUID = 5414159291353181776L; @Override protected void onShow(AjaxRequestTarget target) { } }); add(updateUserGroup); }