Truncates all children of the given panel implementing the I_CmsTruncable.<p>

@param panel the panel
@param textMetricsKey the metrics key
@param clientWidth the client width
487911
protected void truncatePanel(Panel panel, String textMetricsKey, int clientWidth) {

        for (Widget widget : panel) {
            if (widget instanceof I_CmsTruncable) {
                ((I_CmsTruncable)widget).truncate(textMetricsKey, clientWidth);
            }
        }
    }
1312257
public static void removeLastOverlay() {

        if (!m_overlays.isEmpty()) {
            CmsInlineEditOverlay last = m_overlays.remove(m_overlays.size() - 1);
            last.removeFromParent();
        }
        if (!m_overlays.isEmpty()) {
            m_overlays.get(m_overlays.size() - 1).setVisible(true);
        }
    }
639061
private void renderChildren(final WPanel panel, final WebXmlRenderContext renderContext) {
		LayoutManager layout = panel.getLayout();
		Renderer layoutRenderer = null;

		if (layout != null) {
			layoutRenderer = new RendererFactoryImpl().getRenderer(layout.getClass());
		}

		if (layoutRenderer == null) {
			renderContext.getWriter().appendTag("ui:content");
			paintChildren(panel, renderContext);
			renderContext.getWriter().appendEndTag("ui:content");
		} else {
			layoutRenderer.render(panel, renderContext);
		}
	}
303431
private void trimToSize(int maxSize) {
		while (true) {
			String key;
			Bitmap value;
			synchronized (this) {
				if (size < 0 || (map.isEmpty() && size != 0)) {
					throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
				}

				if (size <= maxSize || map.isEmpty()) {
					break;
				}

				Map.Entry<String, Bitmap> toEvict = map.entrySet().iterator().next();
				if (toEvict == null) {
					break;
				}
				key = toEvict.getKey();
				value = toEvict.getValue();
				map.remove(key);
				size -= sizeOf(key, value);
			}
		}
	}
1373237
public void truncate(int offset) throws IOException {
        if ((offset < 0)||(offset > _write_pos)) throw new IOException("bad truncate offset");
        if (_read_pos > offset) _read_pos = offset;
        if (_mark_pos > offset) _mark_pos = offset;
        _write_pos = offset;
        if (_file_high > offset) _file_high = offset;
        moveWindow(_write_pos);
    }
725037
@Override protected void resizeDynamicText() {
        double maxWidth = width - size * 0.1;
        double fontSize = size * textSize.factor;

        titleText.setFont(Fonts.latoRegular(fontSize));
        if (titleText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(titleText, maxWidth, fontSize); }
        titleText.relocate(size * 0.05, size * 0.05);

        maxWidth = unitText.isVisible() ? width - size * 0.275 : width - size * 0.1;
        fontSize = size * 0.24;
        valueText.setFont(Fonts.latoRegular(fontSize));
        if (valueText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(valueText, maxWidth, fontSize); }
        if (unitText.isVisible()) {
            valueText.relocate(width - size * 0.075 - valueText.getLayoutBounds().getWidth() - unitText.getLayoutBounds().getWidth(), size * 0.15);
        } else {
            valueText.relocate(width - size * 0.05 - valueText.getLayoutBounds().getWidth(), size * 0.15);
        }

        maxWidth = width - size * 0.1;
        fontSize = size * textSize.factor;
        text.setFont(Fonts.latoRegular(fontSize));
        if (text.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(text, maxWidth, fontSize); }
        text.setX(size * 0.05);
        text.setY(height - size * 0.05);

        Helper.fitNodeWidth(text, maxWidth);

        maxWidth = width - size * 0.705;
        fontSize = size * 0.06;

        sunriseText.setFont(Fonts.latoRegular(fontSize));
        if (sunriseText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(sunriseText, maxWidth, fontSize); }

        sunsetText.setFont(Fonts.latoRegular(fontSize));
        if (sunsetText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(sunsetText, maxWidth, fontSize); }
    }
600556
protected void setLayoutToEndSegment(int segmentLength,
                                        int priority,
                                        boolean isPooled,
                                        boolean isExchange,
                                        int packetNumber,
                                        int conversationId,
                                        int requestNumber,
                                        Conversation conversation,
                                        SendListener sendListener)
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "setLayoutToSegmentEnd", new Object[]{""+segmentLength, ""+priority, ""+isPooled, ""+isExchange, ""+packetNumber, ""+conversationId, ""+requestNumber, conversation, sendListener});
      setLayoutToConversation(segmentLength, priority, isPooled, isExchange, packetNumber, JFapChannelConstants.SEGMENT_SEGMENTED_FLOW_END, conversationId, requestNumber, conversation, sendListener);
      layout = JFapChannelConstants.XMIT_SEGMENT_END;
      transmissionRemaining = segmentLength;
   }
