You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2017/11/23 08:58:54 UTC
[myfaces-tobago] 02/03: TOBAGO-1782: Clean up * remove tc:calendar
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit c1a8c6bc8cce9707481c2979b9450f4dbb09c0d5
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Nov 22 17:07:47 2017 +0100
TOBAGO-1782: Clean up
* remove tc:calendar
---
.../renderkit/renderer/CalendarRenderer.java | 45 ----------
.../taglib/component/CalendarTagDeclaration.java | 58 -------------
.../apache/myfaces/tobago/model/CalendarModel.java | 97 ----------------------
.../tobago/example/demo/EventController.java | 2 -
4 files changed, 202 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CalendarRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CalendarRenderer.java
deleted file mode 100644
index 7466b9e..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/CalendarRenderer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.tobago.internal.renderkit.renderer;
-
-import org.apache.myfaces.tobago.component.UICalendar;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
-import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import java.io.IOException;
-
-public class CalendarRenderer extends RendererBase {
-
- @Override
- public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
-
- final UICalendar output = (UICalendar) component;
- final String id = output.getClientId(facesContext);
-
- final TobagoResponseWriter writer = getResponseWriter(facesContext);
- writer.startElement(HtmlElements.SPAN);
- writer.writeIdAttribute(id);
- writer.writeText("[tc:calender is currently not implemented]");
- writer.endElement(HtmlElements.SPAN);
- }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CalendarTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CalendarTagDeclaration.java
deleted file mode 100644
index d74d9af..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/CalendarTagDeclaration.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.tobago.internal.taglib.component;
-
-import org.apache.myfaces.tobago.apt.annotation.DynamicExpression;
-import org.apache.myfaces.tobago.apt.annotation.Tag;
-import org.apache.myfaces.tobago.apt.annotation.TagAttribute;
-import org.apache.myfaces.tobago.apt.annotation.UIComponentTag;
-import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
-import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.internal.taglib.declaration.HasIdBindingAndRendered;
-import org.apache.myfaces.tobago.internal.taglib.declaration.IsVisual;
-
-import javax.faces.component.UIOutput;
-
-/**
- * Renders a calendar.
- */
-@Tag(name = "calendar")
-@UIComponentTag(
- uiComponent = "org.apache.myfaces.tobago.component.UICalendar",
- uiComponentBaseClass = "javax.faces.component.UIOutput",
- uiComponentFacesClass = "javax.faces.component.UIOutput",
- componentFamily = UIOutput.COMPONENT_FAMILY,
- rendererType = RendererTypes.CALENDAR,
- interfaces = {
- // As long as no behavior event names are defined, ClientBehaviorHolder must be implemented for Majorra.
- "javax.faces.component.behavior.ClientBehaviorHolder"
- })
-public interface CalendarTagDeclaration
- extends HasIdBindingAndRendered, IsVisual {
-
- /**
- * The current value of this component.
- */
- @TagAttribute
- @UIComponentTagAttribute(
- type = {"java.util.Calendar", "java.util.Date"},
- expression = DynamicExpression.VALUE_EXPRESSION_REQUIRED)
- void setValue(String value);
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CalendarModel.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CalendarModel.java
deleted file mode 100644
index f931ae5..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/CalendarModel.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.myfaces.tobago.model;
-
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-
-public class CalendarModel {
-
- private DateModel[][] calendarArray;
- private int firstDayOffset;
-
- public CalendarModel(final Calendar calendar) {
-// int weekCount = CalendarUtils.weekCount(calendar);
- final int weekCount = 6; // switching off dynamic weekCount!
- calendarArray = new DateModel[weekCount][7];
- final Calendar c = (Calendar) calendar.clone();
- c.clear(Calendar.DAY_OF_MONTH);
- c.set(Calendar.DAY_OF_MONTH, 1);
- // assert c.isLenient() : "'add -x days' may not work in a non-lenient calendar";
- firstDayOffset = firstDayOffset(c);
- c.add(Calendar.DAY_OF_WEEK, -firstDayOffset);
- for (int week = 0; week < weekCount; ++week) {
- for (int day = 0; day < 7; ++day) {
- calendarArray[week][day] = new DateModel(c);
- c.add(Calendar.DAY_OF_MONTH, 1);
- }
- }
- }
-
- public int getWeekCount() {
- return calendarArray.length;
- }
-
- public int getMonth() {
- return calendarArray[0][firstDayOffset].getMonth();
- }
-
- public int getYear() {
- return calendarArray[0][firstDayOffset].getYear();
- }
-
- public DateModel getDate(final int week, final int day) {
- return calendarArray[week][day];
- }
-
- private int firstDayOffset(final Calendar calendar) {
- final Calendar c = (Calendar) calendar.clone();
- c.clear(Calendar.DAY_OF_MONTH);
- c.set(Calendar.DAY_OF_MONTH, 1);
- final int day = c.get(Calendar.DAY_OF_WEEK);
- final int firstDayOfWeek = c.getFirstDayOfWeek();
- // Fails: assertEquals((1+7-3)%7, (1-3)%7);
- return (day + 7 - firstDayOfWeek) % 7;
- }
-
- public String toString() {
- final StringBuilder buffer = new StringBuilder();
- buffer.append("Month: ").append(getMonth()).append("\n");
- final int weekCount = getWeekCount();
- final DecimalFormat format = new DecimalFormat("00");
- final SimpleDateFormat dateFormat = new SimpleDateFormat("E");
- for (int day = 0; day < 7; ++day) {
- final DateModel date = getDate(0, day);
- final String dayName = dateFormat.format(date.getCalendar().getTime());
- buffer.append(dayName.substring(0, 2)).append(" ");
- }
- buffer.append("\n");
- for (int week = 0; week < weekCount; ++week) {
- for (int day = 0; day < 7; ++day) {
- final DateModel date = getDate(week, day);
- buffer.append(format.format(date.getDay())).append(" ");
- }
- buffer.append("\n");
- }
- return buffer.toString();
- }
-
-}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java
index 59b16ca..7e3a4fd 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/EventController.java
@@ -23,7 +23,6 @@ import org.apache.myfaces.tobago.component.UIBar;
import org.apache.myfaces.tobago.component.UIBox;
import org.apache.myfaces.tobago.component.UIButton;
import org.apache.myfaces.tobago.component.UIButtons;
-import org.apache.myfaces.tobago.component.UICalendar;
import org.apache.myfaces.tobago.component.UIColumn;
import org.apache.myfaces.tobago.component.UIColumnNode;
import org.apache.myfaces.tobago.component.UIColumnSelector;
@@ -110,7 +109,6 @@ public class EventController implements Serializable {
eventsOnComponents.add(new EventsOnComponent(new UIBox()));
eventsOnComponents.add(new EventsOnComponent(new UIButton()));
eventsOnComponents.add(new EventsOnComponent(new UIButtons()));
- eventsOnComponents.add(new EventsOnComponent(new UICalendar()));
eventsOnComponents.add(new EventsOnComponent(new UIColumn()));
eventsOnComponents.add(new EventsOnComponent(new UIColumnNode()));
eventsOnComponents.add(new EventsOnComponent(new UIColumnSelector()));
--
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.