66951
public void displayResourceInfo(List<CmsResource> resources, String messageKey) {

        m_infoResources = Lists.newArrayList(resources);
        if (m_infoComponent != null) {
            m_mainPanel.removeComponent(m_infoComponent);
            m_infoComponent = null;
        }
        if ((resources != null) && !resources.isEmpty()) {
            if (resources.size() == 1) {
                m_infoComponent = new CmsResourceInfo(resources.get(0));
                m_mainPanel.addComponent(m_infoComponent, 0);
            } else {
                m_infoComponent = createResourceListPanel(
                    messageKey == null ? null : Messages.get().getBundle(A_CmsUI.get().getLocale()).key(messageKey),
                    resources);
                m_mainPanel.addComponent(m_infoComponent, 0);
                m_mainPanel.setExpandRatio(m_infoComponent, 1);

                // reset expand ratio of the content panel
                m_contentPanel.setSizeUndefined();
                m_contentPanel.setWidth("100%");
                m_mainPanel.setExpandRatio(m_contentPanel, 0);
            }

        }
    }
253642
@Override protected void resizeDynamicText() {
        double maxWidth = width - size * 0.1;
        double fontSize = size * 0.3;

        timeText.setFont(Fonts.latoRegular(fontSize));
        timeText.setText(timeFormatter.format(tile.getTime()));
        Helper.adjustTextSize(timeText, maxWidth, fontSize);
        timeText.setX((width - timeText.getLayoutBounds().getWidth()) * 0.5);
        timeText.setY(size * 0.35);

        //maxWidth = width - size * 0.1;
        fontSize = size * 0.1;
        dayOfWeekText.setFont(Fonts.latoRegular(fontSize));
        if (dayOfWeekText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(dayOfWeekText, maxWidth, fontSize); }
        dayOfWeekText.setX(size * 0.05);
        dayOfWeekText.setY(height - size * 0.275);
        dayOfWeekText.setY(timeRect.getLayoutBounds().getMaxY() + size * 0.11);

        //maxWidth = width - size * 0.1;
        dateText.setFont(Fonts.latoRegular(fontSize));
        if (dateText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(dateText, maxWidth, fontSize); }
        dateText.setX(size * 0.05);
        dateText.setY(height - size * 0.15);
        dateText.setY(timeRect.getLayoutBounds().getMaxY() + size * 0.235);
    }
1020345
public void setPanelState(PanelState state) {

        // Abort any running animation, to allow state change
        if(mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING){
            Log.d(TAG, "View is settling. Aborting animation.");
            mDragHelper.abort();
        }

        if (state == null || state == PanelState.DRAGGING) {
            throw new IllegalArgumentException("Panel state cannot be null or DRAGGING.");
        }
        if (!isEnabled()
                || (!mFirstLayout && mSlideableView == null)
                || state == mSlideState
                || mSlideState == PanelState.DRAGGING) return;

        if (mFirstLayout) {
            setPanelStateInternal(state);
        } else {
            if (mSlideState == PanelState.HIDDEN) {
                mSlideableView.setVisibility(View.VISIBLE);
                requestLayout();
            }
            switch (state) {
                case ANCHORED:
                    smoothSlideTo(mAnchorPoint, 0);
                    break;
                case COLLAPSED:
                    smoothSlideTo(0, 0);
                    break;
                case EXPANDED:
                    smoothSlideTo(1.0f, 0);
                    break;
                case HIDDEN:
                    int newTop = computePanelTopPosition(0.0f) + (mIsSlidingUp ? +mPanelHeight : -mPanelHeight);
                    smoothSlideTo(computeSlideOffset(newTop), 0);
                    break;
            }
        }
    }
89978
synchronized void trim(long startKey, long endKey) {
        /*
         * [3, 4, 5, 9] -> [10, 13, 14, 15] -> [21, 24, 29, 30] -> [31] :: start layout
         *       |5______________________________23|                    :: trim(5, 23)
         *       [5, 9] -> [10, 13, 14, 15] -> [21]                     :: result layout
         */
        final Iterator<Chunk> descendingIterator = chunks.descendingIterator();
        while (descendingIterator.hasNext()) {
            final Chunk currentTail = descendingIterator.next();
            if (isFirstElementIsEmptyOrGreaterEqualThanKey(currentTail, endKey)) {
                freeChunk(currentTail);
                descendingIterator.remove();
            } else {
                currentTail.cursor = findFirstIndexOfGreaterEqualElements(currentTail.keys, currentTail.startIndex,
                        currentTail.cursor, endKey);
                break;
            }
        }

        final Iterator<Chunk> iterator = chunks.iterator();
        while (iterator.hasNext()) {
            final Chunk currentHead = iterator.next();
            if (isLastElementIsLessThanKey(currentHead, startKey)) {
                freeChunk(currentHead);
                iterator.remove();
            } else {
                final int newStartIndex = findFirstIndexOfGreaterEqualElements(currentHead.keys, currentHead.startIndex,
                        currentHead.cursor, startKey);
                if (currentHead.startIndex != newStartIndex) {
                    currentHead.startIndex = newStartIndex;
                    currentHead.chunkSize = currentHead.cursor - currentHead.startIndex;
                }
                break;
            }
        }
    }
709477
public void deleteDescriptorIfNecessary() throws CmsException {

        if (m_removeDescriptorOnCancel && (m_desc != null)) {
            m_cms.deleteResource(m_desc, CmsResourceDeleteMode.valueOf(2));
        }

    }
1104104
public void onCancel() {

        if (m_publishSelectPanel.m_model != null) {
            final List<CmsUUID> toRemove = m_publishSelectPanel.m_model.getIdsOfAlreadyPublishedResources();
            if (toRemove.isEmpty()) {
                hide();
            } else {
                CmsRpcAction<CmsWorkflowResponse> action = new CmsRpcAction<CmsWorkflowResponse>() {

                    @Override
                    public void execute() {

                        start(0, true);
                        CmsWorkflowActionParams params = getWorkflowActionParams();
                        getService().executeAction(
                            new CmsWorkflowAction(CmsWorkflowAction.ACTION_CANCEL, "", true),
                            params,
                            this);
                    }

                    @Override
                    protected void onResponse(CmsWorkflowResponse result) {

                        stop(false);
                        hide();

                    }
                };
                action.execute();
            }
        } else {
            hide();
        }
    }
537621
private void removeDeletedFromModified(CmsClientSitemapEntry entry, CmsSitemapClipboardData data) {

        data.removeModified(entry);
        for (CmsClientSitemapEntry child : entry.getSubEntries()) {
            removeDeletedFromModified(child, data);
        }
    }
14757
@Override
	public void remove(final WComponent aChild) {
		super.remove(aChild);
		PanelModel model = getOrCreateComponentModel();

		if (model.layoutConstraints == null) {
			Map<WComponent, Serializable> defaultConstraints = ((PanelModel) getDefaultModel()).layoutConstraints;

			if (defaultConstraints != null) {
				model.layoutConstraints = new HashMap<>(defaultConstraints);
			}
		}

		if (model.layoutConstraints != null) {
			model.layoutConstraints.remove(aChild);

			// Deallocate constraints list if possible, to reduce session size.
			if (model.layoutConstraints.isEmpty()) {
				model.layoutConstraints = null;
			}
		}
	}
746471
public void configure(CmsObject cms) {

        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_TOOLMANAGER_CREATED_0));
        }
        if (m_roots.getObject(ROOTKEY_DEFAULT) == null) {
            CmsToolRootHandler defToolRoot = new CmsToolRootHandler();
            defToolRoot.setKey(ROOTKEY_DEFAULT);
            defToolRoot.setUri(CmsWorkplace.PATH_WORKPLACE + "admin/");
            defToolRoot.setName("${key." + Messages.GUI_ADMIN_VIEW_ROOT_NAME_0 + "}");
            defToolRoot.setHelpText("${key." + Messages.GUI_ADMIN_VIEW_ROOT_HELP_0 + "}");
            addToolRoot(defToolRoot);
        }
        m_tools.clear();
        m_urls.clear();
        Iterator<CmsToolRootHandler> it = getToolRoots().iterator();
        while (it.hasNext()) {
            CmsToolRootHandler toolRoot = it.next();
            if (!cms.existsResource(toolRoot.getUri())) {
                if (CmsLog.INIT.isInfoEnabled()) {
                    CmsLog.INIT.info(
                        Messages.get().getBundle().key(
                            Messages.INIT_TOOLMANAGER_ROOT_SKIPPED_2,
                            toolRoot.getKey(),
                            toolRoot.getUri()));
                }
                continue;
            }
            try {
                toolRoot.setup(cms, null, toolRoot.getUri());
                configureToolRoot(cms, toolRoot);
                // log info
                if (CmsLog.INIT.isInfoEnabled()) {
                    CmsLog.INIT.info(
                        Messages.get().getBundle().key(Messages.INIT_TOOLMANAGER_SETUP_1, toolRoot.getKey()));
                }
            } catch (CmsException e) {
                // log failure
                if (CmsLog.INIT.isWarnEnabled()) {
                    CmsLog.INIT.warn(
                        Messages.get().getBundle().key(Messages.INIT_TOOLMANAGER_SETUP_ERROR_1, toolRoot.getKey()),
                        e);
                }
            }
        }
    }
135150
public static void showPanel(final View panelLayout) {
        final Activity activity = (Activity) panelLayout.getContext();
        panelLayout.setVisibility(View.VISIBLE);
        if (activity.getCurrentFocus() != null) {
            KeyboardUtil.hideKeyboard(activity.getCurrentFocus());
        }
    